PDF Digital Signature

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

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

Screenshot of PDF digital signature set with GemBox.Presentation
PDF digital signature set with GemBox.Presentation
Upload your file (Drag file here)
using System.IO;
using GemBox.Presentation;

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

        var presentation = PresentationDocument.Load("%InputFileName%");

        var slide = presentation.Slides[0];

        Picture signature = null;
        using (var stream = File.OpenRead("%#GemBoxSignature.png%"))
            signature = slide.Content.AddPicture(
                PictureContentType.Png, stream, 25, 15, 4, 1, LengthUnit.Centimeter);

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

        presentation.Save("PDF Digital Signature.pdf", options);
    }
}
Imports System.IO
Imports GemBox.Presentation

Module Program

    Sub Main()

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

        Dim presentation = PresentationDocument.Load("%InputFileName%")

        Dim slide = presentation.Slides(0)

        Dim signature As Picture = Nothing
        Using stream = File.OpenRead("%#GemBoxSignature.png%")
            signature = slide.Content.AddPicture(
                PictureContentType.Png, stream, 25, 15, 4, 1, LengthUnit.Centimeter)
        End Using

        Dim options = New PdfSaveOptions()

        Dim digitalSignature = options.DigitalSignature

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

        presentation.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.

Check next example or download examples from GitHub.