FormEditor

Inheritance: java.lang.Object, com.aspose.pdf.facades.Facade com.aspose.pdf.facades.SaveableFacade com.aspose.pdf.facades.FormEditor, com.aspose.pdf.facades.Facade, com.aspose.pdf.facades.SaveableFacade com.aspose.pdf.facades.FormEditor, com.aspose.pdf.facades.SaveableFacade, com.aspose.pdf.facades.FormEditor

All Implemented Interfaces: com.aspose.ms.System.IDisposable, IFacade, IFormEditor, ISaveableFacade, Closeable, AutoCloseable

public final class FormEditor extends SaveableFacade implements IFormEditor

Class for editing forms (adding/deleting field etc)

Constructors

ConstructorDescription
FormEditor

Constructor for FormEditor.


 FormEditor formEditor = new FormEditor(); 
FormEditor

Constructor for FormEditor.


 FormEditor formEditor = new FormEditor(); 
FormEditor

Constructor for FormEditor.


 FormEditor formEditor = new FormEditor(); 
FormEditor

Constructor for FormEditor.


 FormEditor formEditor = new FormEditor(); 
FormEditor

Constructor for FormEditor.


 FormEditor formEditor = new FormEditor(); 
FormEditor

Constructor for FormEditor.


 FormEditor formEditor = new FormEditor(); 

Methods

MethodDescription
addField

Add field of specified type to the form.


 FormEditor formEditor = new com.aspose.pdf.facades.FormEditor(“PdfForm.pdf”, “FormEditor_AddField_Text.pdf”); formEditor.addField(FieldType.Text, “AddedTextField”, 1, 10, 30, 110, 46); formEditor.save(); 
addFieldAdd field of specified type to the form.
addFieldScriptAdd JavaScript for a PushButton field.
addListItem

