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

PropertyValue
MethodPOST
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

ParameterValueMandatory/OptionalDescription
fileFile or StringMandatoryUpload 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
  }
]
Mandatorypage_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.
passwordStringOptionalIf 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 variantfolder_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

ParameterData TypePossible ValuesDefault Value
page_rangeString1, 2-5, 10
insert_atIntegerPage number or -1after original page numbers

output_settings (Store) Parameters

ParameterData TypePossible ValuesDefault Value
folder_idStringID of the WorkDrive folder in which to store the output file
overwrite_existing_fileBooleantrue, falsefalse

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:

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"
}

Store Variant Success Response

Copied{
	"status": "success",
	"document_id": "hf3e60435a4c7576f4d21a16cfc292a4c64a9",
	"document_url": "https://workdrive.zoho.com/file/hf3e60435a4c7576f4d21a16cfc292a4c64a9",
	"response_generated_time": 1780912529135
}