We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Syncfusion Feedback

Syncfusion is trusted by the world’s leading companies

Syncfusion Trusted Companies

Overview

The Syncfusion .NET PDF Library provides a streamlined solution for adding digital signatures and timestamps to PDF files. It supports various methods for digitally signing PDF documents, including X509 certificates like .pfx files with private keys, hardware security modules (HSM), and Windows store certificates. Additionally, this library ensures authenticity and integrity by supporting the Online Certificate Status Protocol (OCSP), certificate revocation lists (CRL), and the Elliptic Curve Digital Signature Algorithm (ECDSA).

This feature works seamlessly across platforms, including Windows, macOS, Linux, Android, and iOS, through any .NET-based application, such as ASP.NET Core, ASP.NET MVC, Blazor, .NET MAUI, Xamarin, WinForms, WPF, and WinUI.

Digitally sign PDF using C#

The below code snippet demonstrates how to digitally sign PDF.

using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Security;
using Syncfusion.Pdf;
using Syncfusion.Drawing;

// Create a new PDF document
using (PdfDocument document = new PdfDocument())
{
    // Add a new page to the document
    PdfPageBase page = document.Pages.Add();
    // Create PDF graphics for the page
    PdfGraphics graphics = page.Graphics;
    // Load the certificate from a PFX file with a private key
    FileStream certificateStream = new FileStream("PDF.pfx", FileMode.Open, FileAccess.Read);
    PdfCertificate pdfCert = new PdfCertificate(certificateStream, "password123");
    // Create a digital signature
    PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
    // Load the image for the signature field
    FileStream imageStream = new FileStream("signature.jpg", FileMode.Open, FileAccess.Read);
    PdfBitmap signatureImage = new PdfBitmap(imageStream);
    // Set signature information
    signature.Bounds = new RectangleF(new PointF(0, 0), signatureImage.PhysicalDimension);
    signature.ContactInfo = "johndoe@owned.us";
    signature.LocationInfo = "Honolulu, Hawaii";
    signature.Reason = "I am the author of this document.";
    // Draw the signature image on the PDF
    graphics.DrawImage(
    signatureImage, 0, 0);
    // Save the document to a file stream
    using (FileStream outputFileStream = new FileStream("signed.pdf", FileMode.Create, FileAccess.Write))
    {
        document.Save(outputFileStream);
    }
}

Key functions of the PDF Digital Signature feature

Explore different key functionalities of the digital signature feature.

Custom appearance in C# PDF digital signature.

Custom appearance

Customizing the appearance of digital signatures on a PDF page is straightforward for users, allowing them to draw their signature and include signer details. The customization options encompass diverse elements like images, text, and shapes.

C# PDF digital signature LTV.

Long-term validation (LTV)

Signing a PDF with an LTV signature ensures its validity for the future, even if the root certificate is revoked. To make this work, all essential elements for signature validation must be included.

Timestamp PDFs in C# PDF.

Timestamp PDFs

You can add the date and time of signing to a certificate-based digital signature. This timestamp helps confirm when the PDF was signed, making the signature more reliable.

CAdES and different hashing algorithms in .NET PDF.

CAdES and different hashing algorithms

The default digital signatures generated by the Syncfusion .NET PDF Library follow the CMS standard and use SHA 256 hashing algorithms. Users have the option to switch to the CAdES standard and utilize various hashing algorithms for their digital signatures.

Multiple signatures in .NET PDF.

Multiple signatures

Multiple digital signatures can be added to a single PDF document by appending additional signatures to an already-signed document.

Author or certify signatures in C# PDF.

Author or certify signatures

An author signature or certified signature provides a higher level of document control than a normal signature over actions like form filling, comments, and digital signing. This is usually done by the creator of the document before it is published or sent for additional signatures.

External signatures in C# PDF.

External signatures

Sign PDF documents with an external digital signature created from various sources, such as an HSM, USB tokens, and smart cards, or other cloud services.

Validate digital signatures in C# PDF.

Validate digital signatures

Validate digital signatures to ensure the authenticity and integrity of a PDF document. Digital signatures can be validated in any number of PDF documents without human interaction.

Explore references for digital signatures

Discover valuable resources from our blog and knowledge base about digitally signing PDF documents.

Digitally Sign and Verify Signatures in PDF Files Using C

Blog

Digitally Sign and Verify Signatures in PDF Files Using C#: A Complete Guide

Create PDF Digital Signature Web Service Using Azure Key Vault in .NET PDF

Blog

Create a PDF Digital Signature Web Service Using Azure Key Vault and the Syncfusion C# PDF Library

Digitally sign PDF document with an external signature using C# and VB.NET

Knowledge base

Digitally Sign PDF Documents with an External Signature Using C# and VB.NET

How to digitally sign PDF document with CAdES using C# and VB.NET

Knowledge base

How to Sign PDF Documents Digitally with CAdES Using C# and VB.NET

How to create the PDF digital signature with custom appearance in C# and VB.NET

Knowledge base

How to Create a PDF Digital Signature with a Custom Appearance in C# and VB.NET

How to validate digitally signed PDF document using C# and VB.NET

Knowledge base

How to Validate Digitally Signed PDF Documents Using C# and VB.NET

Syncfusion .NET PDF Library Resources

Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.

Struggling to decide on the right product?

Our comprehensive competitor comparison of PDF framework will guide you to the perfect choice.

tick-mark 20+ Conversions support
tick-mark 50+ interactive demos
tick-mark 1.7M+ downloads
competitive-banner-FT-image

Frequently Asked Questions

A digital signature in a PDF is a way to ensure the integrity and authenticity of the document. It involves using cryptographic techniques to create a unique identifier for the document that can be verified by others.

The process typically involves generating a cryptographic key pair, signing the PDF document using the private key, and then embedding the signature into the PDF file. You would also need to ensure that the necessary certificate is available for signing.

To add a digital signature to a PDF using C#, you’ll need a digital certificate issued by a trusted certificate authority (CA). This certificate will contain a public-private key pair that you’ll use for signing the PDF document.

Using Syncfusion .NET PDF Library, you can easily create a digital signature for a PDF document in C#.

Yes, you can validate a digital signature in a PDF using C# by extracting the signature from the PDF file and then verifying it using the public key associated with the signer’s certificate.

Our Customers Love Us

Having an excellent set of tools and a great support team, Syncfusion reduces customers’ development time.
Here are some of their experiences.

Rated by users across the globe

Want to create, view, and edit PDF files in C# or VB.NET?

Start a free 30-day evaluation today!
DOWNLOAD FREE TRIAL

No credit card required.

Mobile Free Evaluation Section

Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.

Scroll up icon