URL to PDF in seconds

PDF Generation API Convert Any URL to PDF

Turn any webpage or HTML into a polished PDF document with a single API call. The Nodium HTML to PDF API supports custom paper sizes, margins, headers, footers, and print backgrounds. Generate invoices, reports, and documents programmatically.

Free plan includes 100 API calls/month. No credit card required.

Nodium API
PDF

Every Paper Format You Need

Generate PDFs in standard paper sizes used worldwide.

A4

A4

210 x 297mm

Letter

Letter

8.5 x 11in

Legal

Legal

8.5 x 14in

A3

A3

297 x 420mm

A5

A5

148 x 210mm

Tabloid

Tabloid

11 x 17in

Full Control Over PDF Output

Customize every aspect of the generated PDF document.

Custom Margins

Set top, right, bottom, and left margins independently. Specify values in pixels, inches, or millimeters for precise layout control.

Headers & Footers

Add custom HTML headers and footers with dynamic variables like page number, total pages, date, title, and URL.

Landscape Mode

Generate landscape-oriented PDFs for wide tables, charts, dashboards, and horizontal layouts with a single parameter.

Print Background

Include CSS background colors and images in the PDF output. Essential for branded documents, colored tables, and styled invoices.

Additional PDF options

Fit content to one page
Custom page ranges
Scale factor (0.1 to 2.0)
Prefer CSS page size
Tagged (accessible) PDF
Omit background graphics

Generate a PDF in One API Call

Set format=pdf and customize the output.

Basic URL to PDF (cURL)
curl "https://api.nodium.io/api/v1/screenshot?\
  url=https://example.com&\
  format=pdf&\
  pdf_format=A4" \
  -H "X-API-Key: ndm_your_api_key" \
  --output document.pdf
Custom margins and landscape (JavaScript)
const response = await fetch(
  "https://api.nodium.io/api/v1/screenshot?" +
    new URLSearchParams({
      url: "https://example.com/invoice/12345",
      format: "pdf",
      pdf_format: "A4",
      pdf_margin_top: "20",
      pdf_margin_bottom: "20",
      pdf_margin_left: "15",
      pdf_margin_right: "15",
      pdf_print_background: "true",
      pdf_landscape: "false",
    }),
  {
    headers: { "X-API-Key": "ndm_your_api_key" },
  }
);

const pdfBuffer = await response.arrayBuffer();
PDF with headers and footers (Python)
import requests

response = requests.get(
    "https://api.nodium.io/api/v1/screenshot",
    params={
        "url": "https://example.com/report",
        "format": "pdf",
        "pdf_format": "Letter",
        "pdf_print_background": True,
        "pdf_header_template": "<div style='font-size:9px;width:100%;text-align:center;'>Company Report</div>",
        "pdf_footer_template": "<div style='font-size:9px;width:100%;text-align:center;'>Page <span class='pageNumber'></span> of <span class='totalPages'></span></div>",
        "pdf_display_header_footer": True,
    },
    headers={"X-API-Key": "ndm_your_api_key"},
)

with open("report.pdf", "wb") as f:
    f.write(response.content)

What Developers Build with the PDF API

Invoices and receipts

Render HTML invoice templates as pixel-perfect PDF documents. Automate invoice generation from your billing system and email them directly to customers.

Reports and dashboards

Convert data dashboards, analytics reports, and charts into downloadable PDF documents. Schedule automated report generation on a daily, weekly, or monthly basis.

Web page archiving

Save point-in-time snapshots of web pages as PDF documents for compliance, legal discovery, or record-keeping. PDFs preserve layout and content faithfully.

Contracts and agreements

Generate contracts from HTML templates with dynamic data. PDFs maintain consistent formatting across all devices and platforms, making them ideal for legal documents.

Compliance documentation

Produce regulatory filings, audit reports, and compliance documents from structured HTML data. Add page numbers, headers, and footers automatically.

E-commerce order summaries

Create downloadable order confirmations, packing slips, and shipping labels as PDF documents from your e-commerce platform data.

Nodium vs. Other PDF Solutions

Why choose Nodium for HTML to PDF conversion over self-hosted or alternative tools.

FeatureNodium APIwkhtmltopdfPuppeteer
Modern CSS support
JavaScript executionLimited
Setup requiredNone (API)Install binaryNode.js + browser
ScalingAutomaticManualManual
Custom headers/footers
Flexbox & Grid layout
Web fontsPartial
Signed URLs
Async webhooks

Frequently Asked Questions

What is an HTML to PDF API?
An HTML to PDF API is a web service that converts any webpage or HTML content into a PDF document. You send a URL or raw HTML to the API endpoint, and it returns a rendered PDF file. Nodium uses headless Chromium to render the page with full CSS and JavaScript support, then converts the rendered output into a standards-compliant PDF document with customizable paper size, margins, and formatting.
What paper sizes does the PDF API support?
Nodium supports all standard paper sizes: A4 (210x297mm), A3 (297x420mm), A5 (148x210mm), Letter (8.5x11in), Legal (8.5x14in), and Tabloid (11x17in). You can also specify a custom paper width and height in pixels, inches, centimeters, or millimeters for non-standard document sizes.
Can I add headers and footers to generated PDFs?
Yes. You can provide custom HTML templates for both headers and footers. The templates support dynamic variables including page number, total pages, date, document title, and URL. Headers and footers are rendered on every page of the PDF automatically. Use standard CSS to style the header and footer content.
Does the PDF API support CSS backgrounds and images?
Yes. Set pdf_print_background=true to include CSS background colors, background images, gradients, and other visual styles in the PDF output. By default, Chromium excludes backgrounds from print output (like a normal browser print dialog), so you need to explicitly enable this for branded or styled documents.
How does Nodium compare to wkhtmltopdf?
wkhtmltopdf uses an older WebKit engine that lacks support for modern CSS features like Flexbox, Grid, CSS Variables, and many newer properties. Nodium uses headless Chromium, which supports all modern web standards. Additionally, Nodium is a managed API that requires no server setup, handles scaling automatically, and supports JavaScript-heavy pages that wkhtmltopdf cannot render.
Can I generate PDFs from raw HTML instead of a URL?
Yes. You can pass raw HTML content directly to the API using the html parameter instead of a URL. This is useful for generating PDFs from templates, dynamic content, or data that doesn't have a publicly accessible URL. The HTML is rendered with full CSS and JavaScript support just like a URL-based capture.

Start generating PDFs today

Convert any URL or HTML to a polished PDF document with a single API call. 100 free API calls every month, no credit card needed.