XML to PDF

Turn an XML file into a PDF that is easy to read and share: indented, colored and numbered, or laid out by your XSL stylesheet. Files are read in your browser and never uploaded.

Updated by Khokhar Sab

How do I convert an XML file to PDF?

Press Choose an XML file. To print the formatted document an XSL stylesheet describes, add the .xsl file too, at the same time or with Add an XSL stylesheet. Choose line numbers and the page size, press Convert to PDF, then Download. Files that are not well-formed XML are rejected with the parser's message.

  1. Press Choose an XML file (add its .xsl stylesheet too if you have one).
  2. Tick Line numbers if you want them, and pick the Page size.
  3. Press Convert to PDF, then Download.

How does the tool lay out XML?

Some XML files are written on one long line, which is unreadable on paper. The tool puts each element on its own line, nested two spaces per level, and keeps short text on the same line as its element. This example shows a one-line file laid out by the tool's own code.

In the file: <order id="7"><item qty="2">Seeds</item><note/><addr><city>Leeds</city></addr></order>

<order id="7">
  <item qty="2">Seeds</item>
  <note/>
  <addr>
    <city>Leeds</city>
  </addr>
</order>

What does an XSL stylesheet do?

An XSL stylesheet (XSLT) turns XML data into a document, such as a table of products or an invoice. Browsers can run XSLT 1.0 themselves, so the tool applies your stylesheet on your device and prints the result, keeping its headings, tables and colors. XSLT 2.0 and 3.0 features are not supported by browsers.

Limits and fixes

  • Broken XML (a missing closing tag, a stray ampersand) is rejected; the message says where the parser stopped.
  • Stylesheets that load other files (xsl:include, document()) cannot reach them; put everything in one .xsl.
  • XSLT 2.0 and 3.0 are not supported by browsers; XSLT 1.0 works.
  • Browsers without XSLT: Chrome has announced it will remove XSLT. In a browser that no longer has it, the tool says so and prints the XML as formatted text.
  • Very large files (tens of megabytes) are slow to lay out; split them first.

Frequently asked questions

Is it free?

Yes, with no sign-up or limits.

Are my files uploaded?

No. Everything happens in your browser.

Can I convert RSS, KML or GPX files?

Yes. They are XML, so they print as formatted XML text.

Is the text searchable in the PDF?

Yes. The PDF holds real text, not pictures.

What about JSON files?

Paste JSON into Text to PDF; it keeps the indentation.

How this tool was built and tested