2025 AI Readiness Report: Survey Insights on Enterprise AI Maturity – Now Available!
Garry Klooesterman
Senior Technical Content Creator
Published March 19, 2026
Updated March 19, 2026
6 min
Garry Klooesterman
Senior Technical Content Creator

Summary: Protecting your documents with watermarks can be a tedious task, but also a necessary one. From choosing the type to implement, to the method, and to the goal of the watermark, there’s lots to decide. This blog looks at the types of watermarks and when to use them. It also covers how to programmatically add watermarks to a PDF using one of two methods from Apryse: the server-side Stamper class for backend/batch watermarking and the client-side Overlay method.

Watermarks have been around for quite some time, dating back as early as 1282. Today, digital watermarks are used for copyright protection, ID card security, fraud and tamper protection, content management (such as declaring something confidential), and more. This blog will discuss the types of watermarks and how to programmatically add them to your documents.
It makes sense to use watermarks to protect your documents but actually implementing them requires a few decisions to be made. First, you need to decide on a type of watermark. Let’s look at two types and their purpose:
Now that we know about text and image watermarks, you’ll need to decide where the watermark will “live.” For example, do you make it a permanent part of the file, or do you overlay it in the browser so it can be dynamic? This decision relies on what your watermark needs to achieve.
Note: Regardless of the method you choose, you’ll need the Security Package add-on.
In WebViewer, the watermark is drawn on a canvas layer on top of the PDF. Sometimes you just want to show a sample watermark while the user is viewing a template and then have the final download set with a final, clean watermark. This is where setWatermark comes in.
Check out all the details you need to know to get started on the client-side method with WebViewer, including samples for:
The Apryse Stamper modifies the PDF content, making the watermark a permanent part of the document. This method can be used for batch jobs or when you’re generating a final version for a client to download.
In this blog, we’ll be using the server-side Stamper method for our example, and we’ll be using JavaScript. This code is available in other languages as well, including C#, C++, Java, and more.
First, we need to get started with the Apryse Server SDK.
Before we start, we’ll need to:
Here’s a quick video on getting started if you prefer a visual walkthrough.
Now that we have everything set up and ready to go, let’s look at adding a watermark using JavaScript.
Note:
We’re going to look at how to add both text and image watermarks. First, we’ll start with the text watermark.
Here’s our sample document.

Figure 1: Image of our sample document without any watermarks.
Let’s add a text watermark that says "apryse".
You’ll need to get a trial license key and use that to initialize PDFNet, which is the library that contains the Apryse SDK. You can do that either by calling runWithCleanup or Initialize.
Once you have done that, you’ll need to open a PDFDoc from your input file, create and set the properties for a Stamper object, then call stamper.stampText specifying the text that you want to use and the “pageSet” that the stamp should be applied to. I’ll add the watermark to all of the pages, but you could choose just odd pages, or any other selection. Finally, you’ll save the resulting document.
I won’t include all of the code here, so please see the full sample, which also includes other options that are available.
If we run that code, you’ll also need to set the color and orientation of the stamper text (which I didn't include in the sample code to keep it simple) then you get a PDF with the stamp applied across it that looks like this.

Figure 2: Image of our sample document with a text watermark.
Note: Don’t forget to add your license key and the path for your document before running the project.
Now for our image watermark example.
Using the same original sample document, let’s add an image watermark that includes both a logo and “apryse” text.
You’ll need to get a trial license key and use that to initialize PDFNet, same as in the first example.
The other elements are also the same, but this time you’ll call stamper.stampImage and specify the image that you want to use as your watermark.
Again, I won’t include all of the code here to keep it simple.
If we run the code this time, you’ll need to set the location and orientation of the stamper image which I didn't include this time as well, then you get a PDF with the image stamp applied across it that looks like this.

Figure 3: Image of our sample document with an image watermark.
Note: Don’t forget to add your license key and the paths for your document and the image for your watermark before running the project.
Is the watermark permanent?
Only if you use the Server Stamper. WebViewer watermarks are overlays, which only become permanent if you make them part of the document during a download or save operation.
Can I stamp images?
Yes. Both methods support it. The Server SDK has a specific StampImage method, while WebViewer handles it through the custom canvas function.
Does this work with encrypted PDFs?
Yes. You’ll need to provide the password to the SDK first, so it can modify the document.
What about the Security Package?
The Stamper API is part of our Security Package. If you're just testing with a trial key, you're good to go. For production, just make sure your key includes it. If it doesn’t include the Security Package, comment out your key to default to trial mode for testing.
Today, we looked at two types of watermarks and two methods of implementing them. You could even have a hybrid method where you use WebViewer to show a dynamic Viewer-Specific watermark for security during the session and then use the Server Stamper to make it a permanent "Final" stamp once the document is officially signed.
Regardless of the option you choose, Apryse SDKs have you covered, making it easy to protect your documents with minimal coding needed.
Check out our WebViewer demo and the watermarking capabilities.
You can also contact our sales team for any questions and support.
PRODUCTS
Platform Integrations
End User Applications
Popular Content
RESOURCES
// initialize PDFNet, or place the following code into a callback function and use PDFNet.runWithCleanup()
const { PDFNet } = require('@pdftron/pdfnet-node');
const doc = await PDFNet.PDFDoc.createFromFilePath(inputFile);
const stamper = await PDFNet.Stamper.create(PDFNet.Stamper.SizeType.e_font_size, 110, -1);
// set the style for the stamper – for example location, orientation, color, and opacity – see the full sample for details
const pgSet = await PDFNet.PageSet.createRange(1, await doc.getPageCount());
await stamper.stampText (doc, 'apryse', pgSet);
await doc.save(outputFile, PDFNet.SDFDoc.SaveOptions.e_linearized);// initialize PDFNet, or place the following code into a callback function and use PDFNet.runWithCleanup()
const { PDFNet } = require('@pdftron/pdfnet-node');
const doc = await PDFNet.PDFDoc.createFromFilePath(inputFile);
const stamper = await PDFNet.Stamper.create(PDFNet.Stamper.SizeType.e_absolute_size, 300, 300);
// set the style for the stamper – for example location, orientation, and opacity – see the full sample for details
const pgSet = await PDFNet.PageSet.createRange(1, await doc.getPageCount());
const img = await PDFNet.Image.createFromFile(doc, watermarkPath);
await stamper.stampImage(doc, img, pgSet);
await doc.save(outputFile, PDFNet.SDFDoc.SaveOptions.e_linearized);