0

I am looking for software which can convert a PDF file to semantic HTML. I found a good commercial software (PDF Tron), but I would like to know what the open source options are.

Here is an example PDF file. If the output does not contain a <table> tag for the table in the bottom, it is not semantic.

What I tried

pymupdf

import fitz

def to_html(filepath: str):
    doc = fitz.open(filepath)
    for i, page in enumerate(doc):
        text = page.getText("html")
        with open(f"pymupdf-page-{i}.html", "w") as fp:
            fp.write(text)
    doc.close()

Camelot

Camelot can extract the table as a dataframe, but it fails to understand that the rest is not a table.

pdftohtml

pdftohtml -c gives me the same output as pymupdf - no semantic tables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.