CertificationLevel Enum
Lists certification levels of a signature.
Declaration
public enum CertificationLevel extends Enum<CertificationLevel> implements IIntEnum
Members
| Name | Description |
|---|---|
FILL_FORMS
|
The signature certifies the document and allows users to fill in forms and sign the document. |
FILL_FORMS_AND_ANNOTATE
|
The signature certifies the document and allows users to fill in forms, sign the document, and create, edit, or delete annotations. |
NO_CERTIFICATION
|
The signature does not certify the document. |
NO_CHANGES_ALLOWED
|
The signature certifies the document and does not allow changes. |
fromValue(int value)
|
Returns the |
getName()
|
Returns the name of the |
getValue()
|
Returns the integer value of the |
toString()
|
Returns the string representation of the |
valueOf(String name)
|
Returns the |
values()
|
Returns an array of all |
Remarks
Call the SignatureOptions.getCertificationLevel() method to get the certification level of a signature. Call the SignatureOptions.setCertificationLevel(value) method to specify whether a signature certifies the document and which changes the signature allows.
Refer to the following help topic for additional information: Sign PDF Documents — PDF Document API for Java.
Example
Certify a PDF Document and Lock Form Fields
The following code snippet certifies a document, allows users to fill in forms and sign the document, and locks the Amount and Date form fields:
import java.io.*;
import java.nio.file.*;
import java.util.List;
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("ManagerSignature");
pdfDocument.getFields().add(signatureField);
pdfDocument.getPages().getFirst().getAnnotations().add(
new SignatureWidgetAnnotation(signatureField, new RectangleF(20, 400, 200, 60)));
// Lock the "Amount" and "Date" fields after the field is signed.
signatureField.setLock(FieldLockInfo.createInclude(List.of("Amount", "Date")));
// Certify the document.
SignatureOptions options = new SignatureOptions();
options.setCertificate(certificateStream, "CERTIFICATE_PASSWORD");
options.setCertificationLevel(CertificationLevel.FILL_FORMS);
pdfDocument.addSignature(signatureField, options);
Files.createDirectories(Path.of("output"));
try (OutputStream outputStream = Files.newOutputStream(Path.of("output", "Document.pdf"))) {
pdfDocument.save(outputStream);
}
}
}
}