PDF Compress API: Reduce PDF File Size avatar

PDF Compress API: Reduce PDF File Size

Pricing

$5.00 / 1,000 pdf compresseds

Go to Apify Store
PDF Compress API: Reduce PDF File Size

PDF Compress API: Reduce PDF File Size

PDF compressor to reduce PDF file size from a URL or base64: lossless stream optimisation or JPEG downsampling of large images. Text and vectors are never rasterised. Charged only when the file gets smaller. $0.005 per compressed PDF.

Pricing

$5.00 / 1,000 pdf compresseds

Rating

0.0

(0)

Developer

Ferrolark

Ferrolark

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

4 days ago

Last modified

Features

Limited permissions

Share

PDF Compress API: Reduce PDF File Size (Lossless or Image Downsampling)

Make PDFs smaller with one API call, and pay only when the file actually gets smaller.

  • Lossless preset: rewrites the file with qpdf/pikepdf, recompresses streams and packs objects. Text and images are unchanged.
  • Balanced, strong and extreme presets: also downsample large photos to 2000, 1400 or 1000 px and re-encode them as JPEG.
  • Safe by design: text and vector graphics are never rasterised. Images with transparency masks and CMYK images are left untouched.
  • Honest manifest: input bytes, output bytes, % saved, images found, recompressed and skipped.
  • Not charged when a file cannot be reduced by at least 1%.

Real example

A government form (vector text) and the "Attention Is All You Need" paper with the balanced preset:

{
"pdfUrls": [
"https://www.irs.gov/pub/irs-pdf/fw9.pdf",
"https://arxiv.org/pdf/1706.03762"
],
"preset": "balanced"
}
  • Run time: 5.2 s on Apify at 1,024 MB.
  • Platform usage: $0.0007.
  • Your cost: 2 PDFs × $0.005 = $0.010.
OutputPagesInput bytesOutput bytesSaved
fw9-compressed.pdf6140,815123,07412.6%
1706.03762-compressed.pdf152,215,2441,837,42417.1%

Neither file has large photos, so both savings came from lossless stream optimisation. Scanned and photo-heavy PDFs shrink far more with the strong preset.

Price and limits

  • $0.005 per compressed PDF, only when it got at least 1% smaller.
  • Files that are already optimal are reported in OUTPUT.notCompressible and not charged; failed files are listed in OUTPUT.errors and not charged.
  • Limits: 10 PDFs and 100 MB per run.

Input

FieldDefaultWhat it does
pdfUrlsnonePublic PDF URLs.
filesnone[{"base64": "...", "name": "report.pdf", "password": "optional"}].
presetbalancedlossless, balanced, strong or extreme.
removeMetadatafalseDrop document info and XMP metadata.
passwordnoneFor encrypted PDFs. The output is not encrypted.
createShareableUrlfalseAlso return signed links that work without an Apify token.

Call it from code, n8n or an AI agent

API (synchronous):

curl -X POST "https://api.apify.com/v2/acts/ferrolark~pdf-compress/run-sync-get-dataset-items?maxTotalChargeUsd=0.1" \
-H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
-d '{"pdfUrls": ["https://example.com/scan.pdf"], "preset": "strong"}'

n8n: paste this workflow on the canvas (Ctrl+V). Add a Header Auth credential with the name Authorization and the value Bearer <your Apify token>, and use it in both HTTP nodes. The second node downloads each compressed PDF as an n8n binary.

{
"name": "Ferrolark pdf-compress",
"nodes": [
{
"parameters": {},
"name": "When clicking Test workflow",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
0,
0
]
},
{
"parameters": {
"method": "POST",
"url": "https://api.apify.com/v2/acts/ferrolark~pdf-compress/run-sync-get-dataset-items?maxTotalChargeUsd=0.05",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "{\"pdfUrls\": [\"https://www.irs.gov/pub/irs-pdf/fw9.pdf\"], \"preset\": \"balanced\"}",
"options": {
"timeout": 300000
}
},
"name": "Run Actor",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
220,
0
]
},
{
"parameters": {
"url": "={{ $json.downloadUrl }}",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"name": "Download file",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
440,
0
]
}
],
"connections": {
"When clicking Test workflow": {
"main": [
[
{
"node": "Run Actor",
"type": "main",
"index": 0
}
]
]
},
"Run Actor": {
"main": [
[
{
"node": "Download file",
"type": "main",
"index": 0
}
]
]
}
}
}

AI agents (MCP): add the Apify MCP server (https://mcp.apify.com) to Claude, Cursor or any MCP client and allow ferrolark/pdf-compress. The agent gets a typed tool with the input above.

FAQ

Will it break digital signatures?

Any rewrite invalidates a signature. Signed inputs get a warning in the row.

Does it use Ghostscript?

No. It uses pikepdf (qpdf) and Pillow, so there is no AGPL dependency and text is never rasterised.

Which preset should I use?

balanced for everyday documents, strong for email attachments with photos, lossless when images must stay untouched.

More Ferrolark tools

  • Brand Name Availability Checker: domains, GitHub, npm, PyPI and more in one report.
  • Domain Intelligence Report: WHOIS, DNS, email security, SSL and hosting for any domain.
  • Launch Asset Pack: favicons, PWA icons, OG image and head tags from one logo.
  • Live Deploy QA: meta tags, canonical, robots, OG image and favicon of your deployed routes, with diffs between deploys.
  • Sitemap Delta: new, removed and broken URLs in any sitemap since the last run.
  • RSS Delta: only new RSS, Atom and JSON Feed items, de-duplicated.
  • PDF Merge API: merge PDFs from URLs or base64 with page ranges and a SHA-256 manifest.
  • PDF Split API: split a PDF by page ranges or every N pages, or extract pages, with a ZIP and manifest.
  • Image Convert: PNG, JPG, WebP, AVIF and HEIC conversion (SVG input too) from URLs or base64.
  • Image Compress & Resize: resize images and compress them to a target size in KB, WebP or AVIF.
  • PDF to Image: PDF pages to PNG, JPG or WebP at the DPI you choose.
  • Image to PDF: JPG, PNG, HEIC and WebP images to one PDF, JPEGs embedded without recompression.
  • HTML to PDF & URL to PDF: web pages or raw HTML to PDF with headless Chrome.
  • Markdown to PDF: Markdown with tables, code and footnotes to a clean PDF.
  • DOCX to PDF: Word, Excel, PowerPoint and ODT to PDF with LibreOffice.
  • Data Convert: CSV, JSON, NDJSON and Excel XLSX in any direction.

Built by Ferrolark.