Print House

How to Print an XML File (Windows, Mac and Browser)

· 5 min read · Printing at Home

In this article
  1. Print an XML File in 5 Steps
  2. How to Tell It Printed Correctly
  3. The One Failure People Hit: One Endless Line of Text
  4. Which Program to Print From
  5. Printing to PDF Instead of Paper
  6. Big Files: Print Only What You Need
  7. Keeping the Printed Copy Useful

Open the XML file in a web browser (Chrome, Edge or Firefox) and use File > Print, or open it in Notepad or TextEdit first if you want to edit or add line breaks before printing. The whole job takes about two minutes.

Time 2 min · Steps 5 · Level Easy

  1. Right-click the file and open it with a browser. On Windows choose Open with > Google Chrome or Microsoft Edge; on Mac right-click, choose Open With, and pick a browser if it appears, otherwise use the method below.
  2. Check the display. Chrome and Edge show the XML as a collapsible tree with colour-coded tags; Firefox shows a similar tree. If you see raw text on one long line, use the plain-text method below instead.
  3. Press Ctrl+P on Windows or Command+P on Mac. The browser print dialog opens with a preview of exactly what will come out of the printer.
  4. Set the options. Choose your printer (or "Save as PDF" to make a printable file instead), set Layout to Portrait, and pick Scale around 90-100% so long tag names are not cut off at the right edge.
  5. Click Print and check the first page. If tag names are clipped or the text is too small, go back, set Scale to "Fit to page" or "Shrink to fit", and print again.

How to Tell It Printed Correctly

Compare the first printed line with the first line on screen. The opening tag, usually something like <?xml version="1.0"?>, should appear at the top of page 1, and the last closing tag should appear on the final page. Count the pages in the preview before printing and match that count to what comes out of the printer; if the paper count is short, the print was cut off and you should reprint with a smaller scale setting.

The One Failure People Hit: One Endless Line of Text

The most common problem is an XML file with no line breaks, so the browser or editor shows a single line that runs off the printed page and the right side of every tag is lost. The fix is to open the file in a text editor that wraps lines, then print from there:

  1. Open the file in Notepad (Windows) or TextEdit (Mac). In Notepad, turn on Format > Word Wrap. In TextEdit, it wraps long lines by default; make sure it is in plain-text mode, not rich text, so the tags are not restyled.
  2. Check the font size. Notepad's default is fine for most files; if the print is too small, set a larger font in Format > Font before printing.
  3. Print with File > Print and the same settings as above. Word wrap forces each long line onto the page width, so nothing is lost off the right edge.

Browser word wrap works differently: Chrome and Edge wrap long lines in the XML view, but a very wide single-line file can still print awkwardly, which is why the text-editor route is the reliable fallback.

Which Program to Print From

You havePrint it with
A browser installed (Chrome, Edge, Firefox)Open with the browser, then Ctrl+P / Command+P; best for a clean, readable copy
Windows only, no browser handyNotepad with Word Wrap on; best when the file has no line breaks
A MacTextEdit in plain-text mode, or any browser
A code editor (VS Code, Notepad++)Open the file and use its Print command; keeps indentation and colours
A file too large to read on paperPrint a page range (for example pages 1-10) instead of the whole file

Menu names can differ slightly between versions of Windows, macOS and each browser, so if a label is not exactly as written here, look for the nearest equivalent in the same menu.

Printing to PDF Instead of Paper

If the goal is a shareable copy rather than paper, choose "Save as PDF" or "Microsoft Print to PDF" (Windows) or "Save as PDF" (Mac) in the printer dropdown of the print dialog. The result is a PDF of the XML exactly as displayed, which you can email or archive. This is also the safe way to check the layout before using paper: save the PDF, open it, and confirm nothing is clipped before sending the job to a real printer.

Big Files: Print Only What You Need

XML files can run to hundreds of pages, so check the page count in the print preview before committing. If the preview shows more pages than you want, set the Pages field to a range such as 1-5, or open the file in a text editor, copy the section you actually need into a new file, and print just that. For a file that is mainly for record-keeping, printing only the first page (which usually holds the declaration and the top-level structure) plus the last page is often enough to prove the file's shape and endpoint.

Keeping the Printed Copy Useful

Write the original filename on the printed first page, because a printed XML file has no visible filename of its own and several look alike once the tags start. If you print from a browser, the header or footer of the page usually shows the file path or URL, which does the same job; you can turn headers and footers on or off in the print dialog's More settings. Store printed listings flat in a folder away from moisture, the same as any paperwork, and reprint from the file rather than photocopying if you need a second copy, since a fresh print is sharper.