VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.Pdf.Tree Namespace / PdfPage Class / AddInvisibleDigitalSignature Methods / AddInvisibleDigitalSignature(X509Certificate2,String,String,String,Boolean) Method
Syntax Example Requirements SeeAlso
In This Topic
    AddInvisibleDigitalSignature(X509Certificate2,String,String,String,Boolean) Method (PdfPage)
    In This Topic
    Adds invisible digital signature to the specified PDF page.
    Syntax
    'Declaration
    
    Public Overloads Sub AddInvisibleDigitalSignature( _
    ByVal certificate
    The X509 certificate.
    As System.Security.Cryptography.X509Certificates.X509Certificate2, _
    ByVal timestampServerUrl
    Timestamp server URL.
    As System.String, _
    ByVal signatureName
    The signature name.
    As System.String, _
    ByVal signatureReason
    The signature reason.
    As System.String, _
    ByVal addSignCertificateChain
    A value indicating whether the certificate chain must be added to the signature.
    As Boolean _
    )

    Parameters

    certificate
    The X509 certificate.
    timestampServerUrl
    Timestamp server URL.
    signatureName
    The signature name.
    signatureReason
    The signature reason.
    addSignCertificateChain
    A value indicating whether the certificate chain must be added to the signature.
    Example

    Here is an example that shows how to sign a PDF document using invisible digital signature with timestamp:

    
    Imports System.Security.Cryptography.X509Certificates
    Imports Vintasoft.Imaging.Pdf
    Imports Vintasoft.Imaging.Pdf.Tree
    
    ''' <summary>
    ''' Adds invisible digital signature with timestamp to a PDF page.
    ''' </summary>
    Public Class PdfPage_AddInvisibleDigitalSignatureWithTimestampExample
        Public Shared Sub Run()
            ' get the X509 certificate from .pfx-file
            Using certificate As New X509Certificate2("TestCertificate.pfx", "test")
                ' open PDF document
                Using pdfDocument As New PdfDocument("TestDocumentToSign.pdf")
                    ' get the first PDF page
                    Dim pdfPage As PdfPage = pdfDocument.Pages(0)
    
                    ' add an invisible digital signature with timestamp to the PDF page
                    pdfPage.AddInvisibleDigitalSignature(certificate, "http://timestamp.comodoca.com/", "Signature", "Approve document", False)
    
                    ' sign PDF document and save PDF document to the output file
                    pdfDocument.SaveChanges("TestDocumentToSign-signed.pdf")
                End Using
            End Using
        End Sub
    End Class
    
    
    
    using System.Security.Cryptography.X509Certificates;
    using Vintasoft.Imaging.Pdf;
    using Vintasoft.Imaging.Pdf.Tree;
    
    /// <summary>
    /// Adds invisible digital signature with timestamp to a PDF page.
    /// </summary>
    public class PdfPage_AddInvisibleDigitalSignatureWithTimestampExample
    {
        public static void Run()
        {
            // get the X509 certificate from .pfx-file
            using (X509Certificate2 certificate = new X509Certificate2("TestCertificate.pfx", "test"))
            // open PDF document
            using (PdfDocument pdfDocument = new PdfDocument("TestDocumentToSign.pdf"))
            {
                // get the first PDF page
                PdfPage pdfPage = pdfDocument.Pages[0];
    
                // add an invisible digital signature with timestamp to the PDF page
                pdfPage.AddInvisibleDigitalSignature(
                    certificate, "http://timestamp.comodoca.com/", "Signature", "Approve document", false);
    
                // sign PDF document and save PDF document to the output file
                pdfDocument.SaveChanges("TestDocumentToSign-signed.pdf");
            }
        }    
    }
    
    

    Requirements

    Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also