Adds new item to the list box.


 FormEditor formEditor = new FormEditor(“PdfForm.pdf”, PdfForm_out.pdf"); formEditor.addListItem(“listBoxField”, “Item 4 (New Item)”); 
addListItem

Add a new item with Export value to the existing list box field, only for AcroForm combo box field.


 FormEditor fe = new FormEditor(“PdfForm.pdf”, “FormEditor_AddListItem2.pdf”); fe.addListItem(“listboxField”, new String[] { “4”, “Item4(Added)” }); 
addSubmitBtn

Add submit button on the form.


 FormEditor formEditor = new FormEditor(“PdfForm.pdf”, “FormEditor_AddSubmitBtn.pdf”); formEditor.addSubmitBtn(“submit”, 1, “Submit”, “www.check.com”, 10, 200, 70, 270); 
closeClose object instance
copyInnerFieldCopies an existing field to the same position in specified page number. A new document will be produced, which contains everything the source document has except for the newly copied field.
copyInnerFieldCopies an existing field to a new position specified by both page number and ordinates. A new document will be produced, which contains everything the source document has except for the newly copied field.
copyOuterFieldCopies an existing field from one PDF document to another document with original page number and ordinates. Notice: Only for AcroForm fields (excluding radio box).
copyOuterFieldCopies an existing field from one PDF document to another document with specified page number and original ordinates. Notice: Only for AcroForm fields (excluding radio box).
copyOuterFieldCopies an existing field from one PDF document to another document with specified page number and ordinates. Notice: Only for AcroForm fields (excluding radio box).
decorateField

Changes visual attributes of all fields in the PDF document.


 FormEditor fe = new FormEditor(“PdfForm.pdf”, “FormEditor_DecorateField.pdf”); fe.setFacade(new FormFieldFacade()); fe.getFacade().setBackgroundColor(Color.red); fe.getFacade().setTextColor(Color.blue); fe.getFacade().setBorderColor(Color.Green); fe.getFacade().setAlignment(FormFieldFacade.AlignRight); // decorate all fields. fe.decorateField(); 
decorateField

Changes visual attributes of all fields in the PDF document.


 FormEditor fe = new FormEditor(“PdfForm.pdf”, “FormEditor_DecorateField.pdf”); fe.setFacade(new FormFieldFacade()); fe.getFacade().setBackgroundColor(Color.red); fe.getFacade().setTextColor(Color.blue); fe.getFacade().setBorderColor(Color.Green); fe.getFacade().setAlignment(FormFieldFacade.AlignRight); // decorate all fields. fe.decorateField(); 
decorateField

Changes visual attributes of all fields in the PDF document.


 FormEditor fe = new FormEditor(“PdfForm.pdf”, “FormEditor_DecorateField.pdf”); fe.setFacade(new FormFieldFacade()); fe.getFacade().setBackgroundColor(Color.red); fe.getFacade().setTextColor(Color.blue); fe.getFacade().setBorderColor(Color.Green); fe.getFacade().setAlignment(FormFieldFacade.AlignRight); // decorate all fields. fe.decorateField(); 
delListItem

Delete item from the list field.


 formEditor = new com.aspose.pdf.facades.FormEditor(“PdfForm.pdf”, “FormEditor_DelListItem.pdf”); formEditor.delListItem(“listboxField”, “item2”); 
disposeClose object instance This method is obsolete, use close() instead.
getAttachmentNameGets name of attachment when result of operation is stored into HttpResponse objects as attachment.
getContentDispositionGets how content will be stored when result of operation is stored into HttpResponse object. Possible value: inline / attachment. Default: inline.
getDestFileNameGets destination file name.
getDestStream

Gets destination stream.


 FormEditor editor = new FormEditor(); editor.setDestStream(new FileInputStream(“OutFile.pdf”)); 
getDocumentGets the document {@code FormEditor} is working on.
getExportItems

Gets options for combo box with export values.


getFacadeGets visual attributes of the field.
getFieldAppearanceGet field flags.
getItemsGet Items which will be added to newly created list box or combo box.
getRadioButtonItemSizeGets or sets size of radio button item size (when new radio button field is added). FormEditor formEditor = new com.aspose.pdf.facades.FormEditor(“PdfForm.pdf”, “FormEditor_AddField_RadioButton.pdf”); formEditor.setRadioGap(4); formEditor.setRadioHoriz(false); formEditor.setRadioButtonItemSize(20); formEditor.setItems(new String[] { “First”, “Second”, “Third” }); formEditor.addField(com.aspose.pdf.facades.FieldType.Radio, “AddedRadioButtonField”, “Second”, 1, 10, 30, 110, 130); formEditor.save();
getRadioGapGet the member to record the gap between two neighboring radio buttons in pixels,default is 50.
getRadioHoriz

Get the flag to indicate whether the radios are arranged horizontally or vertically, default value is true.

getSaveOptionsGets save options when result is stored as HttpResponse. Default value: PdfSaveOptions.
getSrcFileNameGets name of source file.
getSrcStreamGets source stream.
getSubmitFlagGet the submit button’s submission flags
moveField

Set new position of field.


 FormEditor formEditor = new FormEditor(“PdfForm.pdf”, “FormEditor_MoveField.pdf”); formEditor.moveField(“textField”, 20.5f, 20.3f, 120.6f, 40.8f); 
removeField

Remove field from the form.


 FormEditr formEditor = new FormEditor(“PdfForm.pdf”, “FormEditor_RemoveField.pdf”); formEditor.removeField(“listboxField”); formEditor.removeField(“textField”); 
removeFieldAction

Remove submit action of the field.


 FormEditor formEditor = new FormEditor(“PdfForm.pdf”, “FormEditor_RemoveFieldAction.pdf”); formEditor.removeFieldAction(“btnSubmit”); 
renameField

Change name of the field.


 FormEditor formEditor = new FormEditor(“PdfForm.pdf”, “PdfForm_updated.pdf”); formEditor.renameField(“textField”, “textField_Renamed”); 
resetFacadeReset all visual attribtues to empty value.
resetInnerFacadeReset all visual attribtues of inner facade to empty value.
saveSaves changes into destination file.
setAttachmentNameSets name of attachment when result of operation is stored into HttpResponse objects as attachment.
setContentDispositionSets how content will be stored when result of operation is stored into HttpResponse object. Possible value: inline / attachment. Default: inline.
setConvertToSets {@link PdfFormat} PDF file format. Result file will be saved in specified file format. If this property is not specified then file will be save in default PDF format without conversion.
setDestFileName

Sets destination file name.


 FormEditor editor = new FormEditor(); editor.setDestFileName(“OutFile.pdf”); 
setDestStream

Sets destination stream.


 FormEditor editor = new FormEditor(); editor.setDestStream(new FileInputStream(“OutFile.pdf”)); 
setExportItems

Sets options for combo box with export values.


 FormEditor formEditor = new FormEditor(“PdfForm.pdf”, “PdfForm_Updated.pdf”)); formEditor.setExportItems ( new String[][] { new String[] { “1”, “Firs” }, new String[] { “2”, “Second” }, new String[] { “3”, “Third” } }); formEditor.addField(FieldType.ListBox, “AddedListBoxField”, “Second”, 1, 10, 30, 110, 130); formEditor.save(); 
