Foxit Quick PDF Library

Programmatically add a watermark or stamp to a PDF

Adding an image as a watermark or a stamp on a PDF requires only a few lines of code using Foxit Quick PDF Library. Here’s some C# sample code:

/* Add an image watermark or stamp to an existing PDF document */

// Load a sample file from disk. We'll place the image
// onto this file.

DPL.LoadFromFile("filename.pdf", "");

// Select page 1 to watermark

DPL.SelectPage(1);

// Load your image into memory

DPL.AddImageFromFile("myImage.png", 0);

// Get width and height of the image

int lWidth = DPL.ImageWidth();
int lHeight = DPL.ImageHeight(); 

// Draw the image onto the page using the specified width/height

DPL.DrawImage(250, 450, lWidth, lHeight);  

// Save the updated file to the output folder

DPL.SaveToFile("filename_watermarked.pdf");

This article refers to a deprecated product. If you are looking for support for Foxit PDF SDK, please click here.

Updated on May 16, 2022

Was this article helpful?
Thanks for your feedback. If you have a comment on how to improve the article, you can write it here: