How to add an image stamp in PDF using C#

How to add an image stamp in PDF using C#

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:

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.

Install-Package Conholdate.Total 

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:

  1. Load PDF document using Document class.
  2. Create an object of ImageStamp class.
  3. Specify stamp position, size, and opacity.
  4. Add stamp object to a specific page of the PDF file using AddStamp(Stamp stamp) method.
  5. 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.

Adding an image stamp in PDF using C#

Adding an image stamp in PDF using C#

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:

  1. Load PDF file using Document class.
  2. Initialize an object of ImageStamp class.
  3. Specify the Quality property by setting a value from 0 to 100.
  4. Insert stamp in a particular page of PDF using AddStamp(Stamp stamp) method.
  5. 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.

Conclusion

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.

See also