setFacade

Sets visual attributes of the field.


 FormEditor fe = new FormEditor(“PdfForm.pdf”, “PdfForm_DecorateField_text.pdf”); fe.setFacade(new FormFieldFacade()); fe.getFacade().setBackgroundColor(Color.red); fe.getFacade().setTextColor(Color.blue); fe.getFacade().setBorderColor(Color.green); fe.getFacade().setAlignment(FormFieldFacade.AlignCenter); fe.setDecorateField(“textField”); fe.save(); 
setFieldAlignment

Set the alignment style of a text field.


 FormEditor formEditor = new FormEditor(“PdfForm.pdf”, “FormEditor_updated.pdf”)); formEditor.setFieldAlignment(fieldName, FormFieldFacade.AlignCenter); 
setFieldAlignmentV

Set the vertical alignment style of a text field.


 FormEditor fe = new FormEditor(“PdfStaticForm.pdf”, “VerticalAlign.pdf”); fe.setFieldAlignmentV(“form1[0].TextField[0]”, FormFieldFacade.AlignBottom); 
setFieldAppearance

Set field flags


 FormEditor formEditor = new FormEditor(“PdfForm1.pdf”, “FormEditor_SetFieldAppearance.pdf”); formEditor.setFieldAppearance(“Name”, AnnotationFlags.Hidden); formEditor.setFieldAppearance(“Phone”, AnnotationFlags.NoView | AnnotationFlags.Print); 
setFieldAttribute

Set attributes of field.


 FormEditor formEditor = new FormEditor(“PdfForm.pdf”, “PdfForm_SetFieldAttribute.pdf”); formEditor.setFieldAttribute(“listboxField”, PropertyFlag.ReadOnly); formEditor.setFieldAttribute(“textField”, PropertyFlag.NoExport); 
setFieldCombNumber

Sets number of combs for a regular single-line text field (the field is automatically divided into as many equally spaced positions, or combs, as the value of combNumber parameter).


 FormEditor formEditor = new FormEditor(“PdfWithAcroForm.pdf”, “FormEditor_SetFieldComb.pdf”)); formEditor.setFieldCombNumber(“textCombField”, 5); 
setFieldLimit

Sets maximum character count of the text field.


 FormEditor formEditor = new FormEditor(“PdfForm.pdf”, “FormEditor_SetFieldLimit.pdf”); formEditor.setFieldLimit(“textField”, 15); 
setFieldScriptSet JavaScript for a PushButton field. If old JavaScript existed, it will be replaced by the new one.
setItems

Sets items which will be added to newly created list box or combo box.


 formEditor = new com.aspose.pdf.facadesFormEditor(“input.pdf”, “output.pdf”); formEditor.setItems(new String[] { “AAA”, “BBB”, “CCC” }); formEditor.addField(FieldType.ListBox, “AddedListBoxField”, “BBB”, 1, 10, 30, 110, 130); formEditor.save(); 
setRadioButtonItemSizeGets or sets size of radio button item size (when new radio button field is added). FormEditor formEditor = new com.aspose.pdf.facades.FormEditor(“PdfForm.pdf”, “FormEditor_AddField_RadioButton.pdf”); formEditor.setRadioGap(4); formEditor.setRadioHoriz(false); formEditor.setRadioButtonItemSize(20); formEditor.setItems(new String[] { “First”, “Second”, “Third” }); formEditor.addField(com.aspose.pdf.facades.FieldType.Radio, “AddedRadioButtonField”, “Second”, 1, 10, 30, 110, 130); formEditor.save();
setRadioGap

