# XML to PDF converter

Source: https://xmlvalid.com/tools/xml-to-pdf

> Turn an XML file into a PDF to read, print or attach to an email: pretty-printed, with tags, attributes and values in colour and every line numbered. Choose A4 or Letter and the text size, then download it. Everything runs in your browser

## What the PDF looks like

- The document is indented as the [XML formatter](https://xmlvalid.com/tools/xml-formatter) does it, or kept as written with **Pretty-print** off.
- Tags, attribute names, values and comments are coloured as in the editor, in a monospaced font, with a line number beside each line. A line too long for the page wraps under its indent, without a number.
- Each page names the file and its page number. The text is real text: it can be searched and copied in any PDF reader.
- Cyrillic, Greek, Vietnamese and Japanese are drawn with fonts embedded in the PDF. Characters no embedded font has, such as Chinese, Korean or Arabic, show as `?` and the page says so.

## Large documents

The PDF takes the first 80,000 lines, over 1,000 A4 pages at 8 pt, and says how many were left out. For a long file, a smaller text size or landscape pages put more on each page.

## E-invoices

This page prints an e-invoice's XML as code. To get the invoice itself as a PDF, with the seller, buyer, lines and totals laid out as on paper, open it in the [e-invoice viewer](https://xmlvalid.com/tools/e-invoice-viewer): it reads XRechnung, ZUGFeRD, Factur-X, Peppol, FatturaPA and KSeF. To check it before sending, use the [validator](https://xmlvalid.com/validate).

## Questions

### Is my XML uploaded?

No. The PDF is made in your browser with pdf-lib; the file never leaves your machine.

### Can I convert XML to PDF with an XSLT stylesheet?

Not here: this page prints the XML itself. XSL-FO needs a formatter such as Apache FOP. The XSLT transformer turns XML into HTML, which a browser can print to PDF.

### Does the XML have to be well-formed?

Yes: a broken document stops with the line and column of the problem, so it can be fixed in the editor first. Untick Pretty-print to keep its own line breaks and indentation.

### Can I search the text in the PDF?

Yes. The PDF holds the text, not a picture of it.

  ### Other tools

- [XML formatter](https://xmlvalid.com/tools/xml-formatter): Pretty-print or minify XML, keeping text, CDATA and comments as written.
- [XML viewer](https://xmlvalid.com/tools/xml-viewer): Read a document as a tree you can fold, search and copy XPaths from.
- [XPath tester](https://xmlvalid.com/tools/xpath-tester): Evaluate XPath 3.1 against a document and see each match with its line.
- [XSD generator](https://xmlvalid.com/tools/xsd-generator): Infer an XML Schema from sample documents, checked against them.
- [XML from XSD](https://xmlvalid.com/tools/xsd-to-xml): Generate a sample XML document from a schema, validated against it.
- [XSLT transformer](https://xmlvalid.com/tools/xslt-transformer): Run XSLT 1.0, 2.0 or 3.0 on a document and see the result, the messages and the files it writes.
- [XML diff](https://xmlvalid.com/tools/xml-diff): Compare two XML documents as trees: changed, added and removed elements, attributes and text.
- [XML to JSON converter](https://xmlvalid.com/tools/xml-to-json): Convert XML to JSON, with arrays where an element repeats or wherever its XSD allows.
- [JSON to XML converter](https://xmlvalid.com/tools/json-to-xml): Convert JSON to XML: @keys become attributes, arrays repeated elements.
- [XML to CSV converter](https://xmlvalid.com/tools/xml-to-csv): Turn a repeating element into CSV rows: invoice lines, products, records.
- [E-invoice viewer](https://xmlvalid.com/tools/e-invoice-viewer): Read an XRechnung, ZUGFeRD, Factur-X or Peppol invoice as a document, and save it as a PDF.
- [ZUGFeRD validator](https://xmlvalid.com/zugferd-validator): Check a ZUGFeRD or Factur-X PDF: the XML inside against its profile's rules, and the PDF around it.
- [XRechnung validator](https://xmlvalid.com/xrechnung-validator): Check an XRechnung in UBL or CII against EN 16931 and KoSIT's XRechnung rules before you send it.
- [UBL validator](https://xmlvalid.com/ubl-validator): Check a UBL invoice, order or any other UBL 2.1 document against its OASIS schema, and the business rules of the profile it names.
- [Peppol validator](https://xmlvalid.com/peppol-validator): Check a Peppol BIS Billing 3.0 or PINT invoice against the OpenPeppol rules before your access point sends it.
- [P7M viewer: open a .p7m file](https://xmlvalid.com/tools/p7m-viewer): Open a signed .p7m file: the PDF, invoice or document inside it, and who signed it.
- [XRechnung examples to download](https://xmlvalid.com/tools/xrechnung-examples): Example XRechnung and ZUGFeRD invoices to download, one for each common case.
- [E-invoicing mandate in Germany: do I have to?](https://xmlvalid.com/tools/e-invoicing-mandate): Find out whether your invoices in Germany must be e-invoices in 2026, 2027 and from 2028.
- [Factur-X examples](https://xmlvalid.com/tools/factur-x-examples): Example Factur-X invoices of every profile and of the French reform, as XML and as PDF.
- [Leitweg-ID check](https://xmlvalid.com/tools/leitweg-id): Check the form and the check digits of a Leitweg-ID, the address of a German public buyer.
- [Peppol lookup](https://xmlvalid.com/tools/peppol-lookup): Check whether a company is registered in Peppol, under which ID, and which invoices it can receive.
- [XML validator](https://xmlvalid.com/validate): check a document against XSD, DTD, RelaxNG or Schematron, up to 1 GB.
