Split Pages and Store

Purpose

Using this API, you will be able to split a PDF document.

HTTP Request URL

https://{zohoapis_domain}/pdfeditor/api/v1/pdf/pages/split/store

Body Parameters

ParameterData TypeDescription
Mandatory Parameters

file


 

File

or

String


 

Upload the PDF file in which the pages need to be split using one of the following methods:

  • Upload the input PDF file from your local drive or desktop.
  • If the PDF file is a publicly accessible web URL, you can pass it via the same parameter.

Note: Maximum file size limit for the input PDF is 50 MB.

output_settings

"name": "<new document name>",

"folder_id": "<folder_id>" ,    

"overwrite_existing_file": "<true/false>"

}

 

Pass the values for 'name' and 'folder_id' via this parameter as JSON.

name -> Specify the name for the modified PDF document.

folder_id -> Specify the ID of the folder in which you would like to store the modified PDF document.

overwrite_existing_file(optional)-> Use this param, if you wish to replace an existing file stored in Zoho WorkDrive with the modified PDF document.

input_options



    {
      "split_by": ["2"]
    }
   
 

Specify the number of pages each PDF document should contain.

For example:

If the input PDF document has 10 pages and you pass the 'split_by' key value as 2.

It will get split into 5 different PDF documents with 2 pages in each document.

Note:

  • This API will only be available for users who have a Zoho WorkDrive account.
  • To use this API, an OAuth token should be generated with the following scopes: ZohoWriter.pdfEditor.ALL,WorkDrive.files.ALL,WorkDrive.organization.ALL

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