FormSignatureFlags Class
Lists signature flags for a PDF interactive form.
Declaration
public final class FormSignatureFlags extends IntEnum<FormSignatureFlags>
Remarks
You can combine FormSignatureFlags values. Call the IDocumentFormFieldCollection.getSignatureFlags() method to get signature flags for a document’s interactive form. Call the IDocumentFormFieldCollection.setSignatureFlags(value) method to specify the flags.
Refer to the following help topic for additional information: Work with PDF Forms (AcroForms).
Example
Remove XFA Data and Check Signature Flags of a PDF Form
The following code snippet removes XFA form data from a document, asks PDF viewers to generate form field appearances, and checks whether the form contains signatures:
import java.io.*;
import java.nio.file.*;
import com.devexpress.docs.pdf.*;
public class Main {
public static void main(String[] args) throws Exception {
Files.createDirectories(Path.of("output"));
try (InputStream inputStream = Files.newInputStream(Path.of("Document.pdf"));
PdfDocument pdfDocument = new PdfDocument(inputStream)) {
IDocumentFormFieldCollection fields = pdfDocument.getFields();
// Remove XFA form data to keep AcroForm fields only.
if (fields.getHasXfa())
fields.removeXfa();
// Ask PDF viewers to generate appearances for form fields.
fields.setNeedAppearances(true);
// Check whether the form contains signatures.
FormSignatureFlags flags = fields.getSignatureFlags();
System.out.println("Signature flags: " + flags);
System.out.println("Contains signatures: " + flags.hasFlag(FormSignatureFlags.SIGNATURES_EXIST));
System.out.println("Save incrementally: " + flags.hasFlag(FormSignatureFlags.APPEND_ONLY));
try (OutputStream outputStream = Files.newOutputStream(Path.of("output", "Document.pdf"))) {
pdfDocument.save(outputStream);
}
}
}
}
Inherited Members
Inheritance
Fields
_APPEND_ONLY Field
The document contains signatures. Save changes as an incremental update to keep the signatures valid.
Declaration
public static final int _APPEND_ONLY
Field Value
| Type | Description |
|---|---|
| int | The document contains signatures. Save changes as an incremental update to keep the signatures valid. |
_NONE Field
The interactive form does not specify signature flags.
Declaration
public static final int _NONE
Field Value
| Type | Description |
|---|---|
| int | The interactive form does not specify signature flags. |
_SIGNATURES_EXIST Field
The document contains at least one signature field.
Declaration
public static final int _SIGNATURES_EXIST
Field Value
| Type | Description |
|---|---|
| int | The document contains at least one signature field. |
APPEND_ONLY Field
The document contains signatures. Save changes as an incremental update to keep the signatures valid.
Declaration
public static final FormSignatureFlags APPEND_ONLY
Field Value
| Type | Description |
|---|---|
FormSignatureFlags |
The document contains signatures. Save changes as an incremental update to keep the signatures valid. |
NONE Field
The interactive form does not specify signature flags.
Declaration
public static final FormSignatureFlags NONE
Field Value
| Type | Description |
|---|---|
FormSignatureFlags |
The interactive form does not specify signature flags. |
SIGNATURES_EXIST Field
The document contains at least one signature field.
Declaration
public static final FormSignatureFlags SIGNATURES_EXIST
Field Value
| Type | Description |
|---|---|
FormSignatureFlags |
The document contains at least one signature field. |
Methods
fromValue(int value) Method
Returns the FormSignatureFlags enumeration constant with the specified integer value.
Declaration
public static FormSignatureFlags fromValue(int value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | int | The integer value of the enumeration constant. |
Returns
| Type | Description |
|---|---|
FormSignatureFlags |
The enumeration constant. |
values() Method
Returns an array of all FormSignatureFlags enumeration constants.
Declaration
public static FormSignatureFlags[] values()
Returns
| Type | Description |
|---|---|
| FormSignatureFlags[] | An array of enumeration constants. |