Split Pages and Store
Purpose
This API allows you to split a PDF into multiple PDFs and store the results in Zoho WorkDrive.
Quick Reference
| Property | Value |
|---|---|
| Method | POST |
| Request URL | https://{zohoapis_domain}/pdfeditor/api/v1/pdf/pages/split/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. |
| output_settings | { "name": "<document_name>", "folder_id": "<folder_id>", "overwrite_existing_file": true | false } | Mandatory | name – Specify the base name for the output PDF documents. folder_id – Specify the ID of the WorkDrive folder in which to store the output files. overwrite_existing_file(optional) – Set to true to overwrite existing files with the same name in the folder. |
| input_options | { "split_by": [5, 10] } | Mandatory | split_by – Specify the number of pages each output PDF document should contain. For example, a value of [5, 10] creates one document of 5 pages followed by one of 10 pages. |
Notes and Limits
- The maximum file size allowed for the input PDF is 50 MB.
- This API stores the result in Zoho WorkDrive. A WorkDrive account is required.
- To use this API, 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:
Sample Request
Copiedcurl --location --request POST "https://www.zohoapis.com/pdfeditor/api/v1/pdf/pages/split/store" \
--header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
--form 'files=@"/Users/username/Documents/Sample.pdf"' \
--form 'input_settings=“{\”split_by\”:\”2\"}"' \
--form 'output_settings=“{\”name\”:\”ModifiedFile.pdf\"}"'
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{
"documents" : [
{
"name" : "file_name_1",
"document_url" : "https://{workdrive_service_url}/file/{resource_id}",
"document_id" : "{resource_id}"
},
{
"name" : "file_name_2",
"document_url" : "https://{workdrive_service_url}/file/{resource_id}",
"document_id" : "{resource_id}"
},
{
"name" : "file_name_3",
"error_code" : "R9006",
"error_message" : "Unable to upload document to WorkDrive"
}, .
.
.
{
"name" : "file_name_n",
"document_url" : "https://{workdrive_service_url}/file/{resource_id}",
"document_id" : "{resource_id}"
}
],
"status_check_url" : "https://pdf.zoho.com/pdfeditor/api/v1/pdf/pages/split/job/{jobId}",
"status": inprogress
}Success Response
Copied{
"documents" :
{
"name" : "file_name_1",
"document_url" : "https://{workdrive_service_url}/file/{resource_id}",
"document_id" : "{resource_id}"
},
{
"name" : "file_name_2",
"document_url" : "https://{workdrive_service_url}/file/{resource_id}",
"document_id" : "{resource_id}"
},
{
"name" : "file_name_3",
"document_url" : "https://{workdrive_service_url}/file/{resource_id}",
"document_id" : "{resource_id}"
},
.
.
.
{
"name" : "file_name_n",
"document_url" : "https://{workdrive_service_url}/file/{resource_id}",
"document_id" : "{resource_id}"
}
]
"status": "success"
}Partial Success Response
Copied{
"documents" :
[
{
"name" : "file_name_1",
"document_url" : "https://{workdrive_service_url}/file/{resource_id}",
"document_id" : "{resource_id}"
},
{
"name" : "file_name_2",
"document_url" : "https://{workdrive_service_url}/file/{resource_id}",
"document_id" : "{resource_id}"
},
{
"name" : "file_name_3",
"error_code" : "R9006",
"error_message" : "Unable to upload document to WorkDrive"
},
.
.
.
{
"name" : "file_name_n",
"document_url" : "https://{workdrive_service_url}/file/{resource_id}",
"document_id" : "{resource_id}"
}
]
"status_check_url" : "https://pdf.zoho.com/pdfeditor/api/v1/pdf/pages/split/job/{jobId}",
"status": "partial success"
}