FormEditor

Overview

FormEditor is a class in Aspose.PDF FOSS for .NET. Inherits from: IDisposable.

Facade for form operations: fill fields, flatten forms, import/export data.

This class provides 64 methods for working with FormEditor objects in .NET programs. Available methods include: AddCheckBox, AddField, AddFieldScript, AddListItem, AddSubmitBtn, AddTextField, BindPdf, CheckField, Close, CopyInnerField, CopyOuterField, DecorateField, and 34 additional methods. All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package. Properties: ConvertTo, DestFileName, DestStream, ExportItems, Facade, Items, and 6 more.

Properties

NameTypeAccessDescription
SrcFileNamestring?Read/WriteSource file path used by the parameterless ctor + Save flow.
SrcStreamStream?Read/WriteSource stream used by the parameterless ctor + Save flow.
DestFileNamestring?Read/WriteDestination file path written by the parameterless Save().
DestStreamStream?Read/WriteDestination stream written by the parameterless Save().
ConvertToPdfFormatRead/WriteTarget PDF/A or PDF version for the saved output.
FacadeFormFieldFacadeRead/WriteVisual appearance applied by AddField and DecorateField().
Itemsstring[]?Read/WriteDefault list of items used by AddField when creating ListBox / ComboBox fields.
ExportItemsstring[][]?Read/WriteExport-value pairs paired with Items.
RadioButtonItemSizedoubleRead/WriteRadio-button item edge length (in points) used when laying out a radio group.
RadioGapfloatRead/WriteGap (in points) between radio-button items in a group.
RadioHorizboolRead/WriteWhen true, radio-button items are laid out horizontally; otherwise vertically.
SubmitFlagSubmitFormFlagRead/WriteSubmit format used by AddSubmitBtn and SetSubmitFlag.

Methods

