PDF Api Hub icon

PDF Api Hub

HTML to PDF

Actions36

HTML / URL to PDF → HTML to PDF

AI-generated

Summary

Render supplied HTML as a PDF, optionally using a ready-made sample, CSS, Google Fonts, and placeholder values. Configure the page and viewport, then return the PDF as a hosted URL, base64 data, or binary file.

Inputs

  • Ready-Made Sample Name or ID — Select a sample to prefill HTML and placeholder fields. When selected, the sample HTML is used; otherwise, provide HTML Content.
  • HTML Content — Full or partial HTML to render when no sample is selected. Supports {{placeholder}} syntax.
  • CSS Content (Optional) — CSS injected into the HTML before rendering.
  • Load Google Fonts — Google Font name or names separated by |. The HTML or CSS must reference the fonts with font-family.
  • Dynamic Params (From Sample) — Values for placeholders provided by the selected sample.
  • Dynamic Params — Additional key/value replacements for {{placeholders}}; merged with sample parameters.
  • Output Format — Choose a hosted URL, base64 string in JSON, or raw PDF binary. Defaults to URL.
  • Output Filename — Filename for the PDF; .pdf is appended if omitted. Defaults to document.pdf.
  • Paper Size — PDF paper size, default A4.
  • Orientation — Portrait or landscape; defaults to portrait.
  • Margins — Choose a preset or custom margins. Defaults to small; custom mode exposes top, right, bottom, and left values.
  • Viewport Size — Browser viewport used during rendering, affecting page layout. Defaults to 1280 × 720; custom mode exposes width and height.
  • Advanced Options — Optional settings for browser header and footer, maximum page count, CSS page-size preference, and background printing. The navigation timeout setting is documented for URL-to-PDF and does not apply to this HTML operation.

Output shape

A PDF result in the selected format: hosted URL, base64 data in JSON, or binary file.

The hosted-link option is described as available for 30 days. Source bodies are omitted in the supplied source pack, so runtime response fields and exact handling of sample parameters cannot be verified.

Links

Discussion