Link
Skip to main content

Separate form data from the form

Note: This functionality is limited to AcroForm PDF file conversions only.

Data Decoupling

By default, FormVu takes the current filled values of form fields, and places them into the output HTML5. However, you may want to only have the template of the form, without any of the fields set. The decoupleFormData setting is for this use-case.

Rather than using the current filled values of the form fields, they will still output the field in the HTML5 without any value set, and place the current values into a new JSON file, formdata.json.

If a form field has the no-export flag set, the field will not be included in the output JSON.

Example Output

formdata.json is output as a JSON array, filled with JSON objects. Each JSON object, contains the information for a form field that was converted.

Details in this object will include:

  • objref = The PDF object reference of the form field
  • fieldName = The name of the form field
  • value = the value of the form field
  • inputType = the type of the form field (text, checkbox, etc.)

An example would look like the following:

[
    {
        "objref": "10 0 R",
        "fieldName": "FormFieldName",
        "value": "ValueOfFormField",
        "inputType": "text"
    }
]

Export with Empty values

If you require form fields that do not have a value set (or have been set to an empty string), you can use the decoupleEmptyValues setting. It will output in the same format, but will have the “value” field left as an empty string “”.

Import formdata via FormVuAPI

In addition to being able to parse the data in formdata.json for your own purposes, if you want to populate the converted HTML5 with the values, we have also provided a new function in the FormVuAPI.

// formdata can either be a String or a JS Object
FormVuAPI.insertFormValues(formdata);

// If you want the form to be reset before importing the data, you can do the following:
FormVuAPI.insertFormValues(formdata, true);

Get started with FormVu in 3 steps

  1. Fill in the form to download the trial jar →
  2. Copy the code snippets as instructed on the next page
  3. Build your solution using our docs

Learn more about FormVu

Start Your Free Trial