Convert PDF to images
PDF to images is an API that turns every page of a PDF into a PNG image. Great for generating thumbnails or previews from n8n, Make or Zapier, with no servers to maintain.
How it works
You send a PDF and get back a JSON with one PNG image per page, in base64. Nothing is stored: it's generated on the fly.
Since the result is several images at once, the response is always JSON with one base64 PNG per page (never a single loose image, even for a 1-page PDF).
All you need
- Your API key. Create it in your dashboard with "+ Create key". It's shown only once, so copy and save it.
- In your automation platform, an "HTTP Request" step (n8n, Make, Zapier, Pipedream… all have one).
How to use it in n8n (step by step)
You send your PDF as is (as binary data) and get the images back in JSON. In the HTTP Request node:
- Method:
POST - URL:
https://api.cofferdock.com/pdf-to-images - Send Headers: on → add two:
x-api-key= your key, andContent-Type=application/pdf - Send Body: on → choose the binary file option (in n8n: "n8n Binary File", with your PDF's binary property, usually
data)
The response carries { "images": [{ "page": 1, "png": "<base64>" }, …] }. To save each page as a separate file you need one more step to decode each base64.
In Make (HTTP → Make a request module): same method and URL, the two headers, and the PDF as binary data in the body.
Options (as Query Parameters or in the JSON)
| Option | Default | What it does |
|---|---|---|
scale | 1.5 | Image quality/size. Higher = sharper and heavier. |
pages | all | Which pages to convert, e.g. 1-3,5. Omit it to convert the whole PDF. |
API overview
- Endpoint:
POST https://api.cofferdock.com/pdf-to-images - Auth: header
x-api-key: YOUR_KEY. - Input: the PDF goes in the body as
application/pdf(raw) or asapplication/jsonwith{ "file": "<base64>", ... }. - Output: ALWAYS JSON:
{ images: [{ page, png, width, height }, …] }. Image format: PNG only. - Limits: input PDF up to 20 MB (50 MB on Business/Scale) in
application/pdfmode, or ~4 MB real in JSON with base64. 30 requests/min per IP. 1 call = 1 credit, no matter how many pages the PDF has.
Options
| Option | Default | Description |
|---|---|---|
scale | 1.5 | 0.5–4. Rendering scale factor (1 = the PDF's "natural" pixel size). |
pages | all | 1-indexed range, e.g. 1-3,5. Outside the document's real page count → 400. |
file | - | JSON mode only: the PDF in base64. |
Examples
curl (raw PDF):
curl -X POST "https://api.cofferdock.com/pdf-to-images?scale=2&pages=1-2" \
-H "x-api-key: YOUR_KEY" \
-H "Content-Type: application/pdf" \
--data-binary @document.pdf
JavaScript (Node 18+, saves each page as a file):
const fs = require('fs');
const r = await fetch('https://api.cofferdock.com/pdf-to-images', {
method: 'POST',
headers: { 'x-api-key': 'YOUR_KEY', 'Content-Type': 'application/pdf' },
body: fs.readFileSync('document.pdf'),
});
const j = await r.json();
for (const img of j.images) fs.writeFileSync(`page-${img.page}.png`, Buffer.from(img.png, 'base64'));
Python:
import requests, base64
r = requests.post(
'https://api.cofferdock.com/pdf-to-images',
headers={'x-api-key': 'YOUR_KEY', 'Content-Type': 'application/pdf'},
data=open('document.pdf', 'rb').read(),
)
for img in r.json()['images']:
open(f'page-{img["page"]}.png', 'wb').write(base64.b64decode(img['png']))
Response shape
{ "success": true,
"images": [
{ "page": 1, "png": "iVBORw0KGgo…", "width": 900, "height": 1263 },
{ "page": 2, "png": "iVBORw0KGgo…", "width": 900, "height": 1263 }
],
"meta": { "source_pages": 2, "images_created": 2, "used": 12, "remaining": 488 } }
What you get back
A JSON object with one base64 PNG image per page converted.