Skip to content

Python API

Convert a PDF file to the specified format and return the result as a string.

Parameters:

ParameterTypeDefaultDescription
pathstrrequiredPath to the PDF file
formatstr"markdown"Output format: "markdown", "json", "html", "text"
pagesstrNonePage range, e.g. "1-5"
table_methodstrNoneTable detection method

Returns: str — the converted content.

import edgeparse
markdown = edgeparse.convert("document.pdf", format="markdown")
json_str = edgeparse.convert("document.pdf", format="json")
html = edgeparse.convert("document.pdf", format="html")
text = edgeparse.convert("document.pdf", format="text")

convert_file(path, output_dir, format, **kwargs)

Section titled “convert_file(path, output_dir, format, **kwargs)”

Convert a PDF file and save the result to a file.

Parameters:

ParameterTypeDefaultDescription
pathstrrequiredPath to the PDF file
output_dirstrrequiredDirectory to save output
formatstr"markdown"Output format

Returns: str — path to the saved file.

import edgeparse
out = edgeparse.convert_file("document.pdf", "output/", format="json")
print(f"Saved to: {out}")