Rotar páginas de un PDF
Rotar páginas es una API que gira las páginas de un PDF 90, 180 o 270 grados, todas o solo las que elijas. Perfecto para corregir escaneos torcidos desde n8n, Make o Zapier, sin montar servidores.
Cómo funciona
Le mandas un PDF y un ángulo de giro, y te devuelve el mismo PDF con las páginas rotadas. Por defecto gira todas las páginas 90°, pero puedes elegir el ángulo y solo algunas páginas. No guarda nada: se genera al momento.
La rotación se suma a la que ya tuviera cada página (si una página ya estaba girada 90° y le pides otros 90°, queda a 180°) — es el comportamiento intuitivo de "rótala un poco más".
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…).
Cómo usarlo en n8n (paso a paso)
Le envías tu PDF tal cual (como archivo binario) y te devuelve el PDF rotado directamente. En el nodo HTTP Request:
- Method:
POST - URL:
https://api.cofferdock.com/pdf-rotate - Send Query Parameters: actívalo y añade
angle=90(ypagessi solo quieres rotar algunas, ver la tabla). - Send Headers: actívalo y añade dos:
x-api-key= tu llave, yContent-Type=application/pdf - Send Body: actívalo → elige la opción para mandar un archivo binario (en n8n: "n8n Binary File", con la propiedad binaria de tu PDF, normalmente
data) - En Options → Response → Response Format: elige File
La salida del nodo ya es el PDF rotado como archivo: conéctalo directamente a Drive, email, Telegram…
En Make (módulo HTTP → Make a request): mismo método y URL, en Query String añade angle, en Headers las dos cabeceras, y el PDF como dato binario en el cuerpo.
En resumen: POST a …/pdf-rotate, angle (y opcionalmente pages) como Query Parameters, cabeceras x-api-key y Content-Type: application/pdf, el PDF como Body binario, Response Format en File.
Opciones (en Query Parameters)
| Opción | Por defecto | Para qué sirve |
|---|---|---|
angle | 90 | Grados de giro: 90, 180 o 270 (también vale 0, que no gira nada). |
pages | todas | Qué páginas rotar, ej. 1-3,5. Si lo omites, rota el PDF entero. |
Resumen de la API
- Endpoint:
POST https://api.cofferdock.com/pdf-rotate - Auth: cabecera
x-api-key: TU_LLAVE. - Entrada: el PDF va en el cuerpo como
application/pdf(a pelo) o comoapplication/jsoncon{ "file": "<base64>", ... }. - Salida: por defecto, con
application/pdfdevuelve el binario rotado; con JSON devuelve base64 en el campopdf. Añadeoutput=pdfpara forzar el binario, ooutput=jsonpara forzar el base64. - Rotación: es ADITIVA sobre la que ya tuviera cada página, no absoluta.
- Límites: PDF de entrada hasta 20 MB (50 MB en Business/Scale) en modo
application/pdf, o ~4 MB reales en JSON con base64. 30 peticiones/min por IP. 1 rotación = 1 crédito.
Opciones
| Opción | Por defecto | Descripción |
|---|---|---|
angle | 90 | Múltiplo de 90: 0, 90, 180 o 270. Cualquier otro valor → 400 (sin redondeo silencioso). |
pages | todas | Rango 1-indexado, ej. 1-3,5. Fuera del número real de páginas → 400. |
file | — | Solo en modo JSON: el PDF en base64. |
output | según modo | pdf (binario) o json (base64). |
Ejemplos
curl (PDF a pelo, guarda el PDF rotado):
curl -X POST "https://api.cofferdock.com/pdf-rotate?angle=90&pages=1-3" \
-H "x-api-key: TU_LLAVE" \
-H "Content-Type: application/pdf" \
--data-binary @documento.pdf \
-o rotado.pdf
JavaScript (Node 18+):
const fs = require('fs');
const r = await fetch('https://api.cofferdock.com/pdf-rotate?angle=180', {
method: 'POST',
headers: { 'x-api-key': 'TU_LLAVE', 'Content-Type': 'application/pdf' },
body: fs.readFileSync('documento.pdf'),
});
const buffer = Buffer.from(await r.arrayBuffer());
fs.writeFileSync('rotado.pdf', buffer);
Python:
import requests
r = requests.post(
'https://api.cofferdock.com/pdf-rotate',
params={'angle': 180},
headers={'x-api-key': 'TU_LLAVE', 'Content-Type': 'application/pdf'},
data=open('documento.pdf', 'rb').read(),
)
open('rotado.pdf', 'wb').write(r.content)
Modo JSON (respuesta en base64)
Con Content-Type: application/json, el PDF va en file (base64) y las opciones en el mismo objeto:
{ "file": "JVBERi0xLjQ…", "angle": 90, "pages": "1-3" }
→ { "success": true, "pdf": "JVBERi0xLjQ…", "mime_type": "application/pdf",
"meta": { "pages_rotated": 3, "angle": 90, "total_pages": 10, "used": 12, "remaining": 488 } }
Lo que recibes
El PDF rotado directamente, listo para guardar o enviar. (En modo JSON, el PDF llega en base64.)
Rotate PDF pages
Rotate pages is an API that turns the pages of a PDF 90, 180 or 270 degrees, all of them or just the ones you pick. Great for fixing sideways scans from n8n, Make or Zapier, with no servers to maintain.
How it works
You send a PDF and a rotation angle, and get back the same PDF with its pages rotated. By default it rotates every page 90°, but you can choose the angle and just some pages. Nothing is stored: it's generated on the fly.
The rotation is added to whatever a page already had (if a page was already rotated 90° and you ask for another 90°, it ends at 180°) — the intuitive "rotate it a bit more" behavior.
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 rotated PDF back directly. In the HTTP Request node:
- Method:
POST - URL:
https://api.cofferdock.com/pdf-rotate - Send Query Parameters: on, and add
angle=90(andpagesif you only want to rotate some, see the table). - 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) - Under Options → Response → Response Format: choose File
The node's output is already the rotated PDF as a file: connect it straight to Drive, email, Telegram…
In Make (HTTP → Make a request module): same method and URL, add angle to Query String, the two headers in Headers, and the PDF as binary data in the body.
In short: POST to …/pdf-rotate, angle (and optionally pages) as Query Parameters, the x-api-key and Content-Type: application/pdf headers, the PDF as binary Body, Response Format as File.
Options (as Query Parameters)
| Option | Default | What it does |
|---|---|---|
angle | 90 | Rotation in degrees: 90, 180 or 270 (0 is also valid and rotates nothing). |
pages | all | Which pages to rotate, e.g. 1-3,5. Omit it to rotate the whole PDF. |
API overview
- Endpoint:
POST https://api.cofferdock.com/pdf-rotate - Auth: header
x-api-key: YOUR_KEY. - Input: the PDF goes in the body as
application/pdf(raw) or asapplication/jsonwith{ "file": "<base64>", ... }. - Output: by default, with
application/pdfit returns the rotated binary; with JSON it returns base64 in thepdffield. Addoutput=pdfto force the binary, oroutput=jsonto force base64. - Rotation: it's ADDED to whatever each page already had, not absolute.
- 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 rotation = 1 credit.
Options
| Option | Default | Description |
|---|---|---|
angle | 90 | Multiple of 90: 0, 90, 180 or 270. Any other value → 400 (no silent rounding). |
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. |
output | per mode | pdf (binary) or json (base64). |
Examples
curl (raw PDF, saves the rotated PDF):
curl -X POST "https://api.cofferdock.com/pdf-rotate?angle=90&pages=1-3" \
-H "x-api-key: YOUR_KEY" \
-H "Content-Type: application/pdf" \
--data-binary @document.pdf \
-o rotated.pdf
JavaScript (Node 18+):
const fs = require('fs');
const r = await fetch('https://api.cofferdock.com/pdf-rotate?angle=180', {
method: 'POST',
headers: { 'x-api-key': 'YOUR_KEY', 'Content-Type': 'application/pdf' },
body: fs.readFileSync('document.pdf'),
});
const buffer = Buffer.from(await r.arrayBuffer());
fs.writeFileSync('rotated.pdf', buffer);
Python:
import requests
r = requests.post(
'https://api.cofferdock.com/pdf-rotate',
params={'angle': 180},
headers={'x-api-key': 'YOUR_KEY', 'Content-Type': 'application/pdf'},
data=open('document.pdf', 'rb').read(),
)
open('rotated.pdf', 'wb').write(r.content)
JSON mode (base64 response)
With Content-Type: application/json, the PDF goes in file (base64) and the options in the same object:
{ "file": "JVBERi0xLjQ…", "angle": 90, "pages": "1-3" }
→ { "success": true, "pdf": "JVBERi0xLjQ…", "mime_type": "application/pdf",
"meta": { "pages_rotated": 3, "angle": 90, "total_pages": 10, "used": 12, "remaining": 488 } }
What you get back
The rotated PDF itself, ready to save or send. (In JSON mode, the PDF comes in base64.)