Insert Images and Store

Purpose

This API allows you to insert images into an existing PDF and store the result in Zoho WorkDrive.

Quick Reference

PropertyValue
MethodPOST
Request URLhttps://{zohoapis_domain}/pdfeditor/api/v1/pdf/addimages/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.
image_filesFileMandatoryUpload the images to be inserted into the PDF.
output_settings{
  "name": "<document_name>",
  "folder_id": "<folder_id>",
  "overwrite_existing_file": true | false
}
Mandatoryname – Specify the name for the output PDF document.
folder_id – Specify the ID of the WorkDrive folder in which to store the output file.
overwrite_existing_file(optional) – Set to true to overwrite an existing file with the same name in the folder.
input_options[
  [
    {
      "image_rect": {"top": "25px", "left": "25px", "width": "200px", "height": "200px"},
      "page_ranges": "1,2-5,7-",
      "odd_or_even_pages": "odd"
    },
    ...
  ],
  ...
]
MandatoryControl how images are inserted into the PDF. Each outer array element corresponds to an uploaded image file in the same order.
image_rect – Specify the position and dimensions of the image to insert.
page_ranges(optional) – Specify the pages in which the image should be inserted.
odd_or_even_pages(optional) – Specify if the image should be inserted in odd or even pages only.

input_options Parameters

ParameterTypePossible ValuesDefault Value
image_rectStringSpecify the position and size of the image in the PDF. Provide values in pixels for top, left, width, and height.
page_rangesStringSpecify the pages in which the image needs to be inserted. Examples: 1,2,5 / 2-4,7-9All pages
odd_or_even_pagesStringodd, evenAll pages

Notes and Limits

  • The maximum file size allowed for the input PDF is 50 MB.
  • Up to 10 images can be inserted per request. Each image file must not exceed 10 MB. Supported formats: PNG, JPEG.
  • This API stores the result in Zoho WorkDrive. A WorkDrive account is required.
  • To use this API, 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:

Sample Request

Copiedcurl --location --request POST "https://www.zohoapis.com/pdfeditor/api/v1/pdf/addimages/store" \
  --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{
"document_id": "ponazfea04477109f4681a831e7177d96bc40",
"document_url": "http://workdrive.zoho.com/file/ponazfea04477109f4681a831e7177d96bc40",
"status": “success”
}