Extract specific pages from a PDF by providing a page number or a range like 3 or 2-4. Ideal for splitting documents or isolating sections.
const { EXTRACT_PAGES_FROM_PDF } = require('./utils');
const pdfInput = input.file || input.url;
return EXTRACT_PAGES_FROM_PDF(pdfInput, input.pageRange);
Make sure that the response type is set to PDF.
Here you can see how to extract the first page out of 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",
"pageRange": "1"
}' --output first-page.pdf
This shows how to extract some pages out of 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==",
"pageRange": "1-2"
}' --output test-by-string.pdf