HTML to PDF Converter
HTML code, a saved web page or a ZIP of one — to a PDF, safely and privately.
HTML
No HTML yet.
Preview
In the print dialog that opens:
- Set Destination (or Printer) to Save as PDF — on Windows you can also pick Microsoft Print to PDF.
- Keep Margins on Default and Scale at 100%: the page size and margins you chose here are already applied.
- Turn on Background graphics if colours or shading are missing, and turn off the browser’s own Headers and footers if you don’t want its date and address lines.
- On iPhone or iPad, use the share button in the print screen and choose Save to Files.
The pages of your PDF appear here: paste HTML, open an .html or .zip file, or press Example.
About the HTML to PDF Converter
Paste HTML — a whole page or just a fragment — or open an .html file, and save it as a PDF with the page size, orientation, margins and scale you choose. If the page uses pictures, stylesheets or fonts, open a .zip of its folder (or add the files) and they are used exactly where the HTML refers to them.
The HTML is cleaned before it is shown: scripts, event handlers, embedded frames and javascript: links are removed, and the preview runs in a frame that is not allowed to run code. No web address is fetched — this converts HTML you have, it is not a “URL to PDF” service. Pictures from the web load only if you allow them. Your browser’s print engine writes the PDF, so the text stays selectable in every script, and nothing is uploaded.
How to use it
- Paste HTML into the box, press Open .html or .zip (or drop a file on the box), or press Example. For a page with pictures and CSS, open a ZIP of its folder — if it contains several pages, choose one under Page to convert.
- Choose the Page size, Orientation, Margins and Scale. If the HTML sets its own page size with CSS (
@page), you can keep it with Use the page size and margins set in the HTML. - Check the preview, which shows the printable area at the width it will print. Notes under the heading tell you about missing files or blocked web pictures.
- Press Save as PDF, choose Save as PDF in the print dialog, and keep the scale at 100% there.
Examples
invoice.html with a <style> block and the company logo as a data: picture
An A4 PDF with the logo, the coloured table header and borders, because “Print background colours and pictures” is on
page.zip: index.html, css/site.css, img/photo.jpg, fonts/brand.woff2
The page with its stylesheet, picture and font, laid out at the printable width of the page (about 680 CSS pixels for A4 with 15 mm margins), which responsive layouts see as their screen width
Common uses
- Turning an HTML invoice, receipt, report or email template into a PDF to send or archive.
- Making a PDF of a static page or documentation you have as files, with its CSS and pictures.
- Checking how an HTML page will print — page breaks, margins and print stylesheets — before sending it.
- Converting HTML exported from another program (a CMS, a note-taking app, an email) into a PDF.
How the HTML is made safe
The HTML is parsed into an inert document, where nothing runs or loads. DOMPurify then removes scripts, event-handler attributes (onclick, onerror …), <iframe>, <object> and <embed>, and javascript: links. What remains is shown in a frame without permission to run scripts. Stylesheets, pictures and fonts are taken only from your own files; every other reference — url() in CSS, @import, web fonts — is blocked, and web pictures (https://…) load only when you tick Load pictures from the web, because loading them tells those sites your IP address.
Pages that build their content with JavaScript therefore look empty here. For those, open the page in your browser and use its own Print → Save as PDF.
Page size, margins and scale
The preview frame is exactly as wide as the printable area of the page (page width minus margins, at 96 CSS pixels per inch), so CSS media queries and percentage widths behave as they will when printed; it is scaled down to fit your screen. Scale below 100% lays the page out wider and shrinks it to fit — handy for wide tables. Your HTML’s own print rules (@media print, break-before, page-break-inside) are honoured. Page numbers in the footer are printed by Chrome and Edge from version 131.
Limitations
- This is not a URL-to-PDF converter: it never downloads a web page. Save the page (or a ZIP of it) and open that.
- JavaScript doesn’t run, so content that scripts create, interactive charts and embedded videos or maps don’t appear.
- Remote stylesheets and web fonts are never loaded; include them in the ZIP. ZIP64 and password-protected archives are not supported, and archives that unpack to more than 400 MB are refused.
- Exactly where pages break is decided by your browser; add
break-before: pagein your CSS to force a break. - The HTML cleaner loads on first use, so it needs an internet connection.
Privacy
Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.
Frequently asked questions
Is my HTML uploaded to make the PDF?
No. The HTML, its pictures and CSS are read on your device, shown in a frame on this page and printed to PDF by your browser. Nothing is sent to a server.
Can I convert a web page by its address?
No — this tool never fetches web addresses. Save the page from your browser (or download the HTML) and open the file, or a ZIP of the page with its folder, here.
Why are pictures or styles missing?
Files the HTML refers to must be in the ZIP (or added with Add pictures, CSS & fonts); missing ones are listed under the preview. Web pictures are blocked until you tick Load pictures from the web, and web stylesheets and fonts are never loaded.
Why are background colours missing from the PDF?
Keep Print background colours and pictures on. If your browser still drops them, also turn on Background graphics in its print dialog.
How do I fit a wide page onto A4?
Lower Scale (for example to 70%), choose Landscape, or reduce the margins. The preview updates straight away.