Files
python-node-pdf-reader/parse_text/read_pdf.py
2022-04-26 13:03:02 -05:00

13 lines
306 B
Python

import fitz
import sys
def read_PDF(path):
with fitz.open(path) as doc:
text = ""
for page in doc:
text += page.get_text()
with open(f'../recipe_text/{text[:20]}.txt', 'w') as f:
f.write(text)
read_PDF('../recipes/sample_recipe.pdf')
sys.stdout.flush()