Skip to main content

SignatureProfile Enum

Lists signature profiles.

Declaration

public enum SignatureProfile extends Enum<SignatureProfile> implements IIntEnum

Members

Name Description
PDF

A standard PDF signature in PKCS#7 format.

P_AD_ES_BES

A PAdES (PDF Advanced Electronic Signatures) signature with the Basic Electronic Signature (BES) profile.

fromValue(int value)

Returns the SignatureProfile enumeration constant with the specified integer value.

getName()

Returns the name of the SignatureProfile enumeration constant.

getValue()

Returns the integer value of the SignatureProfile enumeration constant.

toString()

Returns the string representation of the SignatureProfile enumeration constant.

valueOf(String name)

Returns the SignatureProfile enumeration constant with the specified name.

values()

Returns an array of all SignatureProfile enumeration constants.

Remarks

Call the Pkcs7DocumentSigner.getProfile() method to get the signature profile. Call the Pkcs7DocumentSigner.setProfile(value) method to specify the profile.

Refer to the following help topic for additional information: Sign PDF Documents — PDF Document API for Java.

Example

Create a PAdES Signature

The following code snippet creates a PAdES signature:

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

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);
             InputStream certificateStream = Files.newInputStream(Path.of("certificate.pfx"))) {
            // Create a signature field and bind it to a widget on the first page.
            SignatureField signatureField = new SignatureField("Signature1");
            pdfDocument.getFields().add(signatureField);
            pdfDocument.getPages().getFirst().getAnnotations().add(
                    new SignatureWidgetAnnotation(signatureField, new RectangleF(20, 400, 200, 60)));

            // Specify the certificate and signer information.
            SignatureOptions options = new SignatureOptions();
            options.setCertificate(certificateStream, "CERTIFICATE_PASSWORD");
            options.setReason("Approved");

            // Create a PAdES signature.
            Pkcs7DocumentSigner signer = new Pkcs7DocumentSigner(options);
            signer.setProfile(SignatureProfile.P_AD_ES_BES);

            pdfDocument.addSignature(signatureField, signer);

            Files.createDirectories(Path.of("output"));
            try (OutputStream outputStream = Files.newOutputStream(Path.of("output", "Document.pdf"))) {
                pdfDocument.save(outputStream);
            }
        }
    }
}

Implements

com.devexpress.java.enums.IIntEnum

Inherited Members

java.lang.Enum.<T>valueOf(java.lang.Class<T>,java.lang.String)
java.lang.Enum.clone()
java.lang.Enum.compareTo(E)
java.lang.Enum.describeConstable()
java.lang.Enum.equals(java.lang.Object)
java.lang.Enum.finalize()
java.lang.Enum.getDeclaringClass()
java.lang.Enum.hashCode()
java.lang.Enum.name()
java.lang.Enum.ordinal()
java.lang.Enum.toString()
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
java.lang.Enum
SignatureProfile