Skip to main content

SignatureInfo Class

Contains information about a digital signature in a PDF document.

Declaration

public abstract class SignatureInfo extends JavaObject

Remarks

Call the PdfDocument.getSignatures() method to get all signatures in a document. Call the SignatureField.getSignatureInfo() method to get the signature of a specific field.

The signature type determines which SignatureInfo descendant the API returns:

Class Signature Type
ApprovalSignatureInfo An approval signature.
AuthoringSignatureInfo A certification (author) signature.
TimestampSignatureInfo A document-level timestamp.
UsageRightsSignatureInfo A usage rights signature.

To verify a signature, use the PdfSignatureValidator class.

Refer to the following help topics for additional information:

Example

Get Information About Signatures in a PDF Document

The following code snippet displays information about all signatures in a document:

import java.io.*;
import java.nio.file.*;
import com.devexpress.docs.pdf.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try (InputStream inputStream = Files.newInputStream(Path.of("Document.pdf"));
             PdfDocument pdfDocument = new PdfDocument(inputStream)) {
            for (SignatureInfo signature : pdfDocument.getSignatures()) {
                System.out.println("Field: " + signature.getField().getName());
                System.out.println("Signer: " + signature.getSignerName()
                        + ", signed at: " + signature.getSigningTime());

                switch (signature) {
                    case AuthoringSignatureInfo authoring ->
                        System.out.println("Certification signature. Allowed changes: "
                                + authoring.getPermission());
                    case ApprovalSignatureInfo approval ->
                        System.out.println("Approval signature. Lock action: "
                                + (approval.getFieldLock() != null ? approval.getFieldLock().getAction() : null));
                    case TimestampSignatureInfo timestamp ->
                        System.out.println("Document-level timestamp");
                    default -> { }
                }
            }
        }
    }
}

Inherited Members

com.devexpress.system.JavaObject.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.initFields()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
com.devexpress.system.JavaObject
SignatureInfo
See Also

Methods

getContactInfo() Method

Returns the signer’s contact information.

Declaration

public String getContactInfo()

Returns

Type Description
String

The signer’s contact information; null if the signature does not specify contact information.

Remarks

Recipients can use contact information to verify the signature with the signer.

getField() Method

Returns the signature field that contains the signature.

Declaration

public SignatureField getField()

Returns

Type Description
SignatureField

The signature field.

getReason() Method

Returns the reason for signing (for example, “I approve this document”).

Declaration

public String getReason()

Returns

Type Description
String

The reason for signing; null if the signature does not specify a reason.

getSignerName() Method

Returns the signer name.

Declaration

public String getSignerName()

Returns

Type Description
String

The signer name; null if the signature does not specify the signer name.

Remarks

The getSignerName() method returns the signer name stored in the signature. To get the signature certificate, call the PdfSignatureValidator.getPkcs7Signature(formFieldName) method and then the Pkcs7Signature.getSignatureCertificate() method.

getSigningTime() Method

Returns the signing date and time.

Declaration

public OffsetDateTime getSigningTime()

Returns

Type Description
OffsetDateTime

The signing date and time; null if the signature does not specify the signing time.

Remarks

The signer specifies the signing time. To get a trusted signing time from a Time Stamp Authority (TSA), call the Pkcs7Signature.getTimeStampDate() method.