Replace Pages from PDF

Purpose

This API enables you to replace selected pages in a PDF file with pages from another PDF document.

HTTP Request URL

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

Body Parameters

ParameterData TypeDescription
Mandatory Parameters

original_pdf_file


 

File

or

String


 

Upload the PDF file where the pages need to be replaced using one of the following methods:

  • Upload the PDF directly 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.

Note: The maximum file size allowed for the input PDF is 50 MB. It cannot be more than 150 pages.

replacement_pdf_file


 

File

or

String


 

Upload the PDF file from which the replacement pages will be taken using either of the following methods:

  • Upload the PDF directly from your local drive or desktop.
  • If the PDF is available through a publicly accessible web URL, provide the URL using the same parameter.

Note: The maximum allowed file size for the source PDF is 50 MB. It cannot be more than 150 pages.

input_options



    {
     "original_page_ranges":["1-4"],
    "replacement_page_ranges": ["5-8"]
    }
   
 

original_page_ranges -> Specify the page range in the original PDF that needs to be replaced.

replacement_page_ranges -> Specify the page range in the replacement PDF that will be used to replace the original pages.

Note: Ensure that the pages count specified in the original and replacement page ranges is the same.

output_settings

"name": "<new document name>"

}

Specify the name for the modified 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/replace" \
  --header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
  --form 'original_pdf_file=@"/Users/username/Documents/Original.pdf"' \
  --form 'replacement_pdf_file=@"/Users/username/Documents/Replacement.pdf"' \
  --form 'input_options=“{\”original_page_ranges\”:\”1-4\",\”replacement_page_ranges\”:\”5-8\"}"' \
  --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{
	"status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/pages/replace/job/f931a01183b33",
	"status": "inprogress"
}

Success Response

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