In recent years, the importance of certified documents with digital stamps has increased significantly. These stamps consist of important information in the form of text or images to show the confidentiality or legality of an electronic document. If you are looking to add digital stamps to your PDF documents, you have landed at the right place. In this blog post, we will explain how to add an image stamp in PDF using C#.
The following points will be covered in this article:
- .NET image stamp creator library installation
- Create image stamps in PDF
- Control the display quality of PDF image stamp
Installing C# image stamp creator library
We will use Conholdate.Total for .NET to add image stamps to PDF programmatically. You can download the DLL or install this PDF stamp creator library using NuGet.
Create image stamps in PDF programmatically in C#
You can add image stamps to the desired pages of a PDF file using the steps below:
- Load PDF document using Document class.
- Create an object of ImageStamp class.
- Specify stamp position, size, and opacity.
- Add stamp object to a specific page of the PDF file using AddStamp(Stamp stamp) method.
- Save the output PDF using Save(string outputFileName) method.
The following code shows how to add image stamps in PDF programmatically using C#.
The following image shows the input and output PDFs side by side.
Specify image stamp quality using C#
If you want to control the quality of an image stamp while adding it to the PDF, then write the code as per the following steps:
- Load PDF file using Document class.
- Initialize an object of ImageStamp class.
- Specify the Quality property by setting a value from 0 to 100.
- Insert stamp in a particular page of PDF using AddStamp(Stamp stamp) method.
- Generate the output PDF using Save(string outputFileName) method.
The following C# code demonstrates how to control the quality of an image stamp 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 stamp in PDF documents using a C# image stamp creator API. Moreover, we demonstrated the procedure of adjusting the quality of the image stamp while adding it to a PDF page. You may visit the documentation to explore several other features of the API.
Ask a question
You can let us know your questions or queries on our forum.