PDF Digital Signature

A PDF digital signature enables you to authenticate a PDF file to establish that the sender of the file is who they say they are and the content of the PDF file has not been tampered with.

The following example shows how to create a digitally signed PDF file.

To view and verify the signature in Acrobat Reader, go to the menu button 'View', then expand 'Show/Hide' and 'Navigation Panes', and click 'Signatures'.

Screenshot of PDF file digitally signed with GemBox.Spreadsheet
PDF file digitally signed with GemBox.Spreadsheet
Upload your file (Drag file here)
using GemBox.Spreadsheet;

class Program
{
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");

        var workbook = ExcelFile.Load("%InputFileName%");

        var options = new PdfSaveOptions()
        {
            DigitalSignature =
            {
                CertificatePath = "%#GemBoxExampleExplorer.pfx%",
                CertificatePassword = "GemBoxPassword"
            }
        };

        workbook.Save("PDF Digital Signature.pdf", options);
    }
}
Imports GemBox.Spreadsheet

Module Program

    Sub Main()

        ' If using Professional version, put your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY")

        Dim workbook = ExcelFile.Load("%InputFileName%")

        Dim options = New PdfSaveOptions()
        Dim digitalSignature = options.DigitalSignature

        digitalSignature.CertificatePath = "%#GemBoxExampleExplorer.pfx%"
        digitalSignature.CertificatePassword = "GemBoxPassword"

        workbook.Save("PDF Digital Signature.pdf", options)
    End Sub
End Module

Digital ID file GemBoxExampleExplorer.pfx used in the example is a self-signed digital ID created as explained on the Create a self-signed digital ID page.

To get a valid signature in your Adobe Acrobat Reader as seen in the screenshot from above, you will have to register the self-signed digital ID from the GemBoxExampleExplorer.pfx file as explained on the Register a digital ID page.

Otherwise, to get a valid signature in any Adobe Acrobat Reader, your digital ID would have to be an AATL-enabled signing credential.

The digital signature from the above example is invisible – there is no visual representation of the signature on any of the pages.

Check next example or download examples from GitHub.