The vocabulary of the HTML to PDF API

The 10 fields and concepts you'll meet in the response — defined in plain English, each with a real example value.

10 terms
PDF Generation3

Headless Browser

A web browser without a graphical interface that can render web pages programmatically.

Headless browsers (Puppeteer, Playwright, Selenium) render HTML/CSS/JavaScript exactly like regular browsers but run in the background. They're used for automated testing, web scraping, and generating PDFs/screenshots. PDF generation via headless browsers produces pixel-perfect output.

ExamplePuppeteer renders complex HTML with CSS Grid → exports to PDF

PDF Rendering

The process of converting HTML/CSS into a PDF document with proper page layout and formatting.

PDF rendering interprets HTML structure and CSS styles, then outputs fixed-page PDF format. Rendering engines must handle: page breaks, headers/footers, margins, fonts, images, and print-specific CSS. Headless browsers offer most accurate rendering; dedicated PDF libraries are faster but less accurate.

ExampleHTML invoice template + CSS styling → Rendered PDF document

HTML to PDF

Converting HTML markup and CSS styles into a PDF file, preserving layout and formatting.

HTML to PDF conversion allows designers to create templates using familiar web technologies rather than PDF-specific tools. Approaches include: headless browser rendering (high fidelity), dedicated converters (wkhtmltopdf), or programmatic PDF libraries (fastest but manual layout). Best for invoices, reports, certificates.

ExampleInvoice HTML template → PDF via API → Download/email to customer

Page Layout4

Page Size

The dimensions of a PDF page, specified in standard formats like A4, Letter, or Legal.

Common sizes: A4 (210×297mm, international standard), Letter (8.5×11", US standard), Legal (8.5×14"), Tabloid (11×17"). Specify page size when generating PDFs to ensure proper layout. Printers expect specific sizes—mismatched sizes cause scaling or cropping. APIs accept sizes by name or custom dimensions.

Exampleformat: "A4", format: "Letter", format: {width: "8.5in", height: "11in"}

Margins

The blank space between the edge of the page and the content area in a PDF.

Margins ensure content doesn't get cut off when printing and improve readability. Standard margins: 0.5-1 inch (12-25mm) on all sides. Printers often can't print to the very edge (non-printable area ~0.25"). Specify margins in CSS or PDF API parameters. Headers/footers typically sit within margin areas.

Examplemargins: {top: "1in", right: "0.75in", bottom: "1in", left: "0.75in"}

Page Breaks

CSS properties that control where content splits across pages in a PDF.

Page break properties: page-break-before (force break before element), page-break-after (force break after), page-break-inside (avoid breaking within element). Use to: start chapters on new pages, keep tables intact, prevent orphaned headings. Essential for multi-page PDFs to maintain professional layout.

Exampleh1 {page-break-before: always} /* New page for each heading */

Headers and Footers

Footer

Content that repeats at the top (header) or bottom (footer) of every PDF page.

Headers/footers typically contain: page numbers, document title, company logo, dates. They sit in the margin area. Use dynamic variables: {{pageNumber}}, {{totalPages}}, {{date}}. Defined via HTML templates or API parameters. Essential for multi-page documents to maintain context on every page.

{ Footer: "Invoice #12345 | Page {{pageNumber}} of {{totalPages}}" }
PDF Features1

Font Embedding

Including font files within a PDF so custom fonts display correctly even if not installed on the viewer's device.

When custom fonts are used, the PDF must embed the font data (increases file size). Web-safe fonts (Arial, Times, Helvetica) aren't embedded—they're standard everywhere. Font subsetting includes only characters used in the document (reduces size). Most PDF generators handle embedding automatically.

ExampleCustom font: +150KB file size, Web-safe font: +0KB (not embedded)

Styling1

Print CSS

CSS styles specifically for printed or PDF output, separate from screen display styles.

Use @media print {} to define print-specific styles. Common adjustments: hide navigation/ads, show full URLs for links, adjust colors for grayscale printing, control page breaks. PDF generators use print CSS rules. This allows one HTML template to work both on-screen and in PDF.

Example@media print { .no-print {display: none;} a::after {content: " (" attr(href) ")";} }

Optimization1

PDF Compression

Reducing PDF file size by compressing embedded images and optimizing internal structure.

Compression techniques: image downsampling (reduce resolution), JPEG compression for photos, remove metadata, optimize internal PDF structure. Can reduce file size by 50-80% with minimal quality loss. Essential for email attachments (many servers limit to 10-25MB) and fast web delivery.

ExampleOriginal PDF: 5MB → Compressed: 1.2MB (76% smaller)

See these fields live. Run the HTML to PDF API free — no card, no signup wall.

Scaling up?

Volume pricing, custom SLAs, and dedicated support for high-traffic teams.

Contact sales