Compress PDF
Compress PDF is an API that shrinks a PDF by recompressing the photos inside it (usually the heaviest part of a scanned or image-heavy PDF), without touching the text.
How it works
You send the PDF and a quality level, and get it back with its JPEG images recompressed to that level. The text, fonts and document structure aren't touched.
Honest note: it only recompresses images stored as JPEG inside the PDF (by far the most common case). Other, less common internal image formats are left as-is. If the PDF is already heavily compressed or has no photos, the result might not shrink much, or at all: in that case you get the original back, never something that's actually larger.
All you need
- Your API key. Create it in your dashboard with "+ Create key".
- In your automation platform, an "HTTP Request" step (n8n, Make, Zapier, Pipedream…).
How to use it in n8n
- Method:
POST· URL:https://api.cofferdock.com/pdf-compress - Send Headers:
x-api-key= your key - Send Body: binary file (in n8n: "n8n Binary File")
- In Options → Response → Response Format: choose File
Options
| Option | Default | What it does |
|---|---|---|
quality | 50 | 10 (smaller, more loss) to 90 (larger, almost lossless). |
API overview
- Endpoint:
POST https://api.cofferdock.com/pdf-compress - Auth: header
x-api-key: YOUR_KEY. - Input: raw PDF, or JSON
{ file, quality, ... }. - How it compresses: finds every embedded JPEG image (
/DCTDecode) in each page's resources and re-encodes it at the requested quality with sharp/mozjpeg. Doesn't touch other internal image formats, text, or fonts. - Limits: 20 requests/min per IP. 1 call = 1 credit.
Options
| Option | Default | Description |
|---|---|---|
quality | 50 | 10-90. Only affects internal JPEG images. |
Example
curl -X POST "https://api.cofferdock.com/pdf-compress?quality=40" \
-H "x-api-key: YOUR_KEY" -H "Content-Type: application/pdf" \
--data-binary @large.pdf \
--output compressed.pdf
Response
{ "success": true, "pdf": "JVBERi0xLjQK...", "mime_type": "application/pdf",
"meta": { "images_compressed": 3, "original_size_bytes": 2400000,
"size_bytes": 620000, "reduction_percent": 74, "used": 12, "remaining": 488 } }
What you get back
meta.reduction_percent tells you how much it actually shrank. By default: with the raw PDF it returns the PDF directly; with JSON it returns base64.