Convert PDF to XML
PDF to XML imports a PDF through LibreOffice and returns an Office-flavored XML file. It is a best-effort text and layout export, not a copy of the PDF's structure or tags.
Drag and drop files here, or click to choose
Accepts PDF · up to 500.0 MB per file · up to 20 files at once
You can also paste a file with Ctrl/Cmd+V, or from the clipboard menu.
PDF to XML sends the file through LibreOffice `writer_pdf_import` with `outputFormat=xml`. The download is an Office-flavored XML document (`octet-stream`), not a reconstruction of PDF content streams or tagged-PDF structure.
This is the same LibreOffice import family as Convert to Word, aimed at XML instead of DOCX. Layout, tables, and fonts are best-effort. Scans with no text layer import as pictures or empty runs.
There are no options on this page. Password-protected files are unlocked for you on this page once you enter the password; API callers run Unlock first. For a scan, run OCR PDF with the Searchable PDF output first.
If you need rows from a table, PDF to CSV is the layout heuristic. If you need words only, PDF to Text is smaller.
The output is a single XML file. It describes a document as an office suite understands it: paragraphs, text runs, styles, and any embedded pictures. It does not describe the PDF itself, so you will not find page objects, fonts as the PDF stored them, or the original content stream operators in it.
Decide by what your next program expects. If a pipeline already reads LibreOffice or Office XML, this is a direct input. If you want to read the words in a script, plain text is simpler. If you want to edit the layout, convert to Word instead and open the file in an editor.
Because the importer reconstructs paragraphs from positioned text, line breaks inside a paragraph, columns, headers and footers may be placed in a different structure than a human would draw. Treat the XML as a first pass to be checked, not as a faithful mirror of the PDF.
Features
- LibreOffice `writer_pdf_import` to XML
- Not a PDF-structure dump and not OCR
- No page-range or schema options
- Anonymous API at /api/v1/convert/pdf/xml
When to use this tool
- Feed a born-digital PDF into a pipeline that already eats Office XML
- Inspect how LibreOffice tokenized the document
- Get an XML draft when DOCX is the wrong next step
- Compare how two exports of the same document were structured by diffing their XML output
- Pull paragraph-level text with style names into a script that already knows the Office XML vocabulary
How do I convert a PDF to XML?
- Upload a text-based PDF.
- Click Process. There are no format choices on this page.
- Download the `.xml` file.
- Open it in LibreOffice or an editor and treat it as a draft.
- Search the XML for a few distinctive words from the PDF. If you cannot find them, the PDF probably has no text layer and you should run OCR PDF with the Searchable PDF output first.
- Check the places where the layout is hardest, such as columns, tables and footnotes, before feeding the XML to anything automated.
Limits and edge cases
- Not tagged-PDF or XFDF/XFA extraction
- Not OCR
- Tables and pagination will not match the PDF
- Fonts are named but not embedded
- Very large or complex files may fail or take long, because the whole document is imported first
- Upload limit on this website: 500 MB per file, sent in chunks above about 95 MB. A single direct API request body is capped at 100 MB.
Examples
- A two-page text-only memo from a word processor: the XML holds the paragraphs with their styles, and searching for a sentence from the memo finds it
- A magazine page with three columns: expect the text to be ordered by the importer's reading of the page, which may interleave columns, so check the order
- A 30-page scan with no text layer: the XML contains mostly picture references, and the next step is OCR PDF with the Searchable PDF output
- A text memo often becomes a large Office XML file with paragraph runs
- A scan-only PDF often becomes XML that mostly wraps images
Privacy for this tool
Files are uploaded over HTTPS, processed in memory or a short-lived temporary directory on our servers, and deleted when your result is ready. We do not keep copies for later browsing, training, or advertising profiles. See the Privacy Policy for retention details and AdSense cookie disclosures.
Frequently asked questions
- Does the XML keep my tables?
- It may keep a table when the importer recognizes the layout as one, but pagination and cell boundaries are best effort. If rows and columns are the goal, PDF to CSV is the more direct tool.
- Why is the file so much larger than the PDF?
- Office XML spells out every paragraph, run and style in text, and pictures can be embedded, so the output can be larger than the source. That is a property of the format, not a sign of an error.
- Will it work for a scanned document?
- Not in a useful way. Without a text layer there is nothing to import except page pictures. Run OCR PDF with the Searchable PDF output first, then convert that PDF; in a test the recognized text came through as text in the XML and the page picture stayed.
- Can I get the tags from a tagged PDF?
- No. The tag tree of an accessible PDF is not exported. The structure in the XML comes from the importer's layout guesses.
- What should I do if the conversion fails?
- Try Repair on the PDF and run the conversion again. If it still fails, the file may be damaged beyond what the importer can read.
- Are fonts preserved?
- Font names are carried as styles when the importer can read them, but the output does not embed the font files, so the XML will render with substitutes if the font is not installed.
- Is this the PDF's internal XML?
- No. It is LibreOffice exporting the imported document as XML, not the PDF object tree.
- Why is a scan almost empty?
- LibreOffice has no text to import. Run OCR PDF with the Searchable PDF output first, or use OCR PDF to Text for the words from pixels.
- Can I choose another XML flavor?
- No. The converter defaults outputFormat to xml and only allows that value on this path.
- How is this different from Convert to Word?
- Same importer, different output. Word gives docx/doc/odt. This path gives xml.
Last updated:
Call this from code
Every tool on this site is a plain REST endpoint - no account or API key needed for anonymous use. Built for AI agents and developers as much as for browsers.
curl -X POST "https://pdf123.xyz/api/v1/convert/pdf/xml" \
-F "[email protected]" \
-o output.pdfAlso available as an MCP tool for agent clients that speak Model Context Protocol (JSON-RPC 2.0 over POST /mcp). Full API reference
Use it from an AI agent
SkillClaude Code, Codex, Cursor and other AI agents can run PDF to XML for you with this skill: /skills/pdf123-pdf-to-xml.md
Files are used only for this processing job and deleted automatically afterward.