Add Watermark in PDF with Node.js REST API

This tutorial guides how to add watermark in PDF with Node.js REST API. You will learn to automatically insert watermark in PDF with Node.js Low Code API using the Node.js-based Cloud SDK. It shares details to customize the watermark format and placement on a particular page.

Prerequisite

Steps to Add Watermark to PDF Document with Node.js RESTful Service

  1. Configure the PdfApi class object with API key and App SID
  2. Create a Stamp object and set its parameters
  3. Upload the target PDF file to the cloud storage for adding a watermark
  4. Call the PutPageAddStamp() method to insert the Stamp as a watermark
  5. Download the PDF file with a watermark on it

These steps describe how to add watermark in PDF online with Node.js REST Interface. Instantiate the PdfApi object, create a stamp object, and set its properties followed by uploading the PDF file to the Cloud. Call the PutPageAddStamp() to add the stamp text as a watermark and save the output PDF file with the watermark on the disk.

Code to Put Watermark on PDF with Node.js REST Interface

This code has demonstrated how to put watermark on PDF with Node.js-based API. You may set various parameters for a watermark stamp such as text as Value, stamp type, background flag, indentation, rotation settings, opacity, zoom level, foreground color, and margins. This SDK also supports reading and deleting watermarks and other stamps on a PDF file.

This article has taught us how to add a watermark to PDF document with Node.js RESTful Service. If you want to insert an image in a PDF file, follow the article Insert Image into PDF with Node.js REST API.

 English