0
Help us understand the problem. What are the problem?

posted at

updated at

登記情報(pdf)→メモ帳(txt)変換

windows10
Python 3.9.0
visual studio code

・ファイル名を入れないといけない。
・ファイル1つしか出来ない。
・一行しかコピー&ペースト出来ない。
・___
・___


from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from pdfminer.pdfpage import PDFPage
input_path = 'ファイル名.pdf'
output_path = 'result.txt'
manager = PDFResourceManager()
with open(output_path, "wb") as output:
    with open(input_path, 'rb') as input:
        with TextConverter(manager, output, codec='utf-8', laparams=LAParams()) as conv:
           interpreter = PDFPageInterpreter(manager, conv)
            for page in PDFPage.get_pages(input):
                interpreter.process_page(page)

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
0
Help us understand the problem. What are the problem?