Form
Overview
Form is a class in Aspose.Pdf FOSS for Java.
Inherits from: AutoCloseable.
A convenience facade for working with PDF interactive forms (AcroForms).
Properties
| Name | Type | Access | Description |
|---|---|---|---|
document | Document | Read | Returns the currently bound document. |
fieldNames | String[] | Read | Returns the names of all form fields in the document. |
signaturesExist | boolean | Read | Returns whether the bound document contains signature fields. |
autoRestoreForm | boolean | Read | Returns the auto-restore flag for Aspose-compatible workflows. |
Methods
| Signature | Description |
|---|---|
Form() | Creates a new facade {@code Form} instance. |
Form(inputFile: String) | Creates a new facade {@code Form} instance bound to the specified PDF file. |
Form(inputFile: String, outputFile: String) | Creates a {@code Form} bound to {@code inputFile}, remembering |
| {@code outputFile} for {@link #save()} (legacy Aspose convention). | |
Form(inputStream: InputStream) | Creates a new facade {@code Form} instance bound to the specified PDF stream. |
Form(inputStream: InputStream, outputStream: OutputStream) | Creates a {@code Form} bound to {@code inputStream}, remembering |
| {@code outputStream} for {@link #save()}. | |
Form(document: Document) | Creates a new facade {@code Form} instance bound to an existing document. |
bindPdf(inputFile: String) → boolean | Binds a PDF file to this form facade. |
bindPdf(inputStream: InputStream) → boolean | Binds a PDF from an input stream. |
bindPdf(document: Document) → boolean | Binds an existing {@link Document} to this form facade. |
getDocument() → Document | Returns the currently bound document. |
getFieldNames() → String[] | Returns the names of all form fields in the document. |
fillField(fieldName: String, value: String) → boolean | Fills a form field with the specified value. |
fillField(fieldName: String, value: boolean) → boolean | Fills a checkbox-like field using a boolean value. |
fillField(fieldName: String, value: int) → boolean | Fills a field using an integer value. |
getField(fieldName: String) → String | Returns the string value of a field. |
flattenAllFields() → boolean | Flattens all form fields, making them non-interactive. |
flattenField(fieldName: String) → boolean | Flattens a single field and removes it from the interactive form. |
getFieldFacade(fieldName: String) → Object | Returns a field facade object for the specified field. |
getFieldType(fieldName: String) → String | Returns the logical field type name in an Aspose-compatible style. |
getFieldTypeAsEnum(fieldName: String) → FieldType | Returns the {@link FieldType} enum classification for {@code fieldName}, |
| mirroring the C# {@code Form.GetFieldType} return type. | |
hasXfa() → boolean | Returns whether the bound document contains XFA data. |
isSignaturesExist() → boolean | Returns whether the bound document contains signature fields. |
setAutoRestoreForm(autoRestoreForm: boolean) | Sets the auto-restore flag for Aspose-compatible workflows. |
getAutoRestoreForm() → boolean | Returns the auto-restore flag for Aspose-compatible workflows. |
importFdf(fdfInputStream: InputStream) | Imports form field values from an FDF (Forms Data Format) input stream. |
importXml(xmlStream: InputStream) | Imports form data from an XML input stream. |
exportXml(xmlStream: OutputStream) | Exports form data to an XML output stream. |
save() → boolean | Saves to the destination remembered by the {@code (input, output)} ctor. |
save(outputFile: String) → boolean | Saves the bound document to a file. |
save(outputStream: OutputStream) → boolean | Saves the bound document to an output stream. |
close() | Closes the form facade and releases the bound document. |