pdftojson.dev
PDF → XML

Turn any PDF into structured XML.

Drop a PDF and get well-formed XML back — a document with a page element for every page. Parsed in your browser.

— no file —
Runs in your browser Nothing uploaded Scanned & tables via API Free to use

Building something? Same parse, one call.

Send a PDF, get the same structured output back, plus OCR for scanned files and table extraction. Batch-ready. From $29/month.

Read the API docs →
# POST a file, get XML curl -X POST https://api.pdftojson.dev/v1/extract \ -H "Authorization: Bearer $KEY" \ -F file=@doc.pdf \ -F format=xml

XML is still the lingua franca for a lot of enterprise and legacy systems — invoicing formats, publishing pipelines, government and EDI feeds. This tool reads a PDF's text layer and returns a well-formed <document> with one <page> element per page, with &, < and > escaped, so it drops straight into an XML parser or an XSLT transform.

It runs entirely in your browser on the text layer, so nothing is uploaded. For scanned PDFs or batch jobs, the same output is available from the API with OCR behind it — POST /v1/extract with format=xml.

What does the XML output look like?+

A document root with a page element for each page, each containing that page's extracted text. Special characters are escaped so the result is well-formed.

Is the XML well-formed?+

Yes. It includes an XML declaration and escapes reserved characters. The schema is deliberately simple and predictable rather than trying to reproduce the PDF's visual layout as tags.

Can I get a custom XML schema?+

The converter emits a generic page-and-text structure. If you need a specific schema — an invoicing or publishing DTD, say — extract to XML or JSON and transform it with XSLT or a short script on your side.

Can I convert a scanned PDF to XML?+

Not in the browser — scans have no text layer and need OCR first. The API can process scanned PDFs and return XML.

How do I convert PDF to XML in Python?+

Send the PDF to POST /v1/extract with format=xml. The API returns the XML as a string in the response.

Why choose XML over JSON?+

Pick XML when the system you're feeding expects it — many ERP, EDI, publishing and government pipelines do. For most modern code and for LLM work, PDF to JSON is easier to work with.

Does it preserve tables as XML?+

The browser converter returns text per page, not table markup. Real table structure is reconstructed by the API — see PDF table to JSON.

Is my PDF uploaded?+

No for text-based PDFs — the conversion runs on your device. OCR and automated processing through the API require the file to be uploaded.