D
Druckling
Docs

PNG output

Render one page of a document as a PNG image for previews, thumbnails and images in emails or messages.

Besides PDFs, Druckling can render one page of a document as a PNG image. Use it where a PDF is awkward: a preview in your app, a thumbnail in a list, a ticket or certificate shown inline in an email or a chat message.

A PNG render takes the same template, data and language as a PDF render. You add format: "png" and, optionally, which page to render and at what resolution.

Render a page as PNG

Send format: "png" to POST /v1/documents. The image object picks the page and the scale:

curl https://druckling-nine.vercel.app/v1/documents \
  -H "Authorization: Bearer $DRUCKLING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "template": "invoice-standard",
    "format": "png",
    "image": { "page": 1, "scale": 1 },
    "filename": "INV-2041-preview",
    "data": {
      "invoice": { "number": "INV-2041", "due_date": "2026-11-22" },
      "customer": { "name": "Northwind Ltd.", "address": "12 Pier St, Leeds" },
      "line_items": [
        { "description": "Design system audit", "qty": 12, "rate": 180, "amount": 2160 }
      ],
      "totals": { "subtotal": 2160, "tax": 172.8, "amount": 2332.8 }
    }
  }'

The SDKs render page 1 at the default scale

The SDKs send format, but not the image options yet. Their PNGs are page 1 at scale 2. For another page or scale, call the REST API directly, as in the cURL example.

Options

Prop

Type

image is only allowed together with format: "png". The other parameters (template, version, data, filename, async, language) work exactly as for PDFs.

Pixel size

A point is 1/72 inch, so the resolution is 72 × scale dpi, and the image is the page size in points × scale, rounded to whole pixels:

Pagescale: 0.5scale: 1scale: 2 (default)scale: 4
A4 portrait298 × 421595 × 8421191 × 16842381 × 3368
A4 landscape421 × 298842 × 5951684 × 11913368 × 2381
A5 portrait210 × 298420 × 595839 × 11911678 × 2381
A6 landscape210 × 149420 × 298839 × 5951678 × 1191
Letter portrait306 × 396612 × 7921224 × 15842448 × 3168

The image always has the page's proportions, and page sizes are paper and label formats. For a fixed image format such as a 1200 × 630 social card, crop or resize the PNG yourself.

The page is drawn on a white background: transparent areas come out white, as in a PDF viewer.

The response

A PNG render returns a document like a PDF render does, with a few differences:

{
  "id": "pdf_8Qw2kLm3nP0aB1cD",
  "object": "document",
  "status": "rendered",
  "template": "invoice-standard",
  "version": 1,
  "filename": "INV-2041-preview.png",
  "format": "png",
  "content_type": "image/png",
  "image": { "page": 1, "scale": 1, "width": 595, "height": 842 },
  "pages": 1,
  "size_bytes": 61204,
  "url": "https://…",
  "expires_at": "2026-11-21T10:02:11.000Z",
  "error": null,
  "einvoice": null,
  "batch": null,
  "language": "en",
  "test_mode": true,
  "created_at": "2026-10-22T10:02:10.000Z"
}
  • format is png and content_type is image/png.
  • image repeats the page and scale and adds the width and height in pixels once the image is rendered. For an async: true request they're null until the document is rendered.
  • pages is always 1: the file holds one page, however long the document is.
  • The file name ends in .png. If you pass a filename ending in .pdf, the extension is replaced.

Download the image from url like any other document. The signed URL works without an API key, so a browser can also load it directly until it expires; see Documents for how long URLs and files last. For images in emails, download the PNG and attach or host it yourself, so it keeps working after the URL expires.

Which templates render PNG

Any template without e-invoicing can render PNG. E-invoice templates can't:

  • Factur-X and ZUGFeRD templates render pdf only, because the invoice XML has to be embedded in a PDF/A-3.
  • XRechnung and Peppol BIS templates render xml only.

Asking them for a PNG answers 422 validation_failed on format. See E-invoicing.

A template's PDF standard (PDF/A or PDF/UA) doesn't apply to images: the PNG is rendered from the same layout without a conformance claim, and the document's timeline in the dashboard notes it. See Accessible PDFs.

To render page 3, Druckling typesets the whole document and then draws that page, so a PNG takes about as long as the PDF and the same page limit applies.

Errors

ProblemResponse
image without format: "png"422 validation_failed, field: "image": `image` options only apply to format "png"
image.page past the end of the document422 validation_failed, field: "image.page": Page 3 does not exist: the document has 1 page. data.pages holds the page count
image.page below 1 or not a whole number, image.scale outside 0.5 to 4400 BAD_REQUEST, Input validation failed, with the offending path in data.issues
An e-invoice template422 validation_failed, field: "format"

The page count is only known after typesetting, so image.page past the end is reported by the render. With async: true the request is accepted, and the document ends failed with that error (and a document.failed webhook if you subscribed). If you don't know how long a document will be, render page 1, or render the PDF first and read its pages.

Usage and batches

  • In live mode, each rendered PNG counts as one document toward your plan's quota, like a PDF. Failed renders don't count, and test-mode renders never do.
  • Batches render PDFs (or XML for XRechnung and Peppol templates), not PNGs. To make images of many records, send one request per record, with async: true and webhooks for large volumes.
  • Share links work for PNG documents too.

Use cases

  • Thumbnails. Show scale: 0.5 previews of generated invoices or contracts in your app's lists.
  • Previews before sending. Let a user check page 1 as an image before you send the PDF.
  • Images in emails and messages. Many email clients and chat apps show images inline but PDFs only as attachments. Render a ticket or a certificate as PNG at scale: 2 for sharp text on high-density screens.
  • Every language. Pass language to preview each translation of a template.

On this page