SignatureDescription
FormEditor()Default constructor for stateless byte[]-based API.
FormEditor(document: Document)Bind the editor to a document for in-place operations.
FormEditor(document: Document, destStream: Stream)Bind a document and pre-configure an output stream for the parameterless Save.
FormEditor(document: Document, destFileName: string)Bind a document and pre-configure an output file path for the parameterless Save.
FormEditor(srcStream: Stream, destStream: Stream)Open from an input stream, writing to an output stream on Save.
FormEditor(srcFileName: string, destFileName: string)Open from an input file, writing to an output file on Save.
BindPdf(path: string)Bind a PDF file by path for editing.
BindPdf(pdfData: byte[])Bind a PDF from a byte buffer.
BindPdf(stream: Stream)Bind a PDF from a stream.
BindPdf(document: Document)Bind a PDF from an already-open Document.
Save(path: string)Save the bound document to a file path.
Save(destStream: Stream)Save the bound document to a stream.
Save()Save the bound document to the configured destination (DestFileName or DestStream).
Close()Close and release the bound document.
Dispose()Calls Dispose on this FormEditor instance.
SetField(fieldName: string, value: string)Set a field value by name.
CheckField(fieldName: string)Check a checkbox field by name.
UncheckField(fieldName: string)Uncheck a checkbox field by name.
AddTextField(fieldName: string, pageNumber: int, llx: double, lly: double, urx: double, ury: double)Add a text field to the bound document.
AddCheckBox(fieldName: string, pageNumber: int, llx: double, lly: double, urx: double, ury: double, isChecked: bool)Add a checkbox field to the bound document.
AddField(fieldType: FieldType, fieldName: string, pageNum: int, llx: float, lly: float, urx: float, ury: float)Add a field of the given fieldType at the requested rectangle on pageNum.
AddField(fieldType: FieldType, fieldName: string, initValue: string?, pageNum: int, llx: float, lly: float, urx: float, ury: float)Add a field with an initial value (text fields and combo boxes).
AddListItem(fieldName: string, itemName: string)Add a single item to a ListBox / ComboBox field.
AddListItem(fieldName: string, exportName: string[])Add a single item with an export-value pair (display, export).
DelListItem(fieldName: string, itemName: string)Remove a single item from a ListBox / ComboBox field.
AddSubmitBtn(fieldName: string, page: int, label: string, url: string, llx: float, lly: float, urx: float, ury: float)Add a Submit button.
AddFieldScript(fieldName: string, script: string)Attach a JavaScript action script to a field.
SetFieldScript(fieldName: string, script: string)Replace the field’s JavaScript action script.
CopyInnerField(fieldName: string, newFieldName: string, pageNum: int)Copy a field within the bound document to another page.
CopyInnerField(fieldName: string, newFieldName: string, pageNum: int, abscissa: float, ordinate: float)Copy a field within the bound document to another page at the given coordinates.
CopyOuterField(srcFileName: string, fieldName: string)Copy a field from another PDF file into the bound document at the same position.
CopyOuterField(srcFileName: string, fieldName: string, pageNum: int)Copy a field from another PDF file into the bound document at a specified page.
CopyOuterField(srcFileName: string, fieldName: string, pageNum: int, abscissa: float, ordinate: float)Copy a field from another PDF file at explicit coordinates.
DecorateField()Apply Facade to every field in the document.
DecorateField(fieldType: FieldType)Apply Facade to every field of the given type.
DecorateField(fieldName: string)Apply Facade to a single named field.
ResetFacade()Reset every property on Facade.
ResetInnerFacade()Alias for ResetFacade covering nested-facade callers.
MoveField(fieldName: string, llx: float, lly: float, urx: float, ury: float)Move a field’s bounding box.
RenameField(fieldName: string, newFieldName: string)Rename a form field.
RemoveField(fieldName: string)Remove a field by name.
RemoveFieldAction(fieldName: string)Remove the action attached to a field.
SetFieldAlignment(fieldName: string, alignment: int)Set the horizontal alignment of a field’s value.
SetFieldAlignmentV(fieldName: string, alignment: int)Set the vertical alignment of a field’s value.
SetFieldAppearance(fieldName: string, flags: AnnotationFlags)Set the visibility / read-only / required flags on a field.
GetFieldAppearance(fieldName: string)Return the visibility / read-only / required flags on a field.
SetFieldAttribute(fieldName: string, flag: PropertyFlag)Set ReadOnly / Required / NoExport.
SetFieldCombNumber(fieldName: string, combNumber: int)Set the comb-cell count for a text field (PDF 1.5+).
SetFieldLimit(fieldName: string, fieldLimit: int)Set the maximum character count of a text field by name.
SetSubmitFlag(fieldName: string, submitFormFlag: SubmitFormFlag)Set the SubmitForm action flag on a button field.
SetSubmitUrl(fieldName: string, url: string)Set the SubmitForm action target URL on a button field.
Single2Multiple(fieldName: string)Convert a single-line text field into a multi-line one.
FlattenAllFields()Flatten all form fields in the bound document.
FillFields(input: byte[], fieldValues: Dictionary<string, string>)Fill form fields with the given values (field name → value).
FillField(input: byte[], fieldName: string, value: string)Fill a single form field by name.
FlattenForm(input: byte[])Flatten the form — render fields as static content and remove the AcroForm.
GetFieldNames(input: byte[])Get all field names in the document’s form.
GetFieldValue(input: byte[], fieldName: string)Get the value of a specific field.
GetFieldType(input: byte[], fieldName: string)Get the type of a specific field.
HasForm(input: byte[])Check if the document has a form.
GetFieldCount(input: byte[])Get the total number of form fields.
ExportFormData(input: byte[])Export form data as a dictionary (field name → value).
ImportFormData(input: byte[], data: Dictionary<string, string>)Import form data from a dictionary.
RenameField(input: byte[], oldName: string, newPartialName: string)Rename a form field in the supplied bytes.

See Also