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 you can 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'.

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

class Program
{
    static void Main()
    {
        // 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.

Want more?

Next example GitHub

Check the next example or select an example from the menu. You can also download our examples from the GitHub.


Like it?

Download Buy

If you want to try the GemBox.Spreadsheet yourself, you can download the free version. It delivers the same performance and set of features as the professional version, but with some operations limited. To remove the limitation, you need to purchase a license.