#!venv/bin python3 import pdftotree def hocr_result(): hocr_result = pdftotree.parse("static/pdf/downloaded.pdf") with open('static/hocr/downloaded.hocr', 'w') as f: f.write(hocr_result) return hocr_result