HTML to PDF not working? Every common problem and its fix

An illustrated symptom map of the eighteen most common HTML to PDF problems, each linked to a tested fix.

Updated · 7 min read

Most HTML to PDF problems fall into six groups. Find what you see in the map, then jump to the section below for the cause and a link to the guide where we reproduced it.

A symptom map in six coloured boxes. Layout is wrong: columns stack, content cut off, rows split. Something is missing: blank PDF, images missing, chart half drawn. It looks different: background gone, wrong font, blurry logo. Text problems: boxes instead of letters, code lines clipped, gaps in justified text. Extra pages or overlap: blank last page, header covers text, table header only on page 1. Conversion fails: check asset URLs, URL refused, too large or slow. Each symptom has an arrow to its usual cause.
Find the symptom, then the cause. Every row links to a tested guide below.

Before you start: a one-minute check

  1. Look at the PDF, not the live preview. The preview shows one long page with scripts blocked; page breaks, margin boxes and script-drawn content only appear in the PDF.
  2. See print styles in your own browser. In Chrome DevTools, the Rendering panel can emulate print media, so you can debug @media print rules live.
  3. Shrink the problem. Delete half the document and convert again. Repeat until the problem disappears; the last part removed holds the cause.

Layout is wrong

Something is missing

It looks different

Text problems

Extra pages or overlap

The conversion fails

Message starts withCause and fix
“This document or one of its resources could not load”An image, font or stylesheet points at a host that doesn’t exist or a private address such as localhost. Use public URLs or embed the file.
“Use a reachable public HTTP or HTTPS URL…”The webpage URL is private, has a login in it or uses a custom port. Only public pages on the standard ports can be converted.
“HTML must be 2 MiB or smaller”Usually large embedded images. Link them from a public URL or resize them; see the photo size case study.
“This document exceeds 100 pages” or “The PDF exceeds 20 MiB”Split the document, or reduce image sizes.
“Conversion took too long”The 45-second limit. Remove heavy scripts or slow external assets.
“Use a UTF-8 encoded HTML document”Re-save the file as UTF-8 in your editor.
“You have reached 10 conversions in a minute”Wait a minute. For batches, space requests out as in mail merge to PDF.

For the rules behind all of this in one place, read the complete guide to print CSS for PDFs.