LoginSignup
0
0

More than 1 year has passed since last update.

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

Last updated at Posted at 2021-09-20

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)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0