Set the member to record the gap between two neighboring radio buttons in pixels,default is 50.


 formEditor = new com.aspose.pdf.facades.FormEditor(“PdfForm.pdf”, “FormEditor_AddField_RadioButton.pdf”); formEditor.setRadioGap(4); formEditor.setRadioHoriz(false); formEditor.setItems(new String[] { “First”, “Second”, “Third” }); formEditor.addField(FieldType.Radio, “AddedRadioButtonField”, “Second”, 1, 10, 30, 110, 130); formEditor.save(); 
setRadioHoriz

Set the flag to indicate whether the radios are arranged horizontally or vertically, default value is true.


 formEditor = new com.aspose.pdf.facades.FormEditor(“PdfForm.pdf”, “FormEditor_AddField_RadioButton.pdf”); formEditor.setRadioGap(4); formEditor.setRadioHoriz(false); formEditor.setItems(new String[] { “First”, “Second”, “Third” }); formEditor.addField(FieldType.Radio, “AddedRadioButtonField”, “Second”, 1, 10, 30, 110, 130); formEditor.save(); 
setSaveOptionsSets save options when result is stored as HttpResponse. Default value: PdfSaveOptions.
setSrcFileName

Sets name of source file.


 FormEditor editor = new FormEditor(); editor.setSrcFileName(“InputFile.pdf”); 
setSrcStream

Sets source stream.


 FormEditor editor = new FormEditor(); editor.setSrcStream(new FileInputStream(“InFile.pdf”)); 
setSubmitFlag

Set submit flag of submit button.


 FormEditor formEditor = new FormEditor(“PdfForm.pdf”, “FormEditor_SetSubmitFlag.pdf”); formEditor.setSubmitFlag(“btnSubmit”, SubmitFormFlag.Fdf); 
setSubmitFlagSet the submit button’s submission flags
setSubmitUrl

Sets URL of the button.


 FormEditor formEditor = new FormEditor(“PdfForm.pdf”, “FormEditor_SetSubmitUrl.pdf”); formEditor.setSubmitUrl(“btnSubmit”, “www.mysite.com”); 
single2Multiple

Change a single-lined text field to a multiple-lined one.


 FormEditor formEditor = new FormEditor(“PdfForm.pdf”, “PdfForm_updated.pdf”); formEditor.single2Multiple(“textField”); 

FormEditor

public FormEditor()

Constructor for FormEditor.


 FormEditor formEditor = new FormEditor(); 

FormEditor

Constructor for FormEditor.


 FormEditor formEditor = new FormEditor(); 

FormEditor

Constructor for FormEditor.


 FormEditor formEditor = new FormEditor(); 

FormEditor

Constructor for FormEditor.


 FormEditor formEditor = new FormEditor(); 

FormEditor

Constructor for FormEditor.


 FormEditor formEditor = new FormEditor(); 

FormEditor

Constructor for FormEditor.


 FormEditor formEditor = new FormEditor(); 

addField

Add field of specified type to the form.


 FormEditor formEditor = new com.aspose.pdf.facades.FormEditor("PdfForm.pdf", "FormEditor_AddField_Text.pdf"); formEditor.addField(FieldType.Text, "AddedTextField", 1, 10, 30, 110, 46); formEditor.save(); 

addField

Add field of specified type to the form.

addFieldScript

Add JavaScript for a PushButton field.

addListItem

