Insert Images in PDF
Purpose
Using this API, you will be able to insert images to a PDF document.
HTTP Request URL
https://{zohoapis_domain}/pdfeditor/api/v1/pdf/addimages
Body Parameters
Parameter | Data Type | Description |
Mandatory Parameters | ||
file
| File or String
| PDF file in which the images needs to be inserted can be uploaded using one of the following methods:
Note: Maximum file size limit for the input PDF will be 50 MB. |
image_files
| Files or String
| Image files that needs to be inserted in the provided PDF can be uploaded using one of the following methods:
Note:
|
output_settings |
{ "name": "<new document name>" }
| Specify the name for the modified PDF document. |
input_options |
| Using this param, you can control how the images needs to be inserted in the PDF document. image_rect -> Specify the position (where the image needs to be inserted) and the dimensions of the image that needs to be inserted in the PDF. page_ranges (optional) -> Specify in which pages the images needs to be inserted. You can pass the values in following ways based on the requirement; 1,2,5 > To insert images in selected pages. 2-4,7-9 > To insert images to a specific range of pages. -5 > To insert images from first page to specified page. 7- > To insert images from specified page to last page. odd_or_even_pages(optional) -> Specify if the images needs to inserted in odd or even pages. |
Note: To use this API, an OAuth token should be generated with the following scopes: ZohoWriter.pdfEditor.ALL
input_options
Parameter | Type | Possible Values | Default Value |
image_rect | string | { 'top':'25px', 'left':'25px', 'width':'200px', 'height':'200px' } | |
page_ranges | string | 0,2-5,7- | If this key is not passed or empty, images will get inserted in all pages by default. |
odd_or_even_pages | string | odd/even | If this key is not passed or empty, images will get inserted in all pages by default. |
Sample Request
Copiedcurl --location --request POST "https://www.zohoapis.com/pdfeditor/api/v1/pdf/addimages" \
--header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
--form 'file=@"/Users/username/Documents/Sample.pdf"' \
--form ‘image_files=@"/Users/username/Documents/img.png”’ \
--form 'output_settings=“{\”name\”:\”ModifiedFile.pdf\"}"' \
--form 'input_options="{\"image_rect\":{\"top\":\"25px\",\"left\":\"25px\",\"height\":\"200px\",\"width\":\"200px\"}}"'
Sample Response
Copied{
"status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/addimages/job/f931a01183b33",
"status": inprogress
}
Success Response
Copied{
"download_url" :"https://pdf.zoho.com/pdfeditor/api/v1/pdf/addimages/download/{jobId}",
"status": "success"
}