Convertir imágenes a PDF
Imagen(es) a PDF es una API que convierte una o varias fotos (PNG o JPEG) en un único PDF, una imagen por página. Perfecto para juntar escaneos o fotos de recibos desde n8n, Make o Zapier, sin montar servidores.
Cómo funciona
Le mandas una o varias imágenes (codificadas en base64, dentro de un JSON) y te devuelve un PDF con cada una como página, en el mismo orden en que las mandaste. Por defecto cada página mide exactamente lo que mide su imagen; si prefieres un tamaño estándar (A4, Carta…), la imagen se centra y se ajusta sin deformarse.
Como el resultado es un solo PDF con varias imágenes, esta herramienta solo admite el cuerpo en JSON (no hay modo "pega la imagen a pelo").
Lo único que necesitas
- Tu API key. La creas en tu panel con "+ Crear llave". Se muestra una sola vez, así que cópiala y guárdala.
- En tu plataforma de automatización, un paso de tipo "HTTP Request" / "Hacer una petición HTTP" (lo tienen n8n, Make, Zapier, Pipedream…).
- Cada imagen convertida a base64 antes de mandarla.
Las imágenes viajan dentro de un JSON, así que entre todas las que uses no pueden superar unos 4 MB combinados (las fotos pesan más que un PDF, así que este límite se nota más aquí que en otras herramientas).
Cómo usarlo en n8n (paso a paso)
En el nodo HTTP Request:
- Method:
POST - URL:
https://api.cofferdock.com/pdf-from-images - Send Headers: actívalo y añade dos:
x-api-key= tu llave, yContent-Type=application/json - Send Body: actívalo → Body Content Type: JSON →
{ "images": ["<primera imagen en base64>", "<segunda>"], "output": "binary" } - En Options → Response → Response Format: elige File (porque pediste
output: "binary")
Si la imagen te llega como archivo binario de un paso anterior, conviértela a base64 con un nodo Code y la expresión {{'{{'}}$binary.data.toString('base64'){{'}}'}}, o con el nodo Move Binary Data.
En Make (módulo HTTP → Make a request): mismo método y URL, Body type: Raw, Content type: JSON, con el mismo array images.
Opciones (dentro del JSON)
| Opción | Por defecto | Para qué sirve |
|---|---|---|
images | — | Obligatorio. Array de 1 a 20 imágenes PNG o JPEG en base64. |
page_size | auto | auto (cada página mide lo que su imagen) o un tamaño fijo: A4, A3, A5, Letter, Legal, Tabloid (la imagen se centra). |
output | json | Pon binary para recibir el PDF directamente en vez de en base64. |
Resumen de la API
- Endpoint:
POST https://api.cofferdock.com/pdf-from-images - Auth: cabecera
x-api-key: TU_LLAVE. - Entrada: SOLO
application/json—{ "images": ["<base64>", ...], "page_size"?, "output"? }, de 1 a 20 imágenes PNG o JPEG. - Salida: por defecto JSON con el PDF en base64; con
"output": "binary"devuelve el binario directamente. - Límites: el JSON completo (todas las imágenes en base64 juntas) tiene un tope de 6 MB, es decir, unos 4 MB reales combinados entre todas las imágenes. 30 peticiones/min por IP. 1 PDF = 1 crédito, sin importar cuántas imágenes uses.
Opciones
| Opción | Por defecto | Descripción |
|---|---|---|
images | — | Obligatorio. Array de 1 a 20 strings en base64 (PNG o JPEG, detectado por firma de bytes). |
page_size | auto | auto: página = tamaño exacto de la imagen en píxeles (1px = 1pt). O A4/A3/A5/Letter/Legal/Tabloid: página fija, imagen centrada sin deformar. Valor desconocido → 400. |
output | json | json (base64) o binary (PDF crudo). |
Ejemplos
curl (codifica dos imágenes y crea el PDF):
B64_1=$(base64 -w0 foto1.jpg)
B64_2=$(base64 -w0 foto2.jpg)
curl -X POST "https://api.cofferdock.com/pdf-from-images" \
-H "x-api-key: TU_LLAVE" \
-H "Content-Type: application/json" \
-d "{\"images\":[\"$B64_1\",\"$B64_2\"],\"output\":\"binary\"}" \
-o documento.pdf
JavaScript (Node 18+):
const fs = require('fs');
const images = ['foto1.jpg', 'foto2.jpg'].map((f) => fs.readFileSync(f).toString('base64'));
const r = await fetch('https://api.cofferdock.com/pdf-from-images', {
method: 'POST',
headers: { 'x-api-key': 'TU_LLAVE', 'Content-Type': 'application/json' },
body: JSON.stringify({ images, page_size: 'A4', output: 'binary' }),
});
const buffer = Buffer.from(await r.arrayBuffer());
fs.writeFileSync('documento.pdf', buffer);
Python:
import base64, requests
images = [base64.b64encode(open(f, 'rb').read()).decode() for f in ['foto1.jpg', 'foto2.jpg']]
r = requests.post(
'https://api.cofferdock.com/pdf-from-images',
headers={'x-api-key': 'TU_LLAVE', 'Content-Type': 'application/json'},
json={'images': images, 'page_size': 'A4', 'output': 'binary'},
)
open('documento.pdf', 'wb').write(r.content)
Respuesta por defecto (JSON con base64)
{ "images": ["/9j/4AAQ…", "/9j/4AAQ…"] }
→ { "success": true, "pdf": "JVBERi0xLjQ…", "mime_type": "application/pdf",
"meta": { "images_used": 2, "page_size": "auto", "used": 12, "remaining": 488 } }
Lo que recibes
Por defecto, un JSON con el PDF en base64. Con "output": "binary" recibes el PDF directamente, listo para guardar o enviar.
Convert images to PDF
Image(s) to PDF is an API that turns one or more photos (PNG or JPEG) into a single PDF, one image per page. Great for combining scans or receipt photos from n8n, Make or Zapier, with no servers to maintain.
How it works
You send one or more images (base64-encoded, inside a JSON body) and get back a PDF with each one as a page, in the same order you sent them. By default each page is exactly the size of its image; if you'd rather use a standard size (A4, Letter…), the image is centered and scaled to fit without distortion.
Since the result is one PDF with several images, this tool only accepts a JSON body (there's no "paste the raw image" mode).
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).
- Each image converted to base64 before sending it.
The images travel inside a JSON body, so all the ones you use together can't add up to more than about 4 MB combined (photos are heavier than PDFs, so this limit bites harder here than in other tools).
How to use it in n8n (step by step)
In the HTTP Request node:
- Method:
POST - URL:
https://api.cofferdock.com/pdf-from-images - Send Headers: on → add two:
x-api-key= your key, andContent-Type=application/json - Send Body: on → Body Content Type: JSON →
{ "images": ["<first image base64>", "<second>"], "output": "binary" } - Under Options → Response → Response Format: choose File (since you asked for
output: "binary")
If the image arrives as binary data from an earlier step, convert it to base64 with a Code node using {{'{{'}}$binary.data.toString('base64'){{'}}'}}, or with the Move Binary Data node.
In Make (HTTP → Make a request module): same method and URL, Body type: Raw, Content type: JSON, with the same images array.
Options (inside the JSON)
| Option | Default | What it does |
|---|---|---|
images | — | Required. Array of 1 to 20 PNG or JPEG images in base64. |
page_size | auto | auto (each page matches its image) or a fixed size: A4, A3, A5, Letter, Legal, Tabloid (the image is centered). |
output | json | Set to binary to receive the PDF directly instead of base64. |
API overview
- Endpoint:
POST https://api.cofferdock.com/pdf-from-images - Auth: header
x-api-key: YOUR_KEY. - Input:
application/jsonONLY —{ "images": ["<base64>", ...], "page_size"?, "output"? }, 1 to 20 PNG or JPEG images. - Output: JSON with the base64 PDF by default; with
"output": "binary"it returns the binary directly. - Limits: the full JSON body (all base64 images together) is capped at 6 MB, meaning about 4 MB of real combined images. 30 requests/min per IP. 1 PDF = 1 credit, no matter how many images you use.
Options
| Option | Default | Description |
|---|---|---|
images | — | Required. Array of 1 to 20 base64 strings (PNG or JPEG, detected by byte signature). |
page_size | auto | auto: page = the image's exact pixel size (1px = 1pt). Or A4/A3/A5/Letter/Legal/Tabloid: fixed page, image centered without distortion. Unknown value → 400. |
output | json | json (base64) or binary (raw PDF). |
Examples
curl (base64-encode two images and build the PDF):
B64_1=$(base64 -w0 photo1.jpg)
B64_2=$(base64 -w0 photo2.jpg)
curl -X POST "https://api.cofferdock.com/pdf-from-images" \
-H "x-api-key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d "{\"images\":[\"$B64_1\",\"$B64_2\"],\"output\":\"binary\"}" \
-o document.pdf
JavaScript (Node 18+):
const fs = require('fs');
const images = ['photo1.jpg', 'photo2.jpg'].map((f) => fs.readFileSync(f).toString('base64'));
const r = await fetch('https://api.cofferdock.com/pdf-from-images', {
method: 'POST',
headers: { 'x-api-key': 'YOUR_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ images, page_size: 'A4', output: 'binary' }),
});
const buffer = Buffer.from(await r.arrayBuffer());
fs.writeFileSync('document.pdf', buffer);
Python:
import base64, requests
images = [base64.b64encode(open(f, 'rb').read()).decode() for f in ['photo1.jpg', 'photo2.jpg']]
r = requests.post(
'https://api.cofferdock.com/pdf-from-images',
headers={'x-api-key': 'YOUR_KEY', 'Content-Type': 'application/json'},
json={'images': images, 'page_size': 'A4', 'output': 'binary'},
)
open('document.pdf', 'wb').write(r.content)
Default response (JSON with base64)
{ "images": ["/9j/4AAQ…", "/9j/4AAQ…"] }
→ { "success": true, "pdf": "JVBERi0xLjQ…", "mime_type": "application/pdf",
"meta": { "images_used": 2, "page_size": "auto", "used": 12, "remaining": 488 } }
What you get back
By default, a JSON object with the PDF in base64. With "output": "binary" you get the PDF itself, ready to save or send.