Image watermarking helps to protect the content of a PDF document by making it much harder for someone to claim ownership. It can also be used for branding purposes. Adding an official logo or typical images as a watermark on a PDF document makes it simple for others to identify the document’s source. It provides an extra layer of protection to PDF documents, which makes it more difficult for sensitive data to be used without authenticity. To create an image watermarking software or app using C#, you can follow this C# guide to add image watermarks to PDFs.
The following points will be covered in this guide:
- C# Image Watermarking Library Installation
- Add Image Watermarks to PDFs
- Control the Alignments of Image Watermark
Installing C# Image Watermarking Library
We will use Conholdate.Total for .NET to add image watermark to PDF programmatically. You can download the DLL or install this C# image watermarking library using NuGet.
C# Tutorial: Add Image Watermarks to PDFs
You can add an image watermark to a PDF file using the steps below:
- Load a PDF document using Watermarker class.
- Create an object of ImageWatermark class.
- Apply the watermark to the PDF document using Watermarker.Add(ImageWatermark watermark) method.
- Save the output PDF using Save(string outputFileName) method.
The following code shows how to programmatically add an image watermark to a PDF file using C#.
Specify The Alignments of an Image Watermarks using C#
If you want to set the alignments of the image watermark while adding it to the PDF, then write the code as per the following steps:
- Firstly, load PDF document using Watermarker class.
- Then create an object of ImageWatermark class.
- Specify horizontal and vertical alignments.
- After that add the watermark to the PDF document using Watermarker.Add(ImageWatermark watermark) method.
- Generate the output PDF using Save(string outputFileName) method.
The following C# code shows how to apply the image watermark’s alignment setting while adding it to the PDF file.
Get a Free License
You can acquire a free temporary license to test the API without evaluation limitations.
To conclude, we have explained how to add an image watermark to PDF documents using a C# image watermarking library. Moreover, we demonstrated the procedure of adjusting the alignments of the image watermark while adding it to a PDF document. You may visit the documentation to explore several other API features.
Ask a Question
You can let us know your questions or queries on our forum.