Split Pages from PDF

Purpose

This API allows you to split a PDF into multiple documents 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/split
Request URL (Store)https://{zohoapis_domain}/pdfeditor/api/v1/pdf/pages/split/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{
  "split_by": [2]
}
MandatorySpecify the number of pages each output PDF document should contain.
output_settings{
  "name": "<document_name>"
}
Mandatory for download variantSpecify output configuration for downloadable result.
output_settings{
  "name": "<document_name>",
  "folder_id": "<folder_id>",
  "overwrite_existing_file": true | false
}
Mandatory for store variantname – 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 Parameters

ParameterData TypePossible ValuesDefault Value
split_byJSON Array[2]

output_settings (Download) Parameters

ParameterData TypePossible ValuesDefault Value
nameStringBase name for the output PDF documents

output_settings (Store) Parameters

ParameterData TypePossible ValuesDefault Value
nameStringBase name for the output PDF documents
folder_idStringID of the WorkDrive folder in which to store the output files
overwrite_existing_fileBooleantrue, falsefalse

Notes and Limits

  • The maximum file size allowed for the input PDF is 50 MB, and the PDF cannot exceed 400 pages.
  • split_by specifies how many pages each output document should contain.
  • 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/split" \
  --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.

Store Variant Sample Request

Copiedcurl --location --request POST "https://www.zohoapis.com/pdfeditor/api/v1/pdf/pages/split" \
  --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.

Download Variant Sample Response

Copied{
    "status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/pages/split/job/f931a01183b33",
    "status": inprogress
}

Download Variant Success Response

Copied{
	"download_url" :"https://pdf.zoho.com/pdfeditor/api/v1/pdf/pages/split/download/f931a01183b33",
	"status": "success"
}

Store Variant Sample Response

Copied{
	"documents": [
		{
			"filename": "split_pages_1-3.pdf",
			"document_id": "6wm7368e06f39995c4674a7694e8e7976858c",
			"document_url": "https://workdrive.zoho.com/file/6wm7368e06f39995c4674a7694e8e7976858c"
		},
		{
			"filename": "split_pages_4-6.pdf",
			"document_id": "6wm73499092f25cdd4923a36ab1ca5d886e53",
			"document_url": "https://workdrive.zoho.com/file/6wm73499092f25cdd4923a36ab1ca5d886e53"
		},
		{
			"filename": "split_pages_7-9.pdf",
			"document_id": "6wm73c2fac26df1814404a105caef702d57de",
			"document_url": "https://workdrive.zoho.com/file/6wm73c2fac26df1814404a105caef702d57de"
		},
		{
			"filename": "split_pages_10.pdf",
			"document_id": "6wm735e0570e4eb7c49939662307554ebc554",
			"document_url": "https://workdrive.zoho.com/file/6wm735e0570e4eb7c49939662307554ebc554"
		}
	],
	"status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/pages/split/job/7cd22f5d9e58f3ed313ce6b277e2d4877b6d56525cc0a3c5b67024aa73b7bbff39868b542b475ab613ed883209c3a2a3",
	"status": "inprogress"
}

Store Variant Success Response

Copied{
	"documents": [
		{
			"filename": "split_pages_1-3.pdf",
			"document_id": "6wm7368e06f39995c4674a7694e8e7976858c",
			"document_url": "https://workdrive.zoho.com/file/6wm7368e06f39995c4674a7694e8e7976858c"
		},
		{
			"filename": "split_pages_4-6.pdf",
			"document_id": "6wm73499092f25cdd4923a36ab1ca5d886e53",
			"document_url": "https://workdrive.zoho.com/file/6wm73499092f25cdd4923a36ab1ca5d886e53"
		},
		{
			"filename": "split_pages_7-9.pdf",
			"document_id": "6wm73c2fac26df1814404a105caef702d57de",
			"document_url": "https://workdrive.zoho.com/file/6wm73c2fac26df1814404a105caef702d57de"
		},
		{
			"filename": "split_pages_10.pdf",
			"document_id": "6wm735e0570e4eb7c49939662307554ebc554",
			"document_url": "https://workdrive.zoho.com/file/6wm735e0570e4eb7c49939662307554ebc554"
		}
	],
	"status": "success"
}