Namespace: FormPlugin

WebPDF. FormPlugin

Methods


<static> exportFormToJson()

Export form data of current document to JSON data.

Returns:

a promise that resolves to an object with info for form data.

      {
        "Fields": [
            {
                "BS": {
                    "S": "S",
                    "W": 1
                },
                "DV": "web",
                "F": 4,
                "FRG": 4278190080,
                "FS": 0,
                "FT": 7,
                "Ff": 4194304,
                "I": [
                    2
                ],
                "MK": {
                    "BG": "ffffff"
                },
                "Opt": [
                    "reader",
                    "phantom",
                    "web"
                ],
                "Rect": [
                    30,
                    709.2,
                    120,
                    761.4
                ],
                "T": "List Box0",
                "V": "web",
                "on": 6,
                "P": 0,
                "AP": {
                    "N": 0
                }
            }
        ],
        "Names": null
    }
Type
object

<static> exportToXML(fileName)

Extract form data (XML format).

Parameters:
Name Type Description
fileName String

Specify the name of file exported.


<static> exportToXMLStream(receiveCallback)

Extract form data (XML format, utf8 encoded).

Parameters:
Name Type Description
receiveCallback function

Callback function to store stream when exporting to a steam.

Example
function formXMLbuffer(buffer){
				buffer;//form xml buffer(Uint8Array, and utf8 encoded) will be stored in this variable.
			}

			WebPDF.FormPlugin.exportToXMLStream(formXMLbuffer);

<static> hasForm()

Detect whether the document has form fields.

Returns:

True if there is a form field, otherwise, return false.

Type
Boolean

<static> highlight()

Highlight all form fields.


<static> importFormFromJson(formData)

Import form data to current document from JSON data.

Parameters:
Name Type Description
formData Object

The form JSON object.

Example
WebPDF.ViewerInstance.importFormFromJson({
            "Fields": [
                {
                    "BS": {
                        "S": "S",
                        "W": 1
                    },
                    "DV": "web",
                    "F": 4,
                    "FRG": 4278190080,
                    "FS": 0,
                    "FT": 7,
                    "Ff": 4194304,
                    "I": [
                        2
                    ],
                    "MK": {
                        "BG": "ffffff"
                    },
                    "Opt": [
                        "reader",
                        "phantom",
                        "web"
                    ],
                    "Rect": [
                        30,
                        709.2,
                        120,
                        761.4
                    ],
                    "T": "List Box0",
                    "V": "web",
                    "on": 6,
                    "P": 0,
                    "AP": {
                        "N": 0
                    }
                }
            ],
            "Names": null
        })

<static> importFromXML(xmlData)

Import form data (XML format) from the local machine.

Parameters:
Name Type Description
xmlData String

The form xml data.


<static> importFromXMLStream(buffer)

Import form from XML stream(utf8 encoded).

Parameters:
Name Type Description
buffer Object

The stream of form XML.The original string should be encoded with UTF-8.

Example
var xmlString = '';//an utf8 string
			var buffer = StringToUint8Array(xmlString); //function StringToUint8Array() should be completed.
			WebPDF.FormPlugin.importFromXMLStream(buffer);

<static> isHighlightBarVisible()

Check the highlight bar visible or not.

Returns:

True if the bar is visible, false for else.

Type
boolean

<static> showHighlightBar(show)

Show or hide current highlight bar.

Parameters:
Name Type Description
show Boolean

The flag indicates to show or hide the highlight bar.