Duplicate Pages from PDF
Purpose
This API allows you to duplicate specific pages within a PDF and either download the result or store it in Zoho WorkDrive.
Quick Reference
| Property | Value |
|---|---|
| Method | POST |
| Request URL (Download) | https://{zohoapis_domain}/pdfeditor/api/v1/pdf/pages/duplicate |
| Request URL (Store) | https://{zohoapis_domain}/pdfeditor/api/v1/pdf/pages/duplicate/store |
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_range": "1, 2-5, 10", "insert_at": -1 } ] | Mandatory | page_range – Specify the page numbers to duplicate. insert_at(optional) – Specify the position (page number) after which the duplicated pages should be inserted. Use -1 to insert at the end of the document. |
| password | String | Optional | If the input PDF is password protected, specify the password to unlock it. |
| output_settings | { "folder_id": "<folder_id>", "overwrite_existing_file": true | false } | Mandatory for store variant | folder_id – Specify the ID of the WorkDrive folder in which to store the output file. overwrite_existing_file(optional) – Set to true to overwrite an existing file with the same name in the folder. |
input_options Parameters
| Parameter | Data Type | Possible Values | Default Value |
|---|---|---|---|
| page_range | String | 1, 2-5, 10 | – |
| insert_at | Integer | Page number or -1 | after original page numbers |
output_settings (Store) Parameters
| Parameter | Data Type | Possible Values | Default Value |
|---|---|---|---|
| folder_id | String | ID of the WorkDrive folder in which to store the output file | – |
| overwrite_existing_file | Boolean | true, false | false |
Notes and Limits
- The maximum file size allowed for the input PDF is 50 MB. The input PDF cannot be more than 400 pages.
- If insert_at is not passed, duplicated pages are inserted after the original page numbers.
- If insert_at is set to -1, duplicated pages are inserted at the end of the PDF document.
- The store variant requires a Zoho WorkDrive account.
- To use the download variant, an OAuth token should be generated with the following scopes: ZohoWriter.pdfEditor.ALL
- To use the store variant, an OAuth token should be generated with the following scopes: ZohoWriter.pdfEditor.ALL, WorkDrive.files.ALL, WorkDrive.organization.ALL
Possible Errors
Refer to the following pages for the list of possible errors for this API:
- PDF9001 - Invalid page number or ranges
- PDF9005 - Common error
- PDF9009 - Uploaded PDF file is empty
- PDF9014 - Input PDF or image file is missing
- PDF9015 - Mandatory parameter missing
- PDF9016 - Insufficient credit limit
- PDF9020 - Password is missing
- PDF9021 - Invalid password
- PDF9027 - Password validation failed
Download Variant Sample Request
Copiedcurl --location --request POST "https://www.zohoapis.com/pdfeditor/api/v1/pdf/pages/duplicate" \
--header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
--form 'file=@/Users/username/Documents/Original.pdf' \
--form 'password=abc123' \
--form 'input_options=[{"page_range":"1, 2-5, 10","insert_at":"-1"}]'
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.
Store Variant Sample Request
Copiedcurl --location --request POST "https://www.zohoapis.com/pdfeditor/api/v1/pdf/pages/duplicate" \
--header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
--form 'file=@/Users/username/Documents/Original.pdf' \
--form 'password=abc123' \
--form 'input_options=[{"page_range":"1, 2-5, 10","insert_at":"-1"}]'
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.
Download Variant Sample Response
Copied{
"status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/pages/duplicate/job/f931a01183b33",
"status": "inprogress"
}
Download Variant Success Response
Copied{
"download_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/pages/duplicate/download/f931a01183b33",
"response_generated_time": 17340913091019,
"status": "success"
}
Store Variant Sample Response
Copied{
"status": "inprogress",
"status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/pages/duplicate/job/2ae74c719bdb14ed9941fe351ade742439bf75ab0fb8fdf0a68b57a7a60cbd54ab7cb7bea5d0fafb4d2560a90331aaf8",
"document_id": "hf3e60435a4c7576f4d21a16cfc292a4c64a9",
"document_url": "https://workdrive.zoho.com/file/hf3e60435a4c7576f4d21a16cfc292a4c64a9"
}