Extract Pages from PDF

Purpose

Using this API, you will be able to extract specific pages from a PDF document.

HTTP Request URL

https://{zohoapis_domain}/pdfeditor/api/v1/pdf/pages/extract

Body Parameters

ParameterData TypeDescription
Mandatory Parameters

file


 

File

or

String


 

Upload the PDF file in which the pages needs to be extracted 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 same parameter.

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

input_options



    {
      "page_ranges": "0,2-5,7-",
      "format": "<pdf/jpeg/png>",
    }
   
 

page_ranges -> Specify the pages that needs to extracted from the uploaded PDF.

You can pass the values using the following methods based on your needs:

1,2,5 > To extract selected pages.

2-4,7-9 > To extract a specific range of pages.

-5 > To extract from the first page to a specified page.

7- > To extract from a specified page to the last page.

format -> Specify the format in which the extracted pages need to be downloaded.


 

output_settings

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

"single_pdf": "<true/false>",    

}

 

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

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

single_pdf (optional) -> Specify the type in which you would like to combine the extracted pages. If this key is not passed, the extracted pages will be combined as a single PDF by default.

false - If you would like to have each page as a separate PDF document.

true- If you would like to combine all the extracted pages as a single PDF document.

Note: To use this API, an OAuth token should be generated with the following scopes; ZohoWriter.pdfEditor.ALL

Sample Request

Copiedcurl --location --request POST "https://www.zohoapis.com/pdfeditor/api/v1/pdf/pages/extract" \
  --header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
  --form 'files=@"/Users/username/Documents/Sample.pdf"' \
  --form 'input_settings=“{\”page_ranges\”:\”1,2\"}"' \
  --form 'output_settings=“{\”name\”:\”ModifiedFile.pdf\",\”single_pdf\”:\”true\"}"' 

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{
    "status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/pages/extract/job/f931a01183b33",
    "status": inprogress
}

Success Response

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