public final class FormEditor extends SaveableFacade implements IFormEditor
Class for editing forms (adding/deleting field etc)
Constructor and Description |
---|
FormEditor()
Constructor for FormEditor.
|
FormEditor(IDocument document)
Initializes new
FormEditor object on base of the document . |
FormEditor(IDocument document,
OutputStream destStream)
Deprecated.
|
FormEditor(IDocument document,
String destFileName)
Deprecated.
|
FormEditor(InputStream srcStream,
OutputStream destStream)
Deprecated.
|
FormEditor(String srcFileName,
String destFileName)
Constructor for FormEditor
FormEditor formEditor = new FormEditor("InFile.pdf", "OutFile.pdf");
|
Modifier and Type | Method and Description |
---|---|
boolean |
addField(int fieldType,
String fieldName,
int pageNum,
float llx,
float lly,
float urx,
float ury)
Add field of specified type to the form.
|
boolean |
addField(int fieldType,
String fieldName,
String initValue,
int pageNum,
float llx,
float lly,
float urx,
float ury)
Add field of specified type to the form.
|
boolean |
addFieldScript(String fieldName,
String script)
Add JavaScript for a PushButton field.
|
void |
addListItem(String fieldName,
String itemName)
Adds new item to the list box.
|
void |
addListItem(String fieldName,
String[] exportName)
Add a new item with Export value to the existing list box field, only for AcroForm combo box
field.
|
void |
addSubmitBtn(String fieldName,
int page,
String label,
String url,
float llx,
float lly,
float urx,
float ury)
Add submit button on the form.
|
void |
close()
Close object instance
|
void |
copyInnerField(String fieldName,
String newFieldName,
int pageNum)
Copies an existing field to the same position in specified page number.
|
void |
copyInnerField(String fieldName,
String newFieldName,
int pageNum,
float abscissa,
float ordinate)
Copies an existing field to a new position specified by both page number and ordinates.
|
void |
copyOuterField(String srcFileName,
String fieldName)
Copies an existing field from one PDF document to another document with original page number
and ordinates.
|
void |
copyOuterField(String srcFileName,
String fieldName,
int pageNum)
Copies an existing field from one PDF document to another document with specified page number
and original ordinates.
|
void |
copyOuterField(String srcFileName,
String fieldName,
int pageNum,
float abscissa,
float ordinate)
Copies an existing field from one PDF document to another document with specified page number
and ordinates.
|
void |
decorateField()
Changes visual attributes of all fields in the PDF document.
|
void |
decorateField(int fieldType)
Changes visual attributes of all fields with the specified field type.
|
void |
decorateField(String fieldName)
Changes visual attributes of the specified field.
|
void |
delListItem(String fieldName,
String itemName)
Delete item from the list field.
|
void |
dispose()
Deprecated.
|
String |
getAttachmentName()
Gets name of attachment when result of operation is stored into HttpResponse objects as
attachment.
|
int |
getContentDisposition()
Gets how content will be stored when result of operation is stored into HttpResponse object.
|
String |
getDestFileName()
Gets destination file name.
|
OutputStream |
getDestStream()
Gets destination stream.
|
IDocument |
getDocument()
Gets the document
FormEditor is working on. |
String[][] |
getExportItems()
Gets options for combo box with export values.
|
FormFieldFacade |
getFacade()
Gets visual attributes of the field.
|
int |
getFieldAppearance(String fieldName)
Get field flags.
|
String[] |
getItems()
Get Items which will be added to newly created list box or combo box.
|
double |
getRadioButtonItemSize()
Gets or sets size of radio button item size (when new radio button field is added).
|
float |
getRadioGap()
Get the member to record the gap between two neighboring radio buttons in pixels,default is
50.
|
boolean |
getRadioHoriz()
Get the flag to indicate whether the radios are arranged horizontally or vertically, default
value is true.
|
SaveOptions |
getSaveOptions()
Gets save options when result is stored as HttpResponse.
|
String |
getSrcFileName()
Gets name of source file.
|
InputStream |
getSrcStream()
Gets source stream.
|
int |
getSubmitFlag()
Get the submit button's submission flags
|
boolean |
moveField(String fieldName,
float llx,
float lly,
float urx,
float ury)
Set new position of field.
|
void |
removeField(String fieldName)
Remove field from the form.
|
void |
removeFieldAction(String fieldName)
Remove submit action of the field.
|
void |
renameField(String fieldName,
String newFieldName)
Change name of the field.
|
void |
resetFacade()
Reset all visual attribtues to empty value.
|
void |
resetInnerFacade()
Reset all visual attribtues of inner facade to empty value.
|
void |
save()
Deprecated.
|
void |
setAttachmentName(String value)
Sets name of attachment when result of operation is stored into HttpResponse objects as
attachment.
|
void |
setContentDisposition(int value)
Sets how content will be stored when result of operation is stored into HttpResponse object.
|
void |
setConvertTo(int value)
Sets
PdfFormat PDF file format. |
void |
setDestFileName(String value)
Sets destination file name.
|
void |
setDestStream(OutputStream value)
Sets destination stream.
|
void |
setExportItems(String[][] value)
Sets options for combo box with export values.
|
void |
setFacade(FormFieldFacade value)
Sets visual attributes of the field.
|
boolean |
setFieldAlignment(String fieldName,
int alignment)
Set the alignment style of a text field.
|
boolean |
setFieldAlignmentV(String fieldName,
int alignment)
Set the vertical alignment style of a text field.
|
boolean |
setFieldAppearance(String fieldName,
int flags)
Set field flags
FormEditor formEditor = new FormEditor("PdfForm1.pdf", "FormEditor_SetFieldAppearance.pdf");
formEditor.setFieldAppearance("Name", AnnotationFlags.Hidden);
formEditor.setFieldAppearance("Phone", AnnotationFlags.NoView | AnnotationFlags.Print);
|
boolean |
setFieldAttribute(String fieldName,
int flag)
Set attributes of field.
|
boolean |
setFieldCombNumber(String fieldName,
int combNumber)
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).
|
boolean |
setFieldLimit(String fieldName,
int fieldLimit)
Sets maximum character count of the text field.
|
boolean |
setFieldScript(String fieldName,
String script)
Set JavaScript for a PushButton field.
|
void |
setItems(String[] value)
Sets items which will be added to newly created list box or combo box.
|
void |
setRadioButtonItemSize(double value)
Gets or sets size of radio button item size (when new radio button field is added).
|
void |
setRadioGap(float value)
Set the member to record the gap between two neighboring radio buttons in pixels,default is
50.
|
void |
setRadioHoriz(boolean value)
Set the flag to indicate whether the radios are arranged horizontally or vertically, default
value is true.
|
void |
setSaveOptions(SaveOptions value)
Sets save options when result is stored as HttpResponse.
|
void |
setSrcFileName(String value)
Sets name of source file.
|
void |
setSrcStream(InputStream value)
Sets source stream.
|
void |
setSubmitFlag(int value)
Set the submit button's submission flags
|
boolean |
setSubmitFlag(String fieldName,
int submitFormFlag)
Set submit flag of submit button.
|
boolean |
setSubmitUrl(String fieldName,
String url)
Sets URL of the button.
|
boolean |
single2Multiple(String fieldName)
Change a single-lined text field to a multiple-lined one.
|
save, save
bindPdf, bindPdf, bindPdf, bindPdf, bindPdf
public FormEditor()
Constructor for FormEditor.
FormEditor formEditor = new FormEditor();
public FormEditor(IDocument document)
Initializes new FormEditor
object on base of the document
.
document
- Pdf document.@Deprecated public FormEditor(IDocument document, OutputStream destStream)
Initializes new FormEditor
object on base of the document
.
document
- Pdf document.destStream
- Destination stream.@Deprecated public FormEditor(IDocument document, String destFileName)
Initializes new FormEditor
object on base of the document
.
document
- Pdf document.destFileName
- Path of the destination file.@Deprecated public FormEditor(InputStream srcStream, OutputStream destStream)
Constructor for FormEditor.
FormEditor formEditor = new FormEditor(new FileInputStream("InFile.pdf"), new FileOutputStream("OutFile.pdf"));
srcStream
- Source stream.destStream
- Destination stream.public String getSrcFileName()
Gets name of source file.
getSrcFileName
in interface IFormEditor
public void setSrcFileName(String value)
Sets name of source file.
FormEditor editor = new FormEditor(); editor.setSrcFileName("InputFile.pdf");
setSrcFileName
in interface IFormEditor
value
- string objectpublic String getDestFileName()
Gets destination file name.
getDestFileName
in interface IFormEditor
public void setDestFileName(String value)
Sets destination file name.
FormEditor editor = new FormEditor(); editor.setDestFileName("OutFile.pdf");
setDestFileName
in interface IFormEditor
value
- string objectpublic InputStream getSrcStream()
Gets source stream.
getSrcStream
in interface IFormEditor
public void setSrcStream(InputStream value)
Sets source stream.
FormEditor editor = new FormEditor(); editor.setSrcStream(new FileInputStream("InFile.pdf"));
setSrcStream
in interface IFormEditor
value
- InputStream objectpublic void setConvertTo(int value)
Sets 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.
setConvertTo
in interface IFormEditor
value
- PdfFormat elementPdfFormat
public OutputStream getDestStream()
Gets destination stream.
FormEditor editor = new FormEditor(); editor.setDestStream(new FileInputStream("OutFile.pdf"));
getDestStream
in interface IFormEditor
public void setDestStream(OutputStream value)
Sets destination stream.
FormEditor editor = new FormEditor(); editor.setDestStream(new FileInputStream("OutFile.pdf"));
setDestStream
in interface IFormEditor
value
- OutputStream objectpublic String[] getItems()
getItems
in interface IFormEditor
public void setItems(String[] value)
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();
setItems
in interface IFormEditor
value
- String[] objectpublic String[][] getExportItems()
Gets options for combo box with export values.
getExportItems
in interface IFormEditor
public void setExportItems(String[][] value)
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();
setExportItems
in interface IFormEditor
value
- String[][] objectpublic FormFieldFacade getFacade()
Gets visual attributes of the field.
getFacade
in interface IFormEditor
public void setFacade(FormFieldFacade value)
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();
setFacade
in interface IFormEditor
value
- FormFieldFacade objectpublic float getRadioGap()
Get the member to record the gap between two neighboring radio buttons in pixels,default is 50.
getRadioGap
in interface IFormEditor
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();
setRadioGap
in interface IFormEditor
value
- float valuepublic boolean getRadioHoriz()
Get the flag to indicate whether the radios are arranged horizontally or vertically, default value is true.
getRadioHoriz
in interface IFormEditor
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();
setRadioHoriz
in interface IFormEditor
value
- boolean valuepublic 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();
getRadioButtonItemSize
in interface IFormEditor
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();
setRadioButtonItemSize
in interface IFormEditor
value
- double valuepublic int getSubmitFlag()
Get the submit button's submission flags
getSubmitFlag
in interface IFormEditor
SubmitFormFlag
public void setSubmitFlag(int value)
Set the submit button's submission flags
setSubmitFlag
in interface IFormEditor
value
- SubmitFormFlag elementSubmitFormFlag
@Deprecated public void save()
Saves changes into destination file.
save
in interface IFormEditor
public boolean setFieldAttribute(String fieldName, int flag)
Set attributes of field.
FormEditor formEditor = new FormEditor("PdfForm.pdf", "PdfForm_SetFieldAttribute.pdf"); formEditor.setFieldAttribute("listboxField", PropertyFlag.ReadOnly); formEditor.setFieldAttribute("textField", PropertyFlag.NoExport);
setFieldAttribute
in interface IFormEditor
fieldName
- Name of field which attributes should be set.flag
- Flag (NoExport/ReadOnly/Required)public boolean setFieldAppearance(String fieldName, int flags)
Set field flags
FormEditor formEditor = new FormEditor("PdfForm1.pdf", "FormEditor_SetFieldAppearance.pdf"); formEditor.setFieldAppearance("Name", AnnotationFlags.Hidden); formEditor.setFieldAppearance("Phone", AnnotationFlags.NoView | AnnotationFlags.Print);
setFieldAppearance
in interface IFormEditor
fieldName
- Name of field whose flags should be updated.flags
- Flag of the field.AnnotationFlags
public boolean setSubmitFlag(String fieldName, int submitFormFlag)
Set submit flag of submit button.
FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_SetSubmitFlag.pdf"); formEditor.setSubmitFlag("btnSubmit", SubmitFormFlag.Fdf);
setSubmitFlag
in interface IFormEditor
fieldName
- Name of submit button.submitFormFlag
- Submit flag.SubmitFormFlag
public boolean setSubmitUrl(String fieldName, String url)
Sets URL of the button.
FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_SetSubmitUrl.pdf"); formEditor.setSubmitUrl("btnSubmit", "www.mysite.com");
setSubmitUrl
in interface IFormEditor
fieldName
- Submit button name.url
- Fully qualified URL.public boolean setFieldLimit(String fieldName, int fieldLimit)
Sets maximum character count of the text field.
FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_SetFieldLimit.pdf"); formEditor.setFieldLimit("textField", 15);
setFieldLimit
in interface IFormEditor
fieldName
- Name of the text field.fieldLimit
- New value of limit for the field.public boolean setFieldCombNumber(String fieldName, int combNumber)
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);
setFieldCombNumber
in interface IFormEditor
fieldName
- The qualified field name.combNumber
- The number of combs to divide the field into.public boolean moveField(String fieldName, float llx, float lly, float urx, float ury)
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);
moveField
in interface IFormEditor
fieldName
- Name of field which must be moved.llx
- Abscissa of the lower-left corner of the field.lly
- Ordinate of the lower-left coerner of the field.urx
- Abscissa of the upper-right corner of the field.ury
- Ordinate of the upper-right corner of the field.public boolean addField(int fieldType, String fieldName, int pageNum, float llx, float lly, float urx, float ury)
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
in interface IFormEditor
fieldType
- Type of the field which must be added.fieldName
- Name of the field whic must be added.pageNum
- Page number where new field must be placed.llx
- Abscissa of the lower-left corner of the field.lly
- Ordinate of the lower-left corner of the field.urx
- Abscissa of the upper-right corner of the field.ury
- Ordinate of the upper-right corner of the field.public boolean addField(int fieldType, String fieldName, String initValue, int pageNum, float llx, float lly, float urx, float ury)
Add field of specified type to the form.
addField
in interface IFormEditor
fieldType
- Type of the field which must be added.fieldName
- Name of the field whic must be added.initValue
- Initial value of the field.pageNum
- Page number where new field must be placed.llx
- Abscissa of the lower-left corner of the field.lly
- Ordinate of the lower-left corner of the field.urx
- Abscissa of the upper-right corner of the field.ury
- Ordinate of the upper-right corner of the field.public void removeField(String fieldName)
Remove field from the form.
FormEditr formEditor = new FormEditor("PdfForm.pdf", "FormEditor_RemoveField.pdf"); formEditor.removeField("listboxField"); formEditor.removeField("textField");
removeField
in interface IFormEditor
fieldName
- Name of the field which must be removed.public void resetFacade()
Reset all visual attribtues to empty value.
resetFacade
in interface IFormEditor
public void resetInnerFacade()
Reset all visual attribtues of inner facade to empty value.
resetInnerFacade
in interface IFormEditor
public void copyInnerField(String fieldName, String newFieldName, int pageNum)
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
in interface IFormEditor
fieldName
- String valuenewFieldName
- String valuepageNum
- int valuepublic void copyInnerField(String fieldName, String newFieldName, int pageNum, float abscissa, float ordinate)
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.
copyInnerField
in interface IFormEditor
fieldName
- String valuenewFieldName
- String valuepageNum
- int valueabscissa
- float valueordinate
- float valuepublic void copyOuterField(String srcFileName, String fieldName)
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
in interface IFormEditor
srcFileName
- String valuefieldName
- String valuepublic void copyOuterField(String srcFileName, String fieldName, int pageNum)
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
in interface IFormEditor
srcFileName
- String valuefieldName
- String valuepageNum
- int valuepublic void copyOuterField(String srcFileName, String fieldName, int pageNum, float abscissa, float ordinate)
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).
copyOuterField
in interface IFormEditor
srcFileName
- String valuefieldName
- String valuepageNum
- int valueabscissa
- float valueordinate
- float valuepublic void decorateField(String fieldName)
Changes visual attributes of the specified field.
FormEditor fe = new FormEditor("PdfWithAcroForm.pdf", "FormEditor_DecorateField_text.pdf"); fe.Facade = new FormFieldFacade(); fe.Facade.setBackgroundColor(Color.Red); fe.Facade.setTextColor(Color.Blue); fe.Facade.setBorderColor(Color.Green); fe.Facade.setAlignment(FormFieldFacade.AlignCenter); fe.decorateField("textField");
decorateField
in interface IFormEditor
fieldName
- The fully qualified field name.public void decorateField(int fieldType)
Changes visual attributes of all fields with the specified field type.
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 text fields. fe.decorateField(FieldType.Text);
decorateField
in interface IFormEditor
fieldType
- Type of fields which will be decorated.FieldType
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
in interface IFormEditor
public void renameField(String fieldName, String newFieldName)
Change name of the field.
FormEditor formEditor = new FormEditor("PdfForm.pdf", "PdfForm_updated.pdf"); formEditor.renameField("textField", "textField_Renamed");
renameField
in interface IFormEditor
fieldName
- Old name of the field.newFieldName
- New name of the field.public void removeFieldAction(String fieldName)
Remove submit action of the field.
FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_RemoveFieldAction.pdf"); formEditor.removeFieldAction("btnSubmit");
removeFieldAction
in interface IFormEditor
fieldName
- Name of the field.public void addSubmitBtn(String fieldName, int page, String label, String url, float llx, float lly, float urx, float ury)
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);
addSubmitBtn
in interface IFormEditor
fieldName
- Name of new button.page
- Page where button will be placed.label
- Button caption.url
- URL of the submit button.llx
- Abscissa of the lower-left corner.lly
- Ordinate of the lower-left corner.urx
- Abscissa of the upper-right corner.ury
- Ordinate of the upper-right corner.public void addListItem(String fieldName, String itemName)
Adds new item to the list box.
FormEditor formEditor = new FormEditor("PdfForm.pdf", PdfForm_out.pdf"); formEditor.addListItem("listBoxField", "Item 4 (New Item)");
addListItem
in interface IFormEditor
fieldName
- Name of the field ot which new item will be added.itemName
- Name if new item.public void addListItem(String fieldName, String[] exportName)
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)" });
addListItem
in interface IFormEditor
fieldName
- Name of field to which items will be added.exportName
- A String array denoting a new list item with Export Value, i.e. (Item Label, Export Value).public void delListItem(String fieldName, String itemName)
Delete item from the list field.
formEditor = new com.aspose.pdf.facades.FormEditor("PdfForm.pdf", "FormEditor_DelListItem.pdf"); formEditor.delListItem("listboxField", "item2");
delListItem
in interface IFormEditor
fieldName
- Name of the field.itemName
- Name of the item which must be deleted.public boolean setFieldScript(String fieldName, String script)
Set JavaScript for a PushButton field. If old JavaScript existed, it will be replaced by the new one.
setFieldScript
in interface IFormEditor
fieldName
- The fully qualified field name.script
- The Java script to be added/placed into a push button field.public boolean single2Multiple(String fieldName)
Change a single-lined text field to a multiple-lined one.
FormEditor formEditor = new FormEditor("PdfForm.pdf", "PdfForm_updated.pdf"); formEditor.single2Multiple("textField");
single2Multiple
in interface IFormEditor
fieldName
- The qualified field name.public boolean setFieldAlignment(String fieldName, int alignment)
Set the alignment style of a text field.
FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_updated.pdf")); formEditor.setFieldAlignment(fieldName, FormFieldFacade.AlignCenter);
setFieldAlignment
in interface IFormEditor
fieldName
- The qualified field name.alignment
- The alignment style definition, including FormFieldFacade.AlignLeft,
FormFieldFacade.AlignCenter and FormFieldFacade.AlignRight.public boolean setFieldAlignmentV(String fieldName, int alignment)
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);
setFieldAlignmentV
in interface IFormEditor
fieldName
- The qualified field name.alignment
- The alignment style definition, including FormFieldFacade.AlignTop,
FormFieldFacade.AlignMiddle and FormFieldFacade.AlignRight.public IDocument getDocument()
Gets the document FormEditor
is working on.
getDocument
in interface IFormEditor
getDocument
in class Facade
public int getContentDisposition()
Gets how content will be stored when result of operation is stored into HttpResponse object. Possible value: inline / attachment. Default: inline.
getContentDisposition
in interface IFormEditor
ContentDisposition
public void setContentDisposition(int value)
Sets how content will be stored when result of operation is stored into HttpResponse object. Possible value: inline / attachment. Default: inline.
setContentDisposition
in interface IFormEditor
value
- ContentDisposition elementContentDisposition
public SaveOptions getSaveOptions()
Gets save options when result is stored as HttpResponse. Default value: PdfSaveOptions.
getSaveOptions
in interface IFormEditor
public void setSaveOptions(SaveOptions value)
Sets save options when result is stored as HttpResponse. Default value: PdfSaveOptions.
setSaveOptions
in interface IFormEditor
value
- SaveOptions objectpublic String getAttachmentName()
Gets name of attachment when result of operation is stored into HttpResponse objects as attachment.
getAttachmentName
in interface IFormEditor
public void setAttachmentName(String value)
Sets name of attachment when result of operation is stored into HttpResponse objects as attachment.
setAttachmentName
in interface IFormEditor
value
- String objectpublic void close()
close
in interface IFacade
close
in interface IFormEditor
close
in interface Closeable
close
in interface AutoCloseable
@Deprecated public void dispose()
dispose
in interface com.aspose.ms.System.IDisposable
dispose
in interface IFormEditor
public int getFieldAppearance(String fieldName)
Get field flags.
fieldName
- Name of the field.public boolean addFieldScript(String fieldName, String script)
Add JavaScript for a PushButton field. If old event exists, new event is added after it.
fieldName
- The fully qualified field name.script
- The Java script to be added/placed into a push button field.