Adds new item to the list box.


 FormEditor formEditor = new FormEditor("PdfForm.pdf", PdfForm_out.pdf"); formEditor.addListItem("listBoxField", "Item 4 (New Item)"); 

addListItem

Add a new item with Export value to the existing list box field, only for AcroForm combo box field.


 FormEditor fe = new FormEditor("PdfForm.pdf", "FormEditor_AddListItem2.pdf"); fe.addListItem("listboxField", new String[] { "4", "Item4(Added)" }); 

addSubmitBtn

Add submit button on the form.


 FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_AddSubmitBtn.pdf"); formEditor.addSubmitBtn("submit", 1, "Submit", "www.check.com", 10, 200, 70, 270); 

close

public void close()

Close object instance

copyInnerField

Copies an existing field to the same position in specified page number. A new document will be produced, which contains everything the source document has except for the newly copied field.

copyInnerField

Copies an existing field to a new position specified by both page number and ordinates. A new document will be produced, which contains everything the source document has except for the newly copied field.

copyOuterField

Copies an existing field from one PDF document to another document with original page number and ordinates. Notice: Only for AcroForm fields (excluding radio box).

copyOuterField

Copies an existing field from one PDF document to another document with specified page number and original ordinates. Notice: Only for AcroForm fields (excluding radio box).

copyOuterField

Copies an existing field from one PDF document to another document with specified page number and ordinates. Notice: Only for AcroForm fields (excluding radio box).

decorateField

public void decorateField()

Changes visual attributes of all fields in the PDF document.


 FormEditor fe = new FormEditor("PdfForm.pdf", "FormEditor_DecorateField.pdf"); fe.setFacade(new FormFieldFacade()); fe.getFacade().setBackgroundColor(Color.red); fe.getFacade().setTextColor(Color.blue); fe.getFacade().setBorderColor(Color.Green); fe.getFacade().setAlignment(FormFieldFacade.AlignRight); // decorate all fields. fe.decorateField(); 

decorateField

Changes visual attributes of all fields in the PDF document.


 FormEditor fe = new FormEditor("PdfForm.pdf", "FormEditor_DecorateField.pdf"); fe.setFacade(new FormFieldFacade()); fe.getFacade().setBackgroundColor(Color.red); fe.getFacade().setTextColor(Color.blue); fe.getFacade().setBorderColor(Color.Green); fe.getFacade().setAlignment(FormFieldFacade.AlignRight); // decorate all fields. fe.decorateField(); 

decorateField

Changes visual attributes of all fields in the PDF document.


 FormEditor fe = new FormEditor("PdfForm.pdf", "FormEditor_DecorateField.pdf"); fe.setFacade(new FormFieldFacade()); fe.getFacade().setBackgroundColor(Color.red); fe.getFacade().setTextColor(Color.blue); fe.getFacade().setBorderColor(Color.Green); fe.getFacade().setAlignment(FormFieldFacade.AlignRight); // decorate all fields. fe.decorateField(); 

delListItem

Delete item from the list field.


 formEditor = new com.aspose.pdf.facades.FormEditor("PdfForm.pdf", "FormEditor_DelListItem.pdf"); formEditor.delListItem("listboxField", "item2"); 

dispose

@Deprecated public void dispose()

Close object instance This method is obsolete, use close() instead.

getAttachmentName

public String getAttachmentName()

Gets name of attachment when result of operation is stored into HttpResponse objects as attachment.

Returns: String object

getContentDisposition

public ContentDisposition getContentDisposition()

Gets how content will be stored when result of operation is stored into HttpResponse object. Possible value: inline / attachment. Default: inline.

Returns: ContentDisposition element @see ContentDisposition

getDestFileName

public String getDestFileName()

Gets destination file name.

Returns: string object

getDestStream

public OutputStream getDestStream()

Gets destination stream.


 FormEditor editor = new FormEditor(); editor.setDestStream(new FileInputStream("OutFile.pdf")); 

Returns: OutputStream object

getDocument

public IDocument getDocument()

Gets the document {@code FormEditor} is working on.

Returns: IDocument object

getExportItems

public String [][] getExportItems()

Gets options for combo box with export values.


Returns: String[][] object

getFacade

public FormFieldFacade getFacade()

Gets visual attributes of the field.

Returns: FormFieldFacade object

getFieldAppearance

Get field flags.

getItems

public String [] getItems()

Get Items which will be added to newly created list box or combo box.

Returns: String[] object

getRadioButtonItemSize

public double getRadioButtonItemSize()

Gets or sets size of radio button item size (when new radio button field is added). FormEditor formEditor = new com.aspose.pdf.facades.FormEditor(“PdfForm.pdf”, “FormEditor_AddField_RadioButton.pdf”); formEditor.setRadioGap(4); formEditor.setRadioHoriz(false); formEditor.setRadioButtonItemSize(20); formEditor.setItems(new String[] { “First”, “Second”, “Third” }); formEditor.addField(com.aspose.pdf.facades.FieldType.Radio, “AddedRadioButtonField”, “Second”, 1, 10, 30, 110, 130); formEditor.save();

Returns: double value

getRadioGap

public float getRadioGap()

Get the member to record the gap between two neighboring radio buttons in pixels,default is 50.

Returns: float value

getRadioHoriz

public boolean getRadioHoriz()

Get the flag to indicate whether the radios are arranged horizontally or vertically, default value is true.

Returns: boolean value

getSaveOptions

public SaveOptions getSaveOptions()

Gets save options when result is stored as HttpResponse. Default value: PdfSaveOptions.

Returns: SaveOptions object

getSrcFileName

public String getSrcFileName()

Gets name of source file.

Returns: string object

getSrcStream

public InputStream getSrcStream()

Gets source stream.

Returns: InputStream object

getSubmitFlag

public SubmitFormFlag getSubmitFlag()

Get the submit button’s submission flags

Returns: SubmitFormFlag element @see SubmitFormFlag

moveField

Set new position of field.


 FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_MoveField.pdf"); formEditor.moveField("textField", 20.5f, 20.3f, 120.6f, 40.8f); 

removeField

Remove field from the form.


 FormEditr formEditor = new FormEditor("PdfForm.pdf", "FormEditor_RemoveField.pdf"); formEditor.removeField("listboxField"); formEditor.removeField("textField"); 

removeFieldAction

Remove submit action of the field.


 FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_RemoveFieldAction.pdf"); formEditor.removeFieldAction("btnSubmit"); 

renameField

Change name of the field.


 FormEditor formEditor = new FormEditor("PdfForm.pdf", "PdfForm_updated.pdf"); formEditor.renameField("textField", "textField_Renamed"); 

resetFacade

public void resetFacade()

Reset all visual attribtues to empty value.

resetInnerFacade

public void resetInnerFacade()

Reset all visual attribtues of inner facade to empty value.

save

@Deprecated public void save()

Saves changes into destination file.

setAttachmentName

Sets name of attachment when result of operation is stored into HttpResponse objects as attachment.

setContentDisposition

Sets how content will be stored when result of operation is stored into HttpResponse object. Possible value: inline / attachment. Default: inline.

setConvertTo

Sets {@link PdfFormat} PDF file format. Result file will be saved in specified file format. If this property is not specified then file will be save in default PDF format without conversion.

setDestFileName

Sets destination file name.


 FormEditor editor = new FormEditor(); editor.setDestFileName("OutFile.pdf"); 

setDestStream

Sets destination stream.


 FormEditor editor = new FormEditor(); editor.setDestStream(new FileInputStream("OutFile.pdf")); 

setExportItems

Sets options for combo box with export values.


 FormEditor formEditor = new FormEditor("PdfForm.pdf", "PdfForm_Updated.pdf")); formEditor.setExportItems ( new String[][] { new String[] { "1", "Firs" }, new String[] { "2", "Second" }, new String[] { "3", "Third" } }); formEditor.addField(FieldType.ListBox, "AddedListBoxField", "Second", 1, 10, 30, 110, 130); formEditor.save(); 

