HTML to PDF
Turn a web address, an HTML file, or pasted code into a PDF.
or drop files anywhere on this page
Your files stay in this browser. Nothing is uploaded.
URL mode depends on the site allowing cross-origin fetch from your browser.
About HTML to PDF
To convert HTML to PDF, this tool turns a web page, an .html file or pasted HTML code into a PDF, entirely in your browser: it renders the page off-screen at the width you choose and saves what it looks like as a PDF, with web links still clickable. The pages of the PDF are pictures of that render, so the text in them cannot be selected or searched.
Reach for it to archive a page, send someone a copy of it, or keep a record of how a page looked on a given day. A site that blocks cross-origin fetching, or content that only appears after you interact with the page, will not come through this way. The page’s own JavaScript is never run either, so a page that builds itself with scripts may come out empty.
How it works
- Add an .html file, or arrive through the "Save as PDF" bookmark described below; either takes you to the options screen and its three tabs.
- Choose a tab: Convert URL to PDF (web addresses, one per line, starting with https://), Convert HTML files, or HTML code. Switching to the URL or HTML code tab replaces the file you added to get in.
- Open More options to set page size, orientation, margins, viewport width and a delay before capture.
- Click Convert to PDF.
- Download the PDF, or a ZIP when converting more than one page.
- If a web address fails, save that page as an .html file from your browser (Ctrl or Cmd+S) and add it on the "Convert HTML files" tab instead.
What gets rendered, and what does not
The HTML is drawn in a hidden frame with scripting switched off, captured as one large picture, and cut into PDF pages. That suits pages that arrive as finished HTML, such as articles, documentation and receipts. Pages assembled by JavaScript, such as single-page apps and dashboards, typically come out empty or show only an "enable JavaScript" notice.
The pages are JPEG pictures at 90% quality, captured at 1.5 times the on-screen size. Links are the one live element: an address that begins with http becomes clickable over the right spot, while relative links, mailto: links and #anchor links do not.
Pasted code and uploaded files are drawn on their own, so a relative address inside them, such as an image src of "photo.png", is looked for on this site rather than on the site it came from, and is not found. Only the URL tab supplies the page’s address as a base. To keep a picture in a file or snippet, embed it as a data: address.
Web addresses, CORS and the bookmark
In the URL tab, your browser fetches each address directly, so the site has to allow it. Many sites do not let other websites read their pages, a rule called CORS, and for those the fetch fails. Any failed fetch, including a missing page or a network problem, shows the same message about CORS. No login cookies are sent, so a page behind a sign-in comes back as it would to a stranger, or fails.
Even when the page arrives, each image is drawn only if its own server allows it; a refused image is left as a gap. The "Save as PDF" bookmark saves typing and nothing more: drag its link from under the tabs to your bookmarks bar, and clicking it on any page opens this tool with that address in the URL tab. Only the address travels, not the page or your session, so the same CORS rule applies.
Saving the page from your browser and adding the .html file gets past the block on the page itself, but the saved file still refers to its pictures and stylesheets by address or through a folder you are not adding, so it may look plainer.
Options that change the result
All of these sit under More options.
- Page size: One long page (the default), A4, Letter, Legal or Custom size (width and height in mm). One long page is a single page as wide as the viewport and as tall as the whole capture. The fixed sizes cut the capture at set heights, which can slice through a line of text or an image, and only they use Orientation and Margins (None, Small at 10 mm or Normal at 20 mm).
- Viewport width (px): 1280 by default, from 320 to 2560. It sets the width the page lays itself out at (390 gives a phone-style layout). On a fixed size that whole width is shrunk to the page, so with no margin 16 px body text is about 7 pt on A4 at 1280 and about 12 pt at 800.
- Use print stylesheet: off by default. When ticked, the page’s @media print rules are applied to the render, but stylesheets loaded from another website cannot be inspected and are skipped.
- Hide cookie notices: on by default. It hides any element whose id or class contains "cookie" or "consent", and any whose class contains "gdpr". That can catch more than a banner, so untick it if part of a page goes missing.
- Delay before capture (seconds): 0 to 10, default 0. A pause after the page has loaded, for slow web fonts and background images. It does not make scripts run.
Frequently asked questions
Some sites block cross-origin requests from other websites, a security rule called CORS, which stops your browser from fetching the page’s HTML directly. Save the page as an .html file from your browser (Ctrl or Cmd+S) and use the "Convert HTML files" tab instead, since a file you already have isn’t subject to that block.
An image hosted on another domain is drawn only if its server permits it, even when the page itself converts fine. Images embedded in the HTML as data: addresses always appear, but saving a page as an .html file does not bring its pictures along.
Not always. It is a picture of how the page renders at your chosen viewport width, redrawn by a script rather than the browser’s print engine, so unusual CSS can look slightly different. The text is part of the picture, so it cannot be selected unless you run the OCR tool on the result.
It creates a single PDF page exactly as tall as the web page, instead of slicing the content into A4, Letter or Legal-sized pages.
Not from a web address. Nothing is signed in on your behalf, so the site sends what a stranger would get. If you can open it yourself, save it as an .html file and use the "Convert HTML files" tab.
It applies the page’s own @media print CSS rules, the ones your browser’s Print dialog uses, so elements such as navigation bars are hidden the same way here. Rules in stylesheets loaded from another website are skipped.
The page is never scrolled and its scripts never run, so anything loaded on scroll or built by JavaScript is not there at capture. A delay before capture helps only with content that arrives on its own, such as web fonts.
Yes. Use the "HTML code" tab and paste your markup in; it’s rendered and converted the same way as a URL or an uploaded .html file.
The rendering and the PDF are done by code in your browser tab, so the finished PDF is never sent to a server. For a web address, your browser fetches the page from that site directly, as visiting it would.
Related tools
This tool ran entirely in your browser and nothing was uploaded. Your Recent files list keeps a copy of local files under 5 MB until you clear it. How your files are handled.