PDF Tools
All tools, free, in your browser.
Convert PDF to XML Free Online
Export text content of a PDF as structured XML with page numbers and coordinates. Supports page range selection.
How to convert a PDF to XML online
- Click Choose File or drag your PDF into the upload zone.
- Optionally set a page range if you only need a subset of the document.
- Click Convert to XML and wait while pdf.js parses each page's text and coordinate data.
- Download the
.xmlfile directly to your device — no signup required.
What the XML structure looks like and what it captures
The output is a well-formed UTF-8 XML document. A root <document> element contains one <page number="N"> child per converted page. Inside each page, <text> elements hold the extracted string content along with x, y, width, and height attributes representing the bounding box in PDF user units. This makes the output machine-readable without further transformation: you can XPath into it, load it into a DOM parser, or pipe it through an XSLT stylesheet. One important caveat — the converter relies on the embedded text layer inside the PDF. Layout-only PDFs (those assembled purely from images or drawn paths with no text objects) will produce an XML skeleton with empty text content. Scanned documents fall into this category and require an OCR pass first.
When to use PDF to XML
This tool fits any workflow that needs to treat a PDF as structured data rather than a fixed visual artifact. Typical scenarios include: ingesting contract or invoice text into a data pipeline that expects XML input; archiving document content in a format that remains parseable without PDF tooling; migrating bulk document libraries into a CMS or database that accepts XML feeds; and automated quality checks where a script validates that required phrases or section headings appear at expected coordinates. The page-range option is especially useful when only a specific section of a large report carries the data you need, saving parse time and keeping the output file small.
Frequently asked questions
- What does the XML output actually contain?
The output XML wraps the document in a root element, then groups content by page. Each page element carries a number attribute and contains text-block child elements. Each text block records the extracted string along with its x/y coordinates and bounding-box dimensions as attributes, so you can reconstruct approximate reading order or spatial layout programmatically.
- Does the tool preserve the document structure, or just dump raw text?
The tool goes beyond a flat text dump. pdf.js is used to extract text items with their positions on each page, and those items are serialized as structured XML elements with coordinate metadata. Headings and body copy are not semantically distinguished in the output — that classification would require heuristic post-processing on your side — but the spatial data is there to support it.
- Will it work on a scanned PDF?
Only partially. Scanned PDFs are images; they contain no embedded text layer. The converter will produce an XML file with empty or near-empty page elements. If you need text from a scanned document, run it through the OCR PDF tool first to embed a text layer, then convert to XML.
- Can I target specific pages rather than converting the whole file?
Yes. The tool includes a page-range selector. Enter a single page, a comma-separated list, or a hyphenated range (for example, 2-8) to limit conversion to those pages. Only the specified pages appear in the output XML, and their page-number attributes reflect the original document numbering.
- Does my file leave my device during conversion?
No. The conversion runs entirely in your browser via WebAssembly. Your PDF is read from local memory, parsed on-device, and the resulting XML is assembled and downloaded without any network transfer. No file ever reaches a server.