setFacade

Sets visual attributes of the field.


 FormEditor fe = new FormEditor("PdfForm.pdf", "PdfForm_DecorateField_text.pdf"); fe.setFacade(new FormFieldFacade()); fe.getFacade().setBackgroundColor(Color.red); fe.getFacade().setTextColor(Color.blue); fe.getFacade().setBorderColor(Color.green); fe.getFacade().setAlignment(FormFieldFacade.AlignCenter); fe.setDecorateField("textField"); fe.save(); 

setFieldAlignment

Set the alignment style of a text field.


 FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_updated.pdf")); formEditor.setFieldAlignment(fieldName, FormFieldFacade.AlignCenter); 

setFieldAlignmentV

Set the vertical alignment style of a text field.


 FormEditor fe = new FormEditor("PdfStaticForm.pdf", "VerticalAlign.pdf"); fe.setFieldAlignmentV("form1[0].TextField[0]", FormFieldFacade.AlignBottom); 

setFieldAppearance

Set field flags


 FormEditor formEditor = new FormEditor("PdfForm1.pdf", "FormEditor_SetFieldAppearance.pdf"); formEditor.setFieldAppearance("Name", AnnotationFlags.Hidden); formEditor.setFieldAppearance("Phone", AnnotationFlags.NoView | AnnotationFlags.Print); 

setFieldAttribute

