Reduce the file size of your PDFs without losing quality. Perfect for faster uploads, email attachments, and saving storage.
const { PDF_COMPRESS } = require('./utils');
const pdfInput = input.url || input.file;
return PDF_COMPRESS(pdfInput);
Make sure that the response type is set to PDF.
Here you can see how to compress your PDF using a passed URL:
curl -X POST https://e.customjs.io/zeXXXy \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY_HERE" \
-d '{
"url": "https://css4.pub/2017/newsletter/drylab.pdf"
}' --output test-by-url.pdf
This shows how to compress your PDF by sending a binary Base64-encoded string. Keep in mind that the payload size is limited to 6 MB.
curl -X POST https://e.customjs.io/zeXXXy \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY_HERE" \
-d '{
"file": "JVBERi0x..........EyNzg3CiUlRU9GCg=="
}' --output test-by-string.pdf