C# code tutorial

PDF Digital Signature PDF Creating & Inserting PDF to Image PDF Extracting PDF Processing & Editing PDF Protecting PDF Chart PDF Barcode

Popular .NET SDK


Guess you may have this question. How can I quickly sign a PDF file with my own handwriting signature? Do not considering printing the PDF document, signing it with captured image of your signature, and then scanning the PDF document back. It definitely waste your time to do these steps. Once you have created an image of your signature, why not add it to PDF file directly. It is just as simple as adding an image to PDF. Then, how?

Considering develop a windows or web application using C# programming language, you may need to integrate a .NET assembly or library into your VS project. And this .NET PDF signature library should have mature APIs to easily and accurately sign PDF document using image signature in various formats, such as raster image formats PNG, JPG, BMP, TIFF, and GIF. And the added image signature should be natural, matching the background perfectly.

XsPDF .NET PDF signer library is such a mature solution for above requirements. It can be used for C# programming projects independently, no need for other .NET assemblies or tools. It is simple to integrate and use. Users can quickly add images of their signatures to PDF just like doing copy-paste manipulation on the document.

Add an Image of a Signature to PDF in C#

The following C# example walks you through adding an image of a signature to a PDF document. The added image signature looks natural and does not interfere with any information behind it. You may directly use the sample code below in your C# project tests if you have PDF documents that need to be signed.


//Load the pfx certificate file with password
PdfCertificate cert = new PdfCertificate("demo.pfx", "your-password");
PdfSigner signer = new PdfSigner("demo.pdf", cert);
//Input the image file showing as signature
signer.SignatureImagePath = "demo.jpg";
signer.FieldName = "XsPDF Sign";
signer.PageId = 0;
signer.Rect = new Rectangle(100, 100, 100, 50);
signer.SignatureAlgorithm = SignatureAlgorithm.SHA256;
//Set signature appearance to image style
signer.SignatureShowingType = SignatureShowingType.Image;

signer.Sign("image-sign.pdf");

Notice - If you use the free trial version of .NET PDF Digital Signature SDK, the sign field is showing "XsPDF Signer Trial Version".