Extract Pages from PDF
Purpose
This API allows you to extract specific pages from a PDF.
Quick Reference
| Property | Value |
|---|---|
| Method | POST |
| Request URL | https://{zohoapis_domain}/pdfeditor/api/v1/pdf/pages/extract |
Body Parameters
| Parameter | Value | Mandatory/Optional | Description |
|---|---|---|---|
| file | File or String | Mandatory | Upload the PDF file from your local drive or desktop. If the PDF is available via a publicly accessible web URL, you can provide the URL using the same parameter. |
| input_options | { "page_ranges": ["1,2,5", "2-4,7-9"], "format": "pdf" | "jpeg" | "png" } | Mandatory | page_ranges – Specify the pages to extract. Supported formats: 1,2,5 (selected pages), 2-4,7-9 (range), -5 (first page to page 5), 7- (page 7 to end). format – Specify the output format for extracted pages. |
| output_settings | { "name": "<document_name>", "single_pdf": true | false } | Mandatory | name – Specify the name for the output file. single_pdf(optional) – Set to true to combine all extracted pages into a single PDF. Set to false to save each page as a separate file. Defaults to true. |
Notes and Limits
- The maximum file size allowed for the input PDF is 50 MB.
- To use this API, an OAuth token should be generated with the following scopes: ZohoWriter.pdfEditor.ALL
Possible Errors
Refer to the following pages for the list of possible errors for this API:
Sample Request
Copiedcurl --location --request POST "https://www.zohoapis.com/pdfeditor/api/v1/pdf/pages/extract" \
--header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
--form 'files=@"/Users/username/Documents/Sample.pdf"' \
--form 'input_options=“{\”page_ranges\”:\”1,2\"}"' \
--form 'output_settings=“{\”name\”:\”ModifiedFile.pdf\",\”single_pdf\”:\”true\"}"'
Once the process begins, you will initially receive the 'status_url.' By invoking the 'status_url,' you will be able to monitor the status of the scheduled job.
Sample Response
Copied{
"status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/pages/extract/job/f931a01183b33",
"status": inprogress
}
Success Response
Copied{
"download_url" :"https://pdf.zoho.com/pdfeditor/api/v1/pdf/pages/extract/download/{JobId}",
"status": "success"
}