Loading Techie Utils…

XML to PDF Converter

Print an XML document as an indented tree. Free, and runs entirely in your browser — nothing you enter is uploaded, stored or sent to a server.

About XML to PDF

An XML document printed as an indented tree: each element on its own line with its attributes beside it, nested according to its depth.

Parsed with the browser's own XML parser rather than with a regular expression. That is not fastidiousness — XML is not a regular language, and every attempt to read it with patterns breaks on the first CDATA section, namespace prefix or nested tag of the same name. Using a real parser also means an invalid document is reported as invalid, with the parser's own message, rather than producing a plausible and wrong rendering.

It suits configuration files, feeds, small data documents and anything that has to be attached to a filing. A very large XML document produces a very large PDF that nobody will read, which is worth deciding before converting rather than after.

Where it helps

  • A real XML parser, so CDATA, namespaces and entities are handled correctly.
  • Invalid XML is reported with the parser's own message instead of a wrong-looking document.
  • Attributes are shown beside their element and text content on the element's own line.
  • The root element is set as a heading, so the document has a title.
  • The file never leaves your browser.

Limits

  • The output is a rendering rather than XML: it cannot be parsed back.
  • Deeply nested documents indent off the right edge.
  • Comments and processing instructions are not shown.
  • No syntax colouring, and no wrapping of very long attribute values.
  • Standard PDF fonts are Latin-1 only, so non-Latin content is substituted.

Frequently asked questions

Why was my file rejected?

Because it is not well-formed XML, and the message is the parser's own. Unescaped ampersands and unclosed tags are the usual causes — HTML is frequently not valid XML, which is why this is for XML specifically.

Can it apply my XSLT?

No. This prints the structure as it is. Transforming the document first and converting the result is the way to get a styled rendering.

Are comments shown?

No — only elements, their attributes and their text. A document whose comments matter is better printed as plain text.

Will an SVG work?

It will print as a tree of its markup, which is occasionally what somebody wants. To see the *picture*, use the SVG Converter or Images to PDF instead.

Related tools

More Images & Files tools