Guides

By PDF Logic Team

HTML to PDF: Prepare Static, Print-Ready Pages

Prepare self-contained HTML, choose print or screen styles and page settings, then inspect every generated PDF page.

PL
PDF Logic Team
3 min read

Prepare a self-contained HTML document

HTML to PDF accepts pasted HTML or an HTML/HTM file and includes starter templates. The source inspector flags external images, fonts, stylesheets, and other resources that should be embedded as data URLs or placed directly in the document. Conversion rejects executable scripts, embedded pages, and redirects with an unsafe-HTML error; replace them with the static content you want printed.

The current input limit is 50 MB. Large embedded images can make the source slow to edit and render even before that limit.

Choose page and media settings

Open Settings to choose A3, A4, A5, Letter, Legal, or a custom page size; portrait or landscape orientation; and margins. Select Print styles to apply print media rules or Screen styles to use the screen presentation. You can also allow supported CSS @page rules to control page size and margins instead of the selected paper size and workspace margins.

The W3C CSS Paged Media specification defines the page model, page size, orientation, and margins. The W3C media-type specification distinguishes print rules from screen rules. Browser PDF rendering still needs inspection because flowing content, fonts, and page breaks depend on the complete source and chosen settings.

Generate and inspect the PDF

  1. Start from a template, paste HTML, or upload one HTML/HTM file.
  2. Resolve source issues. Embed required assets and replace interactive or externally loaded content with static HTML, CSS, or images.
  3. Choose paper size, orientation, margins, media style, background printing, and CSS page-size handling.
  4. Select Generate PDF. Use page thumbnails, previous/next controls, and zoom to inspect the actual output.
  5. Adjust the source or settings and generate again. Download the PDF and keep the HTML source.

Illustrative print stylesheet

This snippet is illustrative; it was not rendered as a published benchmark. It shows the kind of explicit print rule that can make review easier:

@media print {
  nav { display: none; }
  h2 { break-after: avoid; }
  table { break-inside: avoid; }
}

Whether a table can remain on one page depends on its dimensions and the selected page box. Inspect the generated pages rather than assuming a break rule can fit content that is larger than the page.

Inspect an observed conversion example

The downloadable HTML conversion check was generated through the current local endpoint as both A4 and Letter PDFs. It used portrait orientation, 12 mm margins, 100% scale, print backgrounds enabled, and HTML page-size rules disabled. The published check records the source, outputs, settings, hashes, page dimensions, and the expected synthetic total of 105.00. Both one-page outputs were rendered and visually inspected on September 16, 2026. This evidence applies to those synthetic inputs and settings; it is not a general fidelity, speed, or accuracy benchmark.

Review checklist

  • Every required image and font appears without a network dependency.
  • Headings are not stranded from their following content and tables are readable across page boundaries.
  • Background colours and images are present only when intended.
  • Links, selectable text, page size, margins, and page count meet the destination’s needs.
  • No script-generated or embedded content is missing from the static source.

These guides describe PDF Logic’s tools and their limits. Read how this content was prepared or report a correction.

Topics

html to pdfwebpage to pdfprint css pdfhtml document conversionpaged media