Converting PDF text to HTML using pdfminer

Viewed 16

Looking at the documentation for pdfminer and trying to use this code (provided by the documentation) to extract tables from a large pdf file(6,000 pages+) into HTML so I can parse and iterate through data to put in a csv.

But I can't quite understand how this opens an HTML file... do I need to add some extra code to store it somewhere?

from io import StringIO
from pdfminer.high_level import extract_text_to_fp
from pdfminer.layout import LAParams
output_string = StringIO()
with open('samples/simple1.pdf', 'rb') as fin:
    extract_text_to_fp(fin, output_string, laparams=LAParams(),output_type='html', codec=None)

0 Answers
Related