What does this HTML to PDF converter keep, and what does it drop?
This converter keeps the visible text of your HTML and drops everything else. It parses the markup, walks the body, starts a new line for every block element such as a heading, paragraph, list item or table row, and writes the result into a plain US Letter PDF in 12-point Helvetica. Styling, images and links don't survive. The output downloads as document.pdf.
That's a deliberate scope. Rendering HTML and CSS faithfully needs a full browser engine, and your browser already has one (more on that below). This tool is for the narrower job of getting the words out of a lump of markup and into a readable PDF quickly, without uploading anything.
A worked example
Paste this and click Convert:
<h1>Quarterly update</h1>
<p>Revenue rose 4% & costs fell.</p>
<ul><li>Hiring paused</li><li>New office in Leeds</li></ul>
The PDF contains four lines:
Quarterly update
Revenue rose 4% & costs fell.
Hiring paused
New office in Leeds
The & entity became a real ampersand, and each block element got its own line, even the two list items that had no whitespace between their tags. Inline elements such as strong, a or span stay within the line they belong to.
How the text is collected
- Everything in
headis ignored, as arescript,style,noscript,template,iframe,svg,canvasandselectelements in the body. - Elements with the
hiddenattribute or an inlinedisplay:noneorvisibility:hiddenstyle are skipped. Elements hidden by a stylesheet class are still included, because no CSS is applied. - Block elements (
p,div,h1toh6,li,tr,blockquote,sectionand similar) become separate paragraphs, with a small gap between them. - A
brstarts a new line, and two in a row leave a blank line. - Table cells in a row are joined with a space, so
<td>Pens</td><td>4</td>prints as "Pens 4". - Inside
pre, line breaks are kept, but runs of spaces are still collapsed, so indentation is lost.
Page layout
| Property | Value |
|---|---|
| Page size | US Letter, 612 x 792 points (8.5 x 11 in) |
| Margins | 50 points (about 0.7 in) on every side |
| Font | Helvetica, 12 pt, black |
| Line spacing | 16.8 pt (1.4 x the font size), plus 7.2 pt between paragraphs |
| Lines per page | Up to 42, then a new page starts |
| Long words | Split across lines when wider than the text area |
Lines wrap at spaces. A single unbroken string wider than the 512-point text area, like a long URL or a base64 blob, is broken mid-word onto the next line rather than running off the page, so nothing is cut off.
Characters that can't be drawn
The tool uses Helvetica as one of PDF's built-in standard fonts with WinAnsi (Windows-1252) encoding (ISO 32000-1, Annex D). That covers English and most Western European accented letters, plus symbols such as €, £, curly quotes and dashes. Anything else stops the conversion with a message naming the character:
| Input contains | Result |
|---|---|
café, naïve, €20 |
Works |
Rupee sign ₹ |
"The character "₹" (U+20B9) can't be drawn with this tool's built-in PDF font..." |
| Cyrillic, Greek, Arabic, CJK, emoji | The same message, naming the first such character |
Only tags, no text (<img src="a.png">) |
"No visible text found in that HTML." |
| Empty box | Nothing happens |
Invisible zero-width characters (zero-width space, joiners and the byte-order mark) are removed before the check, since they draw nothing anyway.
When you need the real layout
Use the browser's own print engine. Open the HTML in a browser tab, press Ctrl+P (Cmd+P on a Mac), and pick "Save as PDF" as the destination. That honours your CSS, including print-specific rules such as the @page at-rule for paper size and margins, and it can embed fonts for any script. If you have a snippet rather than a file, render it in the HTML viewer or tidy it in the online HTML editor first, then save it as an .html file and open that.
Related tools
- Word counter: check how much text you're about to put in the PDF.
- HTML encoder and decoder: turn entities like
&into characters, or back, without making a PDF. - Learn HTML: a refresher on which elements are block-level, which decides where this converter starts new lines.
Last updated