How to Compress a Folder of PDFs with Claude Code
Batch-compressing PDFs is exactly the job nobody wants to own: a folder of oversized exports, a compression tool that handles one file at a time, and an afternoon of drag-drop-download-rename. Scripting it means learning some CLI's flags for a task you'll run twice a year.
With Apdf connected to Claude Code over MCP, the loop is the agent's problem. You say which files; it calls the compression tool for each, watches the jobs, and reports what it saved.
Connect Claude Code to Apdf
One command, then sign in when the OAuth window opens:
claude mcp add --transport http apdf https://apdf.io/mcp/main
The same endpoint works in Claude Desktop, Cursor, ChatGPT — anything that speaks MCP. The PDF tools need the files at publicly reachable URLs (your object storage, your web server), which is where an archive folder usually already lives.
Hand the agent the folder
Describe the batch once. The agent picks the
compress-pdf-file tool and loops it over every file:
https://files.northlight.example/archive/q3-board-pack.pdf
https://files.northlight.example/archive/merged-reports.pdf
https://files.northlight.example/archive/lease-1997-scan.pdf
Compression is heavy work, so each call returns a job id immediately; the agent
polls check-job-status while you do something better
with your time. The board pack comes back like this:
{
"id": "01KY72EBTPH8P6VNE5CQ6HM2JH",
"created": "2026-07-23T08:46:00.000000Z",
"status": "successful",
"result": {
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/9d21ae246a61d4ca86827.pdf",
"expiration": "2026-07-23T09:46:03.642774Z",
"size_original": 77952379,
"size_compressed": 4713594
}
}
Read the batch report honestly
When the jobs finish, the agent totals it up:
• q3-board-pack.pdf: 74.3 MB → 4.5 MB (−94%)
• merged-reports.pdf: 70.5 KB → 67.7 KB (−4%)
• lease-1997-scan.pdf: no savings — kept the original
The board pack was full of print-resolution images; downsampling did almost all the work. The lease scan is already-optimized JPEG, so there was nothing left to squeeze.
That spread is what real batches look like. Image-heavy exports (slides, board packs, brochures) collapse by 80–95%; lean text PDFs shave single digits; and when recompression can't beat the original, the tool keeps your original file instead of shipping a worse one.
Where to go from here
The same connection carries every PDF operation — and the engagement layer behind them.
Your code made the PDF.
Then it went dark.
Opened, read, re-read, dropped on page 4 — you never see any of it. Share the PDFs you generate through Apdf recipient links, and every signal becomes something you can act on: ping Slack, update the CRM, let an agent follow up. Same account, same API token, one more call.
API · Webhook · MCP