Convert HTML to PDF
Convert HTML files to PDF format. Upload an HTML file to create a PDF.
Combine multiple PDFs into one
Split a PDF into separate files
Reorder pages by dragging
Pull specific pages out
Pull all images out
Remove pages from PDF
Rotate pages in any direction
Stack one PDF onto another
Reduce PDF file size
Clean up unused data
Make scanned text searchable
Spot the differences between two PDFs
Add text, signatures, shapes
Add your signature anywhere
Add text or image watermark
Number pages as 1, i or A
Add sticky-note comments
Ready-to-use forms to fill online
Add a password
Unlock a PDF with its password
Black out sensitive info
Editable .docx export
Tables as .xlsx
Each page as a JPG
Each page as a PNG
Each page as a WebP
Turn JPG images into a PDF
Turn PNG images into a PDF
Combine JPG, PNG, GIF or WebP into one PDF
Convert .docx to PDF
Convert .xlsx to PDF
Convert .pptx to PDF
Turn an HTML file into a PDF
Capture a webpage
34 PDF tools in total. Pick a category above or search for one.
How HTML to PDF renders your file
Your file is opened in a browser engine on our server, laid out at desktop width and printed to PDF with its background colours and images. It follows the screen version of your styles, so the PDF looks the way the page does on a monitor.
Each PDF page is 1440 by 2048 pixels with a 16-pixel margin, whatever size the file's CSS asks for, and longer content continues onto further pages.
That is how to convert HTML to PDF here, whether you're taking an HTML document to PDF or turning raw HTML code to PDF.
What an HTML file can load during conversion
Only the HTML file itself is uploaded, so what it can pull in depends on where each linked file lives.
Loads
- Styles and scripts written in the file
- Images, fonts and stylesheets on public http or https addresses
- Images embedded as data URIs
- Script libraries linked from public addresses
Left out
- Files linked by a relative path, like images/logo.png
- Anything on your computer or a local network
- Styles meant only for print, in @media print
- Other pages the file links to
Prepare the HTML file
-
Save it as UTF-8
The file is read as UTF-8, and anything that isn't valid UTF-8 is dropped, so accented letters from an older encoding can vanish. Saving the file as UTF-8 keeps them; a charset declared in the head doesn't change how the file is read.
-
Give relative links a base
If your images and styles are online, add a base element to the head that points to their folder. Relative paths then resolve to public addresses, and those load.
-
Build content as the page loads
The PDF is made a moment after the page stops loading files. Content a script adds later, on a timer or after a click, won't be in it.
Limits of the conversion
Each conversion is allowed up to six minutes, and one HTML file can be converted every 20 seconds. The dropzone takes one file at a time, and your CSS file and typed CSS go with it.
If the browser engine can't render the file, it is laid out by a document converter instead. That fallback keeps the text and basic formatting, but little of a CSS layout, so a PDF that looks plain usually comes from this route.
A single PDF is named after your file, with spaces and special characters turned into underscores and our site name added.
Add CSS before converting
-
Optional CSS file
Attach the stylesheet your file links to by a relative path. It is added to the page before rendering, so the PDF gets the styles the link couldn't load.
-
Custom CSS
Type rules that only the PDF needs, like hiding a menu or changing a font size. If you also attach a file, these rules come after it and win any tie.
Is the page already online?
Paste its address into Website to PDF instead, which loads the page with its images and styles straight from the site.
HTML to PDF questions
Still stuck? Contact us
Yes. Scripts run, and the conversion waits until the page has stopped loading files, so charts and content that scripts build while the page loads end up in the PDF.
Yes. Links in your HTML become links that open when clicked in the PDF, and the text stays selectable, so it can be searched and copied.
Yes, but a complete saved page is an HTML file plus a folder of files linked by relative paths, and those don't load here. Attach its main stylesheet as the Optional CSS file to keep most of the styling; pictures from that folder still won't appear.
Not as it is, because the PDF follows the screen styles. Paste the rules you need into Custom CSS without the @media print wrapper around them, and they apply to the PDF.
The pages are 1440 pixels wide, so a layout held to a narrower width leaves the rest blank. Widen it through Custom CSS, for example by removing the max-width on its main container.
No, only files ending in .html or .htm are accepted. Save the page in HTML format instead, or convert the live page with Website to PDF.
Yes, once it is saved as an .html file. Pictures that were attachments of the email, referenced with cid: addresses, won't load, because only http, https and data addresses are allowed.
Convert them one by one, then join the PDFs in the order you want with Merge PDF.