Set attributes of field.


 FormEditor formEditor = new FormEditor("PdfForm.pdf", "PdfForm_SetFieldAttribute.pdf"); formEditor.setFieldAttribute("listboxField", PropertyFlag.ReadOnly); formEditor.setFieldAttribute("textField", PropertyFlag.NoExport); 

setFieldCombNumber

Sets number of combs for a regular single-line text field (the field is automatically divided into as many equally spaced positions, or combs, as the value of combNumber parameter).


 FormEditor formEditor = new FormEditor("PdfWithAcroForm.pdf", "FormEditor_SetFieldComb.pdf")); formEditor.setFieldCombNumber("textCombField", 5); 

setFieldLimit

Sets maximum character count of the text field.


 FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_SetFieldLimit.pdf"); formEditor.setFieldLimit("textField", 15); 

setFieldScript

Set JavaScript for a PushButton field. If old JavaScript existed, it will be replaced by the new one.

setItems

Sets items which will be added to newly created list box or combo box.


 formEditor = new com.aspose.pdf.facadesFormEditor("input.pdf", "output.pdf"); formEditor.setItems(new String[] { "AAA", "BBB", "CCC" }); formEditor.addField(FieldType.ListBox, "AddedListBoxField", "BBB", 1, 10, 30, 110, 130); formEditor.save(); 

setRadioButtonItemSize

public void setRadioButtonItemSize(double value)

Gets or sets size of radio button item size (when new radio button field is added). FormEditor formEditor = new com.aspose.pdf.facades.FormEditor(“PdfForm.pdf”, “FormEditor_AddField_RadioButton.pdf”); formEditor.setRadioGap(4); formEditor.setRadioHoriz(false); formEditor.setRadioButtonItemSize(20); formEditor.setItems(new String[] { “First”, “Second”, “Third” }); formEditor.addField(com.aspose.pdf.facades.FieldType.Radio, “AddedRadioButtonField”, “Second”, 1, 10, 30, 110, 130); formEditor.save();

Parameters:

ParameterTypeDescription
valuedouble value

setRadioGap

public void setRadioGap(float value)

Set the member to record the gap between two neighboring radio buttons in pixels,default is 50.


 formEditor = new com.aspose.pdf.facades.FormEditor("PdfForm.pdf", "FormEditor_AddField_RadioButton.pdf"); formEditor.setRadioGap(4); formEditor.setRadioHoriz(false); formEditor.setItems(new String[] { "First", "Second", "Third" }); formEditor.addField(FieldType.Radio, "AddedRadioButtonField", "Second", 1, 10, 30, 110, 130); formEditor.save(); 

Parameters:

ParameterTypeDescription
valuefloat value

setRadioHoriz

public void setRadioHoriz(boolean value)

Set the flag to indicate whether the radios are arranged horizontally or vertically, default value is true.


 formEditor = new com.aspose.pdf.facades.FormEditor("PdfForm.pdf", "FormEditor_AddField_RadioButton.pdf"); formEditor.setRadioGap(4); formEditor.setRadioHoriz(false); formEditor.setItems(new String[] { "First", "Second", "Third" }); formEditor.addField(FieldType.Radio, "AddedRadioButtonField", "Second", 1, 10, 30, 110, 130); formEditor.save(); 

Parameters:

ParameterTypeDescription
valueboolean value

setSaveOptions

Sets save options when result is stored as HttpResponse. Default value: PdfSaveOptions.

setSrcFileName

Sets name of source file.


 FormEditor editor = new FormEditor(); editor.setSrcFileName("InputFile.pdf"); 

setSrcStream

Sets source stream.


 FormEditor editor = new FormEditor(); editor.setSrcStream(new FileInputStream("InFile.pdf")); 

setSubmitFlag

Set submit flag of submit button.


 FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_SetSubmitFlag.pdf"); formEditor.setSubmitFlag("btnSubmit", SubmitFormFlag.Fdf); 

setSubmitFlag

Set the submit button’s submission flags

setSubmitUrl

Sets URL of the button.


 FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_SetSubmitUrl.pdf"); formEditor.setSubmitUrl("btnSubmit", "www.mysite.com"); 

single2Multiple

Change a single-lined text field to a multiple-lined one.


 FormEditor formEditor = new FormEditor("PdfForm.pdf", "PdfForm_updated.pdf"); formEditor.single2Multiple("textField");