HTML to PDF
Convert a saved HTML file into a PDF on a conversion server, turning a web page or HTML export into fixed, printable pages.
Upload
Select or drag-and-drop your file.
Adjust
Choose your options. Everything happens in your browser.
Download
Save the finished file instantly. No watermarks.
Plenty of useful documents exist only as HTML: an order confirmation saved from a browser, a report exported by an app, a newsletter, documentation generated as a single page, or a page you built yourself. HTML reflows to fit whatever window it is in, and that is exactly what you do not want when the document has to be filed, printed or attached to a claim. A PDF freezes it at one page size.
This tool takes an .html or .htm file from your computer, not a web address. The file is uploaded, encrypted, to the CloudConvert service through PDFora's relay, where a rendering engine lays the page out and prints it to PDF; the result comes back named after your file and is deleted from the service afterwards. The conversion does not happen in your browser, and there are no settings for page size or margins on the page.
The biggest surprise for most people is what happens to everything the HTML file points to. A web page is rarely one file: images, stylesheets and fonts are usually separate files referenced from the HTML. Only the single file you choose is uploaded, so anything referenced by a relative path on your disk cannot be found by the server. Getting a faithful PDF is therefore mostly about making the HTML file self-contained before converting it.
How to convert HTML to PDF
- Make sure the HTML file is self-contained or uses full web addresses (https://...) for its images and stylesheets; see the notes below.
- Open HTML to PDF and choose the .html or .htm file.
- Click Convert and wait while the file is uploaded and rendered on the server.
- Download the PDF, which keeps your file's name with a .pdf extension.
- Check that images, colours and layout came through, and that no content is cut off at the right-hand edge.
When to use this tool
- Receipts and booking confirmations saved from a browser, kept as PDFs for accounts or a legal record.
- Reports exported by software as HTML that need to be attached to an email or archived.
- Developers turning a generated HTML invoice, certificate or letter template into a PDF to check the print layout.
- Documentation or a user guide published as one long HTML page, printed for offline reading.
- Saved web articles kept for research in a format that will not change if the site does.
- Email newsletters saved as HTML and converted for a record of what was sent.
What to know before you start
- Relative links break. If the HTML says <img src="images/logo.png"> or <link href="style.css">, those files stay on your computer and the server cannot see them. The PDF then shows missing images and unstyled text. Use absolute https:// addresses, or embed the CSS in a <style> block and images as data URIs.
- Resources with absolute web addresses may be fetched by the server when it renders the page, so publicly reachable images and stylesheets usually appear. Anything behind a login, on an intranet or on localhost will not.
- There is no URL box. To convert a live page, save it first; your browser's Save Page As > Web Page, Single File (.mhtml) is not accepted, so use Web Page, HTML Only, and expect relative images to be missing, or use the browser's own Print > Save as PDF.
- Print styles apply. If the page has CSS for @media print, the converter typically uses it, which can hide navigation bars or change colours compared with what you see on screen. Page breaks can be controlled with break-before and break-inside in CSS.
- JavaScript-built content is unreliable. Pages that fetch their content with scripts after loading may convert as an empty shell. Save the page after it has fully loaded, or render the content into the HTML on the server side.
- Layouts that are wider than a printed page, such as fixed 1400-pixel designs or wide tables, can be cut off or shrunk. A responsive layout or a max-width on the main content usually fixes it.
Tips for the best results
- For your own templates, put all CSS in a <style> block in the <head>; it is the single most reliable way to get a styled PDF.
- Add @page { size: A4; margin: 15mm; } to your CSS if you need a specific page size or margins.
- Use break-inside: avoid on table rows, cards and figures so they are not split across two pages.
- Keep image sizes sensible: a 5 MB hero image embedded as a data URI still makes a 5 MB PDF.
- Open the HTML file in your browser's print preview first; if it looks wrong there, it will probably look wrong in the converted PDF too.
A worked example: a small shop's HTML invoice template
A two-person online shop generates invoices as HTML files from a simple script. Each file links to invoice.css and logo.png in the same folder. Converted directly, the PDF is plain black text in a default font, with no logo and the totals table stretched across the full width, because the server received the HTML file without its stylesheet and image.
The fix is to make the file stand alone. The script now copies the contents of invoice.css into a <style> block, adds @page { size: A4; margin: 18mm; } and break-inside: avoid on the line-items table rows, and points the logo at its public https address on the shop's website instead of a local path. Nothing else changes.
Converted again, the invoice is a one-page A4 PDF with the logo, the shop's colours and a totals table that is no longer split when an order has many lines. Because the template is now self-contained, every invoice the script produces converts the same way.
Troubleshooting
- The PDF has no styling, just plain text
- The stylesheet was referenced by a relative path and was not uploaded. Embed the CSS in a <style> block or link it with a full https:// address.
- Images are missing
- Images on your disk referenced with relative paths cannot be reached. Use public https:// URLs or embed images as data URIs, then convert again.
- The page is cut off on the right
- The layout has a fixed width larger than the page. Add a max-width: 100% to the main containers and images, or a print stylesheet that narrows the layout.
- The PDF is blank or nearly blank
- The content is probably created by JavaScript after loading, or the file is only a redirect. Save the page once it is fully rendered, or produce the content in the HTML itself.
- Text appears in a different font
- Web fonts referenced locally were not available. Link the font from a public URL, embed it with @font-face and a data URI, or use a common font stack.
- The tool rejects my file
- Only .html and .htm are accepted. Saved .mhtml or .webarchive files need to be re-saved as HTML only.
Frequently asked questions
Can I convert a website by entering its URL?
No. The tool converts an HTML file you choose. Save the page as HTML first, or use your browser's Print > Save as PDF for a live page.
Is the HTML file uploaded?
Yes. It is sent encrypted to the conversion service, rendered there and deleted afterwards. Avoid converting pages that contain personal data you would not want processed by a third party.
Why are my images and CSS missing?
Only the HTML file itself is uploaded. Files it references by relative paths stay on your computer; use absolute https:// links or embed them in the HTML.
Can I set the page size or margins?
Not on the tool page. Set them in the HTML with a CSS @page rule, for example @page { size: A4; margin: 15mm; }.
Are links clickable in the PDF?
Links to web addresses normally stay clickable. Relative links to other local files will not lead anywhere useful.
Does JavaScript run during conversion?
It may partly run, but content that loads late or depends on user interaction is often missing. For reliable results, the HTML should already contain the final content.