Self-hosted · REST · Puppeteer-powered

Convert any web page
to a PDF with one request

PDFPi is a lightweight API that renders any public URL inside a headless Chromium browser and returns a pixel-perfect PDF — no browser plugins required.

▶ Open Playground 📄 API Reference

Everything you need

A focused set of features built for automation, browser extensions, and server-side document generation.

📄

PDF Generation

Pass any URL as a query parameter and receive a link to a high-fidelity PDF rendered by Chromium — including backgrounds, fonts, and layout.

Rich Print Options

Control paper size (A3–Legal), orientation, scale, margins, and whether to include CSS backgrounds or print headers & footers.

🛠

Easy Self-Hosting

Single Node.js process on port 7301. Run bare-metal, inside Docker, or behind an Nginx reverse proxy in minutes.


Live Demo

Enter a public URL below, choose your options, and hit Generate PDF to see the API in action.

GET /pdf/generate

API Endpoints

All routes are served on the same port (default 7301).

GET
/pdf/generate
Render a URL to PDF via headless Chromium and return the download path.
Live
GET
/downloads/:filename
Serve a previously generated PDF as a static file.
Live

Quick Start

Up and running in under five minutes.

Install dependencies
yarn install
Download Chromium (first run only)
npx puppeteer browsers install chrome
Start the dev server
yarn dev # → http://localhost:7301
Generate your first PDF
Open the URL below in your browser or run it with curl:
GET http://localhost:7301/pdf/generate?url=https://example.com&id=demo-001

Docker

# Build the image docker build -t pdfpi . # Run on port 7301 docker run -p 7301:7301 pdfpi

Query-Parameter Reference

All parameters for GET /pdf/generate.

Parameter Type Default Description
url required string Full URL of the page to convert.
id required string Unique session identifier for this request.
size optional A3 | A4 | A5 | Legal | Letter A4 Paper format.
landscape optional "true" | "false" false Landscape orientation.
scale optional number (70–150) 100 Rendering scale as a percentage.
printBackground optional "true" | "false" true Include CSS backgrounds in the output.
printHeaderFooter optional "true" | "false" false Show date/URL header and page-number footer.
margin optional number ≥ 0 0 Global margin (px) applied to all four sides.
marginTop optional number ≥ 0 margin Top margin override (px).
marginRight optional number ≥ 0 margin Right margin override (px).
marginBottom optional number ≥ 0 margin Bottom margin override (px).
marginLeft optional number ≥ 0 margin Left margin override (px).