
C# add image watermark to PDF
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
C# PDF Watermarking Library
We will use Conholdate.Total for .NET to add image watermark to PDF in C#. You can download the DLL or install this C# image watermarking library using the following NuGet installation command.
Install-Package Conholdate.Total
Add Image Watermark to PDF in C#
You can add an image watermark to a PDF file in C# using the steps below:
- First, load a PDF document using Watermarker class.
- Second, create an object of ImageWatermark class.
- Third, apply the watermark to the PDF document using Watermarker.Add(ImageWatermark watermark) method.
- Finally, save the output PDF using Save(string outputFileName) method.
The following code shows how to add an image watermark to a PDF file using C#.
Align Image Watermark in PDF using C#
If you want to set the alignments of the image watermark while adding it to the PDF using C#, then write the code as per the following steps:
- Firstly, load the PDF document using Watermarker class.
- Secondly, create an object of ImageWatermark class.
- After that, specify horizontal and vertical alignments.
- Then add the watermark to the PDF document using Watermarker.Add(ImageWatermark watermark) method.
- Finally, 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.
Conclusion
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.