Getting started

Your first PDF

Generate a PDF from HTML in under five minutes.

Prerequisites

An active API key. Every request carries the header Authorization: Bearer pk_....

Generate a PDF from HTML

curl -X POST https://api.pdf-forge.dev/v1/generate/html \
  -H "Authorization: Bearer $PDFFORGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<h1>Invoice #2026-001</h1><p>Amount: 250,000 FCFA</p>",
    "options": { "format": "A4" }
  }' \
  --output invoice.pdf
import { PdfForge } from "@pdfforge/core";

const client = new PdfForge({ apiKey: process.env.PDFFORGE_API_KEY });

const pdf = await client.generate.fromHtml({
  html: "<h1>Invoice #2026-001</h1><p>Amount: 250,000 FCFA</p>",
  options: { format: "A4" },
});

await pdf.save("invoice.pdf");
import { PdfForge } from "@pdfforge/core";
import { Document, Page } from "@pdfforge/react";

const invoice = (
  <Document title="Invoice #2026-001">
    <Page format="A4">
      <h1>Invoice #2026-001</h1>
      <p>Amount: 250,000 FCFA</p>
    </Page>
  </Document>
);

const pdf = await client.generate.fromJSX(invoice);

The response is the PDF itself

The API answers with the PDF binary (application/pdf), not a JSON payload with a URL. Save the response body directly.

Verify

Open invoice.pdf: a vector A4, selectable text, print-ready.

Next steps

On this page