# PDF to XML

Convert PDF documents to structured XML format with preserved content hierarchy

> Canonical page: https://elysiatools.com/en/tools/pdf-to-xml

- **Category:** Document Tools

- **Keywords:** pdf, xml, convert, document, structure, markup, data, hierarchy

## Overview

Convert PDF documents to structured XML format using pure Node.js.

**Features:**
- Extracts text and structure from PDF files
- Converts to well-formed, valid XML
- Preserves document hierarchy (headings, paragraphs, lists)
- Separates content into pages
- Supports code blocks, blockquotes, and horizontal rules
- Includes metadata attributes for document structure
- Optimized for programmatic XML processing

## Inputs

- **PDF File** (file): Upload a PDF file
- **Output Mode** (select)
- **Include XML Declaration** (checkbox)

## When to use

- When you need to extract structured text data from PDF reports, manuals, or articles for downstream XML-based data pipelines.
- When migrating legacy PDF documentation into structured content management systems that require XML input.
- When parsing PDF content programmatically and you need to preserve structural elements like headings, lists, and page boundaries.

## How it works

- Upload your PDF document using the file input field.
- Choose your preferred output mode (Compact XML or Pretty-printed XML) and decide whether to include the XML declaration.
- Click the convert button to process the document and download the generated XML file containing the structured content.

## Use cases

- Converting technical manuals from PDF to XML to feed into documentation databases.
- Extracting structured text from academic papers for text mining and natural language processing.
- Automating the ingestion of PDF-based invoices or reports into enterprise resource planning systems.

## Frequently asked questions

### Does this tool preserve the visual layout of the PDF?

No, it preserves the logical structure and content hierarchy, such as headings, paragraphs, lists, and page divisions, rather than the visual layout.

### What output modes are supported?

You can choose between Compact XML for smaller file sizes or Pretty-printed XML for human-readable formatting.

### Can I include or exclude the XML declaration?

Yes, you can toggle the 'Include XML Declaration' option to add or remove the standard XML header.

### Is there a file size limit for the PDF?

Yes, the maximum supported file size for PDF uploads is 50 MB.

### Does the tool support scanned PDFs with OCR?

No, this tool extracts text and structure from digital PDFs; it does not perform OCR on scanned images.

## Related tools

- [LibreOffice PPT to PDF Handouts](https://elysiatools.com/en/tools/libreoffice-ppt-to-pdf-handouts): Convert PPT/PPTX to PDF and optionally render handout layout with multiple slides per page
- [PDF Header/Footer Snippets](https://elysiatools.com/en/tools/pdf-header-footer-snippets): Convert HTML to PDF with reusable logo, title, and date snippets
- [HTML to PDF Renderer](https://elysiatools.com/en/tools/html-to-pdf-renderer): Render a limited HTML subset into a PDF with a deterministic layout
- [LibreOffice DOCX to PDF](https://elysiatools.com/en/tools/libreoffice-docx-to-pdf): Batch convert .doc/.docx files to PDF via LibreOffice while keeping original layout
- [LibreOffice DOCX to PDF/A](https://elysiatools.com/en/tools/libreoffice-docx-to-pdf-a): Convert DOC/DOCX to PDF/A using LibreOffice rendering and Ghostscript conformance pass
- [LibreOffice XLSX to PDF Report](https://elysiatools.com/en/tools/libreoffice-xlsx-to-pdf-report): Convert Excel workbooks to multi-page PDF reports via LibreOffice and merge batch outputs
- [SVG to PDF](https://elysiatools.com/en/tools/svg-to-pdf): Convert SVG vector graphics to PDF documents for printing and sharing
- [HTML Mail to PDF](https://elysiatools.com/en/tools/libreoffice-html-mail-to-pdf): Render email HTML content to PDF with preserved basic formatting using Puppeteer

## Samples

- [PDF Samples](https://elysiatools.com/en/samples/pdf-samples): Generated PDF samples from tools dated 2026-02-01 to 2026-02-10
- [Markdown Slide Deck Samples](https://elysiatools.com/en/samples/md-slide-deck-to-pdf): Remark/Marp style Markdown slide decks for testing PDF export layouts
- [Android Serialization Java Samples](https://elysiatools.com/en/samples/android-serialization-java): Android Java serialization examples including JSON serialization, deserialization, and XML parsing
- [Android Serialization Kotlin Samples](https://elysiatools.com/en/samples/android-serialization-kotlin): Android Kotlin serialization examples including JSON serialization, deserialization, and XML parsing

## Related content

- [PDF to Office, Web, Ebook, and Structured Conversion](https://elysiatools.com/en/hubs/pdf-to-office-and-ebook-converters): Turn PDFs into Word, Excel, PowerPoint, HTML, EPUB, image, text, and XML outputs with a clear format-selection workflow.
