Generate

URL to PDF

POST /v1/generate/url — capture any web page.

POST /v1/generate/url loads a public URL in managed headless Chrome and returns the rendered page as a vector PDF. Same engine, same output quality as HTML to PDF.

Request

curl -X POST https://api.pdf-forge.dev/v1/generate/url \
  -H "Authorization: Bearer $PDFFORGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/invoice/2026-001",
    "options": { "format": "A4", "printBackground": true }
  }' \
  --output page.pdf
import { PDFForge } from "@pdfforge/core";

const client = new PDFForge(process.env.PDFFORGE_API_KEY!);

const pdf = await client.url("https://example.com/invoice/2026-001", {
  format: "A4",
  printBackground: true,
});

Request body

FieldTypeDescription
urlstringRequired. The page to capture. Must be reachable from the internet.
optionsobjectSame page options as HTML to PDF: format, width/height, landscape, margins, printBackground, scale, preferCssPageSize, fit.
header / footerstringRunning header/footer HTML repeated on every page.

The response is the PDF binary with the usual headers (X-PDF-Pages, X-PDF-Size, X-Generation-Time-Ms).

Alias in the PDF toolkit

POST /v1/pdf/from-url is an alias of this endpoint — same body, same response. Use whichever fits your integration.

Tips

  • Enable printBackground for pages whose design relies on CSS backgrounds — Chrome skips them by default in print mode.
  • Pages behind authentication cannot be captured; render their HTML with HTML to PDF instead.
  • The page's own print stylesheet (@media print) applies, which sometimes explains a different look than on screen.

Next steps

On this page