Images (PNG, WebP)
PNG or WebP of any page, made from the PDF itself, its fields and marks included.
curl https://api.reflowpdf.com/v1/images \
-H "Authorization: Bearer $REFLOWPDF_API_KEY" \
-H "Content-Type: application/json" \
-d '{"html": "…", "pages": [1], "dpi": 150}' -o page-1.pngconst { images } = await reflow.images.create({ html, pages: '1-3', format: 'webp', dpi: 200 })
for (const image of images) await writeFile(image.filename, image.bytes) // Q3-page-1.webp, …images = client.images.create(html=html, pages="1-3", format="webp", dpi=200)
images.save("previews/") # Q3-page-1.webp, …Previews of an invoice in a customer portal, a certificate to share, the first page of a report as its cover: the images are the PDF's own pages, so they show exactly what the PDF shows.
| Field | |
|---|---|
html, data, filename, options | As for a PDF: every option applies. |
format | png (default) or webp, both lossless; WebP is usually smaller. |
pages | [1, 3] or "1-3,5"; every page when omitted. Up to 200 a request. |
dpi | 18–600, default 150 (an A4 page is 1241 × 1754 pixels: a part of a pixel at the page's edge is a pixel, as in Poppler). 72 is one pixel per point; 300 for print. |
A template's pages: POST /v1/templates/{id}/images with its data.
The response#
- A page the document does not have, among those asked for, is
422 unfulfillable: no partial response. - Images over 250 megapixels or 256 MB together are refused before they are drawn (200 A4 pages at 600 dpi would be 7,000 megapixels): ask for fewer pages or fewer dots per inch.
- One page: the image itself (
image/pngorimage/webp), named<name>-page-<n>.png. - Several: a ZIP of them (
application/zip,<name>-pages.zip) withpage-001.png,page-002.png, …; the SDKs open it for you. - With
Accept: application/json: their links, each image and the ZIP, kept 24 hours. X-Page-Count: the images delivered (and counted to your plan);X-Document-Pages: the pages of the document.
{
"id": "img_9Qm2xT8vLp4rWs1dYbZaKa",
"object": "images",
"format": "png",
"dpi": 150,
"document_pages": 3,
"images": [
{
"page": 1,
"url": "https://api.reflowpdf.com/v1/files/Hq8vR2cT9xKmL4pW/Q3-page-1.png",
"filename": "Q3-page-1.png",
"width": 1241,
"height": 1754,
"bytes": 182344
}
],
"archive": null,
"expires_at": "2026-11-03T10:22:31.000Z",
"mark": null,
"missing_variables": [],
"skipped_resources": []
}