HTML to PDF
Render an HTML file into a paginated PDF.
Updated
Add your files
HTML, HTM
How to convert HTML to PDF
- 1
Add one or more .html or .htm files saved on your device; the tool takes files, not web addresses.
- 2
Choose the Page size, A4 or Letter. Page numbers are always printed.
- 3
Press Convert HTML to PDF. Each file becomes its own PDF, laid out in your browser, and the result lists what was not rendered.
- Use Text to PDF when the file is plain text or Markdown rather than HTML.
- Use Word to PDF when the document is a Word .docx: it goes through the same renderer with its own page options.
Which HTML is honoured
Headings h1 to h6 (h5 and h6 are set like h4), paragraphs, div and blockquote blocks, bulleted and numbered lists nested up to three levels with their start numbers, tables with a header row of th cells and colgroup widths, pre blocks as code, hr as a rule, br as a line break, and img elements whose src is a data URI holding a PNG or JPEG, or another format your browser can redraw. Inline b, strong, i, em, u, s, code, mark and a elements are read, and a link to an http, https or mailto address stays clickable in the PDF. script, style, noscript, iframe, object and embed elements are removed before anything is read.
How the pages are laid out
The page is A4 or Letter with margins of 54 points, body text in Helvetica at 11 points and headings at 20, 15.5, 13 and 11.5 points; Liberation Sans is embedded when the text needs Greek or Cyrillic, and other scripts become "?" with a count in the result. Columns of a table are sized to their content, its header row is repeated on each new page, and a table too wide for the page is printed in parts of consecutive columns. Pictures are scaled to fit the text width, and a document that would pass 1,000 pages is refused with a message.
Questions about HTML to PDF
Can I convert a web page by its address?
No. Nothing is fetched from the web: the tool reads a file you already saved, and the pictures in it are kept only when they are embedded in the file as data rather than linked by address. To capture a live page, save it from your browser first, or print it to PDF there.
Why does my page come out unstyled?
Because stylesheets are not applied. The renderer walks the HTML elements and lays them out by its own rules: headings in bold at fixed sizes, paragraphs at 11 points, lists indented, tables ruled. Of the CSS it reads only inline style attributes, for colour, background colour, font size, bold, italic, underline, strikethrough and text alignment, and the widths of table columns. Classes, embedded or external stylesheets, floats, grids, columns, fonts and background images have no effect.
Why does it say no content was found?
The body holds no readable text, list, table or embedded picture, usually because the page builds itself with a script when it loads. Scripts are never run here, so such a page converts to nothing; print it to PDF from your browser instead.
Advertisement