When you need to convert HTML to PDF
HTML to PDF conversion is useful for developers generating invoices or reports from HTML templates, saving web page content as a permanent archived PDF, converting email template designs to PDF for review and approval, archiving web articles before they go offline, or sharing HTML-based documents with people who won't be viewing them in a browser.
How to convert HTML to PDF free — step by step
- Open ihatepdf.cv/html-to-pdf — no sign-up required
- Paste your HTML code into the editor, or upload a .html file
- Preview renders in real time showing how the PDF will look
- Click Convert to PDF and download — no watermark, no server upload
What CSS is supported?
Inline styles and embedded CSS inside a <style> tag are fully applied.
External stylesheets linked via <link> tags pointing to remote URLs also
work when you have an internet connection. For best results with complex layouts, inline all
your CSS before converting to ensure nothing depends on external resources.
Tips for better HTML to PDF output
- Use print CSS — add
@media printrules to hide navigation, ads, and interactive elements that shouldn't appear in the PDF - Set explicit page breaks — use
page-break-before: alwaysin CSS to control where pages split - Use pt or mm for fonts — these scale correctly for print; px can behave inconsistently across PDF engines
- Avoid fixed positioning —
position: fixedelements may not render as expected in PDF - Inline your web fonts — external CDN fonts may not render correctly if unavailable
Convert a saved webpage to PDF
Save a webpage as an HTML file (File → Save Page As → Webpage, Complete in your browser), then upload the .html file to the converter. This captures the rendered layout including all styles applied by the website's CSS.
Generate invoices, receipts and reports from a template
This is the developer's shortcut for turning an HTML template into a deliverable document without spinning up a headless-browser PDF service. Build your invoice, receipt, certificate, or report as a self-contained HTML file with the data filled in and the CSS inlined, paste it in, and download a pixel-faithful PDF. Because conversion runs entirely in your browser, it is a fast, private way to produce one-off documents — or to prototype the exact markup you will later wire into an automated pipeline.
Print-ready HTML: page size, margins and backgrounds
A few CSS rules make the output behave like a real printed page. Use an @page rule
to set the size (for example @page { size: A4; margin: 20mm; }) so the PDF matches
standard paper. Because PDF generation does not print background colours by default the way a
browser does, add -webkit-print-color-adjust: exact to elements whose fills must
appear. Combine that with @media print rules and explicit page breaks, covered above,
to get clean, predictable pages every time.
Frequently asked questions
Why does my page look different in the PDF than in the browser?
Usually because something depended on the live web — JavaScript, a CDN font, or an external stylesheet that was not reachable. Inline your CSS and fonts and avoid JS-rendered content, and the PDF will match your preview.
Can I set the PDF to A4 or Letter size?
Yes — control it from your CSS with an @page size rule. Using pt or mm units for
fonts and layout keeps everything scaled correctly for print.
Does the converted PDF have a watermark?
No. ihatepdf never adds watermarks.
What about JavaScript in the HTML?
JavaScript is not executed during conversion. Content that requires JavaScript to display (dynamic charts, lazy-loaded images) may not appear in the PDF. For these cases, take a screenshot of the rendered page and use Images to PDF instead.