com.aspose.pdf.facades

Class FormEditorWeb

    • Constructor Detail

      • FormEditorWeb

        public FormEditorWeb()

        Constructor for FormEditorWeb.


         
         
         FormEditorWeb FormEditorWeb = new FormEditorWeb();
         
      • FormEditorWeb

        public FormEditorWeb(IDocument document)

        Initializes new FormEditorWeb object on base of the document.

        Parameters:
        document - Pdf document.
      • FormEditorWeb

        public FormEditorWeb(IDocument document,
                             OutputStream destStream)

        Initializes new FormEditorWeb object on base of the document.

        Parameters:
        document - Pdf document.
        destStream - Destination stream.
      • FormEditorWeb

        public FormEditorWeb(IDocument document,
                             String destFileName)

        Initializes new FormEditorWeb object on base of the document.

        Parameters:
        document - Pdf document.
        destFileName - Path of the destination file.
      • FormEditorWeb

        public FormEditorWeb(InputStream inputStream,
                             javax.servlet.http.HttpServletResponse response)

        Creates FormEditorWeb which will save result into HttpResponse object.

        Parameters:
        inputStream - Source stream.
        response - HttpResponse object where result will be saved.
      • FormEditorWeb

        public FormEditorWeb(InputStream srcStream,
                             OutputStream destStream)

        Constructor for FormEditorWeb.


         
         
         FormEditorWeb FormEditorWeb = new FormEditorWeb(new FileInputStream("InFile.pdf"), new FileOutputStream("OutFile.pdf"));
         
        Parameters:
        srcStream - Source stream.
        destStream - Destination stream.
      • FormEditorWeb

        public FormEditorWeb(String inputFile,
                             javax.servlet.http.HttpServletResponse response)

        Creates FormEditorWeb which will save result into HttpResponse object.

        Parameters:
        inputFile - Source file name.
        response - HttpResponse objects where result be saved.
      • FormEditorWeb

        public FormEditorWeb(String srcFileName,
                             String destFileName)

        Constructor for FormEditorWeb


         
         
         FormEditorWeb FormEditorWeb = new FormEditorWeb("InFile.pdf", "OutFile.pdf");
         
        Parameters:
        srcFileName - Name of source file.
        destFileName - Name of destination file.
    • Method Detail

      • getResponse

        public javax.servlet.http.HttpServletResponse getResponse()

        Gets Response object where result of operation will be stored.

        Returns:
        HttpServletResponse object
      • setResponse

        public void setResponse(javax.servlet.http.HttpServletResponse value)

        Sets Response object where result of operation will be stored.

        Parameters:
        value - HttpServletResponse object
      • save

        public void save()

        Saves changes into destination file.

        Specified by:
        save in interface IFormEditor
      • setSrcFileName

        @Deprecated
        public void setSrcFileName(String value)
        Deprecated. 

        Sets name of source file.


        
        
         FormEditor editor = new FormEditor();
         editor.setSrcFileName("InputFile.pdf");
         
        Specified by:
        setSrcFileName in interface IFormEditor
        Parameters:
        value - string value
      • setDestFileName

        @Deprecated
        public void setDestFileName(String value)
        Deprecated. 

        Sets destination file name.


        
        
         FormEditor editor = new FormEditor();
         editor.setDestFileName("OutFile.pdf");
         
        Specified by:
        setDestFileName in interface IFormEditor
        Parameters:
        value - String object
      • setSrcStream

        public void setSrcStream(InputStream value)

        Sets source stream.


        
         FormEditor editor = new FormEditor();
         editor.setSrcStream(new FileInputStream("InFile.pdf"));
         
        Specified by:
        setSrcStream in interface IFormEditor
        Parameters:
        value - InputStream object
      • setConvertTo

        public 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.

        Specified by:
        setConvertTo in interface IFormEditor
        Parameters:
        value - PdfFormat element
        See Also:
        PdfFormat
      • getDestStream

        public OutputStream getDestStream()

        Gets destination stream.


        
        
         FormEditor editor = new FormEditor();
         editor.setDestStream ( new FileInputStream("OutFile.pdf"));
         
        Specified by:
        getDestStream in interface IFormEditor
        Returns:
        OutputStream object
      • setDestStream

        public void setDestStream(OutputStream value)

        Sets destination stream.


        
        
         FormEditor editor = new FormEditor();
         editor.setDestStream ( new FileInputStream("OutFile.pdf"));
         
        Specified by:
        setDestStream in interface IFormEditor
        Parameters:
        value - OutputStream object
      • getItems

        public String[] getItems()
        Description copied from interface: IFormEditor
        Returns item array
        Specified by:
        getItems in interface IFormEditor
        Returns:
        String[] object
      • setItems

        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();
         
        Specified by:
        setItems in interface IFormEditor
        Parameters:
        value - String[] object
      • getExportItems

        public String[][] getExportItems()

        Gets options for combo box with export values.

        Specified by:
        getExportItems in interface IFormEditor
        Returns:
        String[][] array
      • setExportItems

        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();
         
        Specified by:
        setExportItems in interface IFormEditor
        Parameters:
        value - String[][] object
      • setFacade

        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();
         
        Specified by:
        setFacade in interface IFormEditor
        Parameters:
        value - FormFieldFacade object
      • getRadioGap

        public float getRadioGap()

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

        Specified by:
        getRadioGap in interface IFormEditor
        Returns:
        float 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();
         
        Specified by:
        setRadioGap in interface IFormEditor
        Parameters:
        value - float value
      • getRadioHoriz

        public boolean getRadioHoriz()

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

        Specified by:
        getRadioHoriz in interface IFormEditor
        Returns:
        boolean 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();
         
        Specified by:
        setRadioHoriz in interface IFormEditor
        Parameters:
        value - boolean value
      • getRadioButtonItemSize

        public double getRadioButtonItemSize()

        Gets or sets size of radio button item size (when new radio button field is added).

         formEditor = new 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(FieldType.Radio, "AddedRadioButtonField", "Second", 1, 10, 30, 110, 130);
         formEditor.save();
         
        Specified by:
        getRadioButtonItemSize in interface IFormEditor
        Returns:
        double value
      • 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();
        
         
        Specified by:
        setRadioButtonItemSize in interface IFormEditor
        Parameters:
        value - double value
      • getSubmitFlag

        public int getSubmitFlag()

        Get the submit button's submission flags

        Specified by:
        getSubmitFlag in interface IFormEditor
        Returns:
        SubmitFormFlag element
        See Also:
        SubmitFormFlag
      • setSubmitFlag

        public void setSubmitFlag(int value)

        Set the submit button's submission flags

        Specified by:
        setSubmitFlag in interface IFormEditor
        Parameters:
        value - SubmitFormFlag element
        See Also:
        SubmitFormFlag
      • setFieldAttribute

        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);
         
        Specified by:
        setFieldAttribute in interface IFormEditor
        Parameters:
        fieldName - Name of field which attributes should be set.
        flag - Flag (NoExport/ReadOnly/Required)
        Returns:
        true if attribute was set successfully.
      • setFieldAppearance

        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);
         
        Specified by:
        setFieldAppearance in interface IFormEditor
        Parameters:
        fieldName - Name of field whose flags should be updated.
        flags - Flag of the field.
        Returns:
        true if flags were updated successfully.
      • getFieldAppearance

        public int getFieldAppearance(String fieldName)

        Get field flags.

        Parameters:
        fieldName - Name of the field.
        Returns:
        Set of field flags
      • setSubmitFlag

        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);
         
        Specified by:
        setSubmitFlag in interface IFormEditor
        Parameters:
        fieldName - Name of submit button.
        submitFormFlag - Submit flag.
        Returns:
        true if field was found and submit flag was successfully set.
      • setSubmitUrl

        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");
         
        Specified by:
        setSubmitUrl in interface IFormEditor
        Parameters:
        fieldName - Submit button name.
        url - Fully qualified URL.
        Returns:
        true if URL for button was successfully set.
      • setFieldLimit

        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);
         
        Specified by:
        setFieldLimit in interface IFormEditor
        Parameters:
        fieldName - Name of the text field.
        fieldLimit - New value of limit for the field.
        Returns:
        true if field limit was successfully set.
      • setFieldCombNumber

        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);
         
        Specified by:
        setFieldCombNumber in interface IFormEditor
        Parameters:
        fieldName - The qualified field name.
        combNumber - The number of combs to divide the field into.
        Returns:
        If success, return true;else false.
      • moveField

        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);
         
        Specified by:
        moveField in interface IFormEditor
        Parameters:
        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.
        Returns:
        true if field position was changed successfully.
      • addField

        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();
         
        Specified by:
        addField in interface IFormEditor
        Parameters:
        fieldType - Type of the field which must be added.
        fieldName - Name of the field which 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.
        Returns:
        true if field was successfully added.
      • addField

        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.

        Specified by:
        addField in interface IFormEditor
        Parameters:
        fieldType - Type of the field which must be added.
        fieldName - Name of the field which 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.
        Returns:
        true if field was successfully added.
      • removeField

        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");
         
        Specified by:
        removeField in interface IFormEditor
        Parameters:
        fieldName - Name of the field which must be removed.
      • resetFacade

        public void resetFacade()

        Reset all visual attributes to empty value.

        Specified by:
        resetFacade in interface IFormEditor
      • resetInnerFacade

        public void resetInnerFacade()

        Reset all visual attributes of inner facade to empty value.

        Specified by:
        resetInnerFacade in interface IFormEditor
      • copyInnerField

        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.


        
        
         FormEditor formEditor = new FormEditor("PdfForm.pdf", "PdfForm_out.pdf");
         //Creates copy of text field on second page.
         formEditor.copyInnerField("textField", "textFieldCopy", 2);
         
        Specified by:
        copyInnerField in interface IFormEditor
        Parameters:
        fieldName - The old fully qualified field name.
        newFieldName - The new fully qualified field name. If null, it will be set as fieldName + "~".
        pageNum - The number of page to hold the new field. If -1, new field will be copid to the same page as old one hosted.
      • copyInnerField

        public 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.


        
        
         FormEditor formEditor = new FormEditor("PdfForm.pdf", "PdfForm_out.pdf");
         //Creates copy of text field on second page.
         formEditor.copyInnerField("textField", "textFieldCopy", 2, 100, 200);
         
        Specified by:
        copyInnerField in interface IFormEditor
        Parameters:
        fieldName - The old fully qualified field name.
        newFieldName - The new fully qualified field name. If null, it will be set as fieldName + "~".
        pageNum - The number of page to hold the new field. If -1, new field will be copid to the same page as old one hosted.
        abscissa - The abscissa of the new field. If -1, the abscissa will be equaled to the original one.
        ordinate - The ordinate of the new field. If -1, the ordinate will be equaled to the original one.
      • copyOuterField

        public 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).


        
        
         FormEditor formEditor = new FormEditor("PdfForm.pdf", "PdfForm_updated.pdf");
         //copies text field from source.pdf to PdfForm.pdf
         formEditor.copyOuterField("source.pdf", "textField");
         formEditor.save();
         
        Specified by:
        copyOuterField in interface IFormEditor
        Parameters:
        srcFileName - The name of PDF document which contains the field to be copied.
        fieldName - The original fully qualified field name.
      • copyOuterField

        public 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).

        Specified by:
        copyOuterField in interface IFormEditor
        Parameters:
        srcFileName - The name of PDF document which contains the field to be copied.
        fieldName - The original fully qualified field name.
        pageNum - int value
      • copyOuterField

        public 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).

        Specified by:
        copyOuterField in interface IFormEditor
        Parameters:
        srcFileName - The old fully qualified field name.
        fieldName - The new fully qualified field name. If null, it will be set as fieldName + "~".
        pageNum - The number of page to hold the new field. If -1, new field will be copid to the same page as old one hosted.
        abscissa - The abscissa of the new field. If -1, the abscissa will be equaled to the original one.
        ordinate - The ordinate of the new field. If -1, the ordinate will be equaled to the original one.
      • decorateField

        public 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");
         
        Specified by:
        decorateField in interface IFormEditor
        Parameters:
        fieldName - The fully qualified field name.
      • decorateField

        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);
         
        Specified by:
        decorateField in interface IFormEditor
        Parameters:
        fieldType - Type of fields which will be decorated.
        See Also:
        FieldType
      • 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();
         
        Specified by:
        decorateField in interface IFormEditor
      • renameField

        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");
         
        Specified by:
        renameField in interface IFormEditor
        Parameters:
        fieldName - Old name of the field.
        newFieldName - New name of the field.
      • removeFieldAction

        public void removeFieldAction(String fieldName)

        Remove submit action of the field.


        
        
         FormEditor formEditor = new FormEditor("PdfForm.pdf", "FormEditor_RemoveFieldAction.pdf");
         formEditor.removeFieldAction("btnSubmit");
         
        Specified by:
        removeFieldAction in interface IFormEditor
        Parameters:
        fieldName - Name of the field.
      • addSubmitBtn

        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);
         
        Specified by:
        addSubmitBtn in interface IFormEditor
        Parameters:
        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.
      • addListItem

        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)");
         
        Specified by:
        addListItem in interface IFormEditor
        Parameters:
        fieldName - Name of the field ot which new item will be added.
        itemName - Name if new item.
      • addListItem

        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)" });
         
        Specified by:
        addListItem in interface IFormEditor
        Parameters:
        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).
      • delListItem

        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");
         
        Specified by:
        delListItem in interface IFormEditor
        Parameters:
        fieldName - Name of the field.
        itemName - Name of the item which must be deleted.
      • setFieldScript

        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.

        Specified by:
        setFieldScript in interface IFormEditor
        Parameters:
        fieldName - The fully qualified field name.
        script - The Java script to be added/placed into a push button field.
        Returns:
        boolean value: If success, return true; else false.
      • addFieldScript

        public boolean addFieldScript(String fieldName,
                                      String script)

        Add JavaScript for a PushButton field. If old event exists, new event is added after it.

        Parameters:
        fieldName - The fully qualified field name.
        script - The Java script to be added/placed into a push button field.
        Returns:
        True in case script was added successfully.
      • single2Multiple

        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");
         
        Specified by:
        single2Multiple in interface IFormEditor
        Parameters:
        fieldName - The qualified field name.
        Returns:
        If success, return true;else false.
      • setFieldAlignment

        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);
         
        Specified by:
        setFieldAlignment in interface IFormEditor
        Parameters:
        fieldName - The qualified field name.
        alignment - The alignment style definition, including FormFieldFacade.AlignLeft, FormFieldFacade.AlignCenter and FormFieldFacade.AlignRight.
        Returns:
        boolean value
      • setFieldAlignmentV

        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);
         
        Specified by:
        setFieldAlignmentV in interface IFormEditor
        Parameters:
        fieldName - The qualified field name.
        alignment - The alignment style definition, including FormFieldFacade.AlignTop, FormFieldFacade.AlignMiddle and FormFieldFacade.AlignRight.
        Returns:
        If success, return true;else false.
      • getContentDisposition

        public int getContentDisposition()

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

        Specified by:
        getContentDisposition in interface IFormEditor
        Returns:
        ContentDisposition element
        See Also:
        ContentDisposition
      • setContentDisposition

        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.

        Specified by:
        setContentDisposition in interface IFormEditor
        Parameters:
        value - ContentDisposition element
        See Also:
        ContentDisposition
      • getSaveOptions

        public SaveOptions getSaveOptions()

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

        Specified by:
        getSaveOptions in interface IFormEditor
        Returns:
        SaveOptions object
      • setSaveOptions

        public void setSaveOptions(SaveOptions value)

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

        Specified by:
        setSaveOptions in interface IFormEditor
        Parameters:
        value - SaveOptions object
      • getAttachmentName

        public String getAttachmentName()

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

        Specified by:
        getAttachmentName in interface IFormEditor
        Returns:
        String object
      • setAttachmentName

        public void setAttachmentName(String value)

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

        Specified by:
        setAttachmentName in interface IFormEditor
        Parameters:
        value - String object
      • close

        public void close()
        Description copied from class: Facade

        Disposes Document bound with a facade.

        Specified by:
        close in interface IFacade
        Specified by:
        close in interface IFormEditor
        Overrides:
        close in class Facade
      • dispose

        public void dispose()
        Description copied from class: Facade

        Disposes the facade.

        Specified by:
        dispose in interface com.aspose.ms.System.IDisposable
        Specified by:
        dispose in interface IFormEditor
        Overrides:
        dispose in class Facade