Insert Watermark into PDF

Purpose

This API allows you to insert a watermark to a PDF document.

HTTP Request URL

https://{zohoapis_domain}/pdfeditor/api/v1/pdf/watermark

Body Parameters

ParameterData TypeDescription
Mandatory Parameters
file

File

or

String

Upload the PDF file in which the watermark needs to be inserted 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.

image_file

File

or

String

This param is applicable only if you want to insert an image watermark.

Upload the image file using one of the following methods:

  • Upload the image directly from your local drive or desktop.
  • If the image 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 image is 10 MB.

input_options

{
"type": "text",
    "text_info":
        {
          "content": "<Text Content>"  
          "font_color" : "rgb(191,191,191)",
          "font_family" : "Arimo",
          "font_size" : 70,
          "rotation": "<Diagonal/Horizontal>"
        }
}

[OR]

{
"type": "image",
    "image_info":
        {
          "opacity": "0.5"  
          "height" : "200",
          "width" : "200"
        }

type (mandatory) - Specifies the watermark type. Possible values: text and image.


text_info - Contains text watermark settings:


- content (mandatory): Specify the text that needs to be displayed.
- rotation(mandatory): Specify in which direction the watermark needs to be inserted.
- font_color (optional): Specify the font color (rgb value). 
- font_family (optional): Specify the text font. 
- font_size (optional): Specify the font size. 

 

image_info - Contains image watermark settings:


- opacity (optional): Specify the opacity of the image.
- height (optional): Specify the image height.
- width (optional): Specify the image width.

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

input_options

ParameterData TypePossible ValuesDefault Value
contentstringMaximum upto 500 characters 
rotationstringdiagonal / horizontal 
font_colorstringrgb(191,191,191)Black
font_familystringOnly Web-safe fontsRoboto
font_sizeintegerMaximum upto 10872
opacityfloatMaximum upto 10.4
heightinteger 200
widthinteger 200

Sample Request

Copiedcurl --location --request POST "https://www.zohoapis.com/pdfeditor/api/v1/pdf/watermark" \
  --header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
  --form 'file=@"/Users/username/Documents/Sample.pdf"' \
  --form 'input_options="{\"type\":\"text\",\"text_info\":{\"content\":\"Confidential\",\"font_color\":\"rgb(191,191,191)\",\"font_family\":\"Arimo\",\"font_size\":70,\"rotation\":\"Diagonal\"}}"'  \
  --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/watermark/job/f931a01183b33",
	"status": "inprogress"
}

Success Response

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