Skip to main content

PDF to XML

Turn the text of a PDF into structured XML (pages, headings, paragraphs, tables), ready for automated processing. Processed locally in your browser, without uploading the document.

  • Export
Automate

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Your files are processed locally in your browser and are never sent to our servers.

Select the pages whose content should be converted to XML. All pages are selected by default.

Drop your file here

Recommended size: up to 100 MB

Was this tool useful?

On this page

How does this tool work?

PDF to XML turns the text of a PDF into structured, tagged data designed to be processed by a program rather than read on screen. Each page, heading, paragraph and table becomes an XML element, with page dimensions and numbered rows and columns. It is an entry point for an integration pipeline, an XSLT transformation or document indexing, prepared in your browser.

The selectable text of the chosen pages is read with its coordinates and rebuilt into blocks: headings (spotted by their character size), paragraphs and tables (spotted by their aligned columns). It is the same model as for the HTML, Markdown and CSV conversions; only the output format changes.

The file starts with an XML declaration in UTF-8. The pdf-document root element carries the number of converted pages; each page is a page element with number, width and height attributes in PDF points. Inside, heading has a level attribute from 1 to 3, paragraph holds a paragraph, and table, with rows and columns attributes, contains numbered row and then cell elements.

Reserved characters (<, >, &, quotes) are escaped so the file stays well-formed and readable by any XML parser. The format is specific to Bethemesh: it does not apply a business schema such as an e-invoice.

How to use this tool

  1. Import the PDF

    The grid shows every page, already selected.

  2. Narrow the selection

    Keep only the pages whose data you need, to lighten downstream processing.

  3. Download the XML

    The document.xml file can be validated, transformed with XSLT or loaded into your script.

Use cases

Feed automated processing

Load the content of PDF reports into a script, an ETL job or a document database.

Transform with XSLT

Produce another presentation or extract specific fields with a transformation sheet.

Index archives

Keep a structured text version of PDF documents for full-text search.

Examples

An A4 page with a heading and a table

The 595.28 × 841.89 point dimensions correspond to an A4 page. Each cell gives its column, so it can be found without relying on text order.

Input

A4 page with the title “Prices 2026”, one sentence and a 3-row Product / Price / Quantity table

Result

<pdf-document pages="1">
  <page number="1" width="595.28" height="841.89">
    <heading level="1">Prices 2026</heading>
    <paragraph>Prices include VAT until 31 December.</paragraph>
    <table rows="3" columns="3">
      <row index="1">
        <cell column="1">Product</cell>
        …

Tips and best practices

  • Dimensions are in PDF points: divide by 72 and multiply by 25.4 to get millimetres.
  • If your processing only needs the tables, PDF to CSV gives a simpler file to load.
  • Check complex tables: a merged cell may be attached to a single column.

Frequently asked questions

What is the structure of the XML file?

A pdf-document root element, then one page element per page, containing heading, paragraph and table elements; tables contain numbered row and cell elements.

Does the XML follow a standard such as ALTO or an e-invoice format?

No, it is a simple format specific to the tool. Use an XSLT transformation to adapt it to the schema your system expects.

Are the coordinates of each word exported?

No. Only page dimensions are provided; content is exported in blocks (headings, paragraphs, cells).

Is the file well-formed?

Yes: it starts with an XML declaration in UTF-8 and every reserved character is escaped.

What does a scanned PDF give?

An error, because there is no text to structure. Make it searchable with OCR PDF before converting.

Is the PDF processed on a server?

No. The document model and the XML file are produced in your browser.

Related tools

Tools similar or complementary to this one.

Works well with

Convert the text of a PDF into a structured HTML page with headings, paragraphs and tables.

PDF & documentsUse this tool

Extract selectable text from a PDF and convert it to Markdown locally, without OCR or uploading the document.

PDF & documentsUse this tool

Extract the tables in a PDF into a CSV file to open in Excel, LibreOffice or Google Sheets.

PDF & documentsUse this tool
TutorialBest practicesBeginner

How to securely redact a PDF before sharing it

Learn why covering text is not enough, how secure PDF redaction removes sensitive information and why sanitization matters before sharing.

10 September 20262 min
GuideBest practicesBeginner

PDF: understand the format and manage documents properly

Understand how PDF files are structured, the difference between native and scanned PDFs, and the right operations for merging, reorganizing, converting or completing documents.

29 August 20263 min