My Tool Studio
PDF Tools·4 min read

HTML to PDF: Code, Files, ZIPs and Live Web Pages

Maybe you built an invoice template in HTML, saved a report as an .html file, or want to keep a copy of an article before it changes. All of these need the same thing: turning something made for a scrolling screen into fixed pages. The HTML to PDF Converter handles pasted code, uploaded files and web addresses, and this guide explains the settings and the two ways it can make the PDF.

HTMLPDFHTML → PDF

Three ways to give it HTML

Paste, upload or link.

Paste HTML works for templates and snippets, from a full page with a style block to a single table. Upload takes one saved .html file, or a .zip of a whole saved website. Web page URL fetches live pages through our server, which simply returns their HTML; the drawing still happens in your browser. Put several addresses on separate lines, up to 20, and each becomes its own PDF, downloaded together as a ZIP.

A lone .html file has no web address, so relative paths such as images/logo.png cannot be found. Zip the page together with its CSS, pictures and fonts and upload the .zip instead: every local file is built into the page before it is drawn. Pages fetched by URL keep their address, so their relative links and images resolve normally.

Safe by design: scripts never run

Why some pages come out incomplete.

Before anything is drawn, the HTML is cleaned with DOMPurify. Scripts, frames, embedded objects and event handlers are removed. That means you can paste HTML from anywhere without it running code in your browser.

The trade-off is that pages which build their content with JavaScript, such as many single-page apps and dashboards, can come out empty or partly empty. Server-rendered pages, blogs, documentation and templates convert well.

Page size, margins and screen width

Paper on one side, screens on the other.

Pick A2, A3, A4, A5, US Letter, US Legal or One long page, in portrait or landscape, with no, small, normal or big margins. Screen width decides how the page is laid out before it is scaled onto the paper: Full HD at 1920 pixels or Desktop at 1440 gives the full desktop design, Tablet at 768 and Phone at 390 or 320 show responsive layouts, and Fit the paper width lays the page out at the printable width.

One long page makes a single tall PDF page, which is handy for design reviews or archiving a full landing page. PDF readers cap a page at 200 inches, so very long pages continue onto a second page.

Clean page breaks and cleanup options

No lines cut in half.

Screenshots of web pages often slice a line of text across two pages. The converter measures every line and picture first, then moves each page break up to the nearest gap between lines. Only when there is no gap within 30 percent of a page, for example inside a very tall picture, does it cut at the normal height.

Remove fixed cookie bars, headers and pop-ups deletes elements pinned to the screen and makes sticky headers scroll normally, so they do not cover content or repeat. Keep background colours and images can be unticked to save ink. Page numbers and the address with the date can be printed in the margins.

Convert to PDF or Print / Save as PDF

Pick by what the reader needs.

Convert to PDF draws the page as sharp images, adds an invisible text layer for search and copy, and keeps links clickable. It gives the same result on every device, supports any screen width and one long page, and can add page numbers.

Print / Save as PDF hands the page to your browser's print engine, using the page's own print styles and web fonts. Text stays real and selectable in any language, and pictures from other sites are usually kept. Margins and headers are then set in the print dialog.

  • Invoice or receipt template: paste the HTML, A4, small margins, Convert to PDF.
  • Keeping a copy of an article: URL, remove fixed elements, Print / Save as PDF.
  • Mobile design review: Phone screen width, One long page.

A worked example

Saving a product page for a client.

Say you want to send a client a PDF of their product page as it looks today. Choose Web page URL, paste the address, pick A4 portrait with small margins and Laptop at 1200 pixels, and leave Remove fixed cookie bars ticked. Press Convert to PDF.

The cookie bar and sticky menu are gone, the page is split into A4 pages between lines of text, and the links still work in the PDF. Tick Address and date in the top margin if the PDF is a record of how the page looked on a given day.

Known limits

What a browser cannot do here.

A few things are outside what can be done safely in a browser tab.

  • Pages behind a login, or sites that block automated fetching.
  • Content loaded by JavaScript after the page opens.
  • Pictures from sites that do not allow cross-site use, in the downloaded PDF.
  • Web fonts in the downloaded PDF may be replaced by similar system fonts.
  • Videos, iframes and embedded maps.

Try it now

Open HTML to PDF Converter

The tool is one click away. No sign up, no upload, no payment.

Open HTML to PDF Converter