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

NameTypeAccessDescription
documentDocumentReadReturns the currently bound document.
fieldNamesString[]ReadReturns the names of all form fields in the document.
signaturesExistbooleanReadReturns whether the bound document contains signature fields.
autoRestoreFormbooleanReadReturns the auto-restore flag for Aspose-compatible workflows.

Methods

SignatureDescription
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)booleanBinds a PDF file to this form facade.
bindPdf(inputStream: InputStream)booleanBinds a PDF from an input stream.
bindPdf(document: Document)booleanBinds an existing {@link Document} to this form facade.
getDocument()DocumentReturns the currently bound document.
getFieldNames()String[]Returns the names of all form fields in the document.
fillField(fieldName: String, value: String)booleanFills a form field with the specified value.
fillField(fieldName: String, value: boolean)booleanFills a checkbox-like field using a boolean value.
fillField(fieldName: String, value: int)booleanFills a field using an integer value.
getField(fieldName: String)StringReturns the string value of a field.
flattenAllFields()booleanFlattens all form fields, making them non-interactive.
flattenField(fieldName: String)booleanFlattens a single field and removes it from the interactive form.
getFieldFacade(fieldName: String)ObjectReturns a field facade object for the specified field.
getFieldType(fieldName: String)StringReturns the logical field type name in an Aspose-compatible style.
getFieldTypeAsEnum(fieldName: String)FieldTypeReturns the {@link FieldType} enum classification for {@code fieldName},
mirroring the C# {@code Form.GetFieldType} return type.
hasXfa()booleanReturns whether the bound document contains XFA data.
isSignaturesExist()booleanReturns whether the bound document contains signature fields.
setAutoRestoreForm(autoRestoreForm: boolean)Sets the auto-restore flag for Aspose-compatible workflows.
getAutoRestoreForm()booleanReturns 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()booleanSaves to the destination remembered by the {@code (input, output)} ctor.
save(outputFile: String)booleanSaves the bound document to a file.
save(outputStream: OutputStream)booleanSaves the bound document to an output stream.
close()Closes the form facade and releases the bound document.

See Also