Insert Link in PDF

Purpose

This API allows you to add hyperlinks to specific places within a PDF.

Quick Reference

PropertyValue
MethodPOST
Request URLhttps://{zohoapis_domain}/pdfeditor/api/v1/pdf/annotation/link/insert

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{
  "link_info": [
    {
      "type": "text",
      "query": "Zoho Corporation",
      "value": "https://www.zoho.com",
      "page_range": "1 | 1-3 | all | even"
    },
    {
      "type": "rect",
      "rect": { "top": "25px", "left": "25px", "width": "200px", "height": "200px" },
      "value": "https://writer.zoho.com",
      "page_range": "1 | 1-3 | all | even"
    }
  ]
}
MandatoryYou can add hyperlinks in two ways:

Type 1: text – To hyperlink specific text within a PDF.
  query – Specify the text to be hyperlinked.

Type 2: rect – To hyperlink the content of a specific area in a PDF.
  rect – Specify the area which needs to be hyperlinked.

value – Specify the hyperlink URL.
page_range(optional) – Specify the pages in which the hyperlink should be applied. By default, it will be applied to all pages.
passwordStringOptionalIf the input PDF is password protected, specify the password to unlock it.

Notes and Limits

  • The maximum file size allowed for the input PDF is 50 MB. It cannot be more than 150 pages.
  • Up to 25 hyperlinks are allowed per request.
  • To use this API, an OAuth token should be generated with the following scopes: ZohoWriter.pdfEditor.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/annotation/link/insert" \
  --header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
  --form 'file=@/Users/username/Documents/Original.pdf' \
  --form 'password="abc123"' \
  --form 'input_options={"link_info": [{"type": "rect", "rect": {"top": "50px", "left": "50px", "width": "100px", "height": "20px"}, "value": "https://writer.zoho.com", "page_range": "1"}]}'	

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/annotation/link/insert/job/f931a01183b33",
	"status": "inprogress"
}

Success Response

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