PDF Forms are very useful for sending portable cross-platform documents to users who open documents using a variety of client-side tools on a variety of platforms and fill in the form fields, then save to a new PDF document with the form field values retained in the file.

The file is returned or forwarded to whoever needs to process the form, and automated tools easily extract the form fields from the file. This is a common use case for many forms such as surveys and questionnaires, healthcare forms for release of records or insurance, and legal and tax forms.

Now GrapeCity Documents for Excel makes it easy to create rich and complex PDF Forms from Excel Template spreadsheet documents. Creating a PDF Form is easy; by utilizing the form layout in an Excel Template worksheet and a special template syntax in the cells where the PDF Form fields are placed in the document.

The syntax is rich and versatile, supporting many PDF Form field properties including many event handlers which have JavaScript actions attached using JavaScript for Acrobat.

JSON Syntax for PDF Fields

GrapeCity Documents for Excel uses the mustache syntax of Excel Template worksheets with new support for the form property to specify a PDF Form Field. The PDF Form Field properties are specified using standard JSON syntax and can include snippets of JavaScript code. Here are some examples of the new PDF Form Field syntax:

  1. {{ds1.Team(R=B6:F7, form={“type”: “checkbox”, “name”: “teams”,“font”:{“size”:10, “color”: “#ffff00”, “bold”: true}, “checkstyle”: “Circle”})}}
  2. {{ds1.Name(form={“type”: “textbox”, “name”: “username”, “value”: “Input your name!”,“font”:{“size”:15, “color”: “#ff0000”, “bold”: true}, “required”: true})}}
  3. {{(form={“type”: “listbox”, “name”: “cities”, “value”: [“Xi’An”, “BeiJing”],“font”:{“size”:11, “color”: “#ff00ff”, “bold”: true}, “required”: true})}}
  4. {{(form={“type”: “combobox”, “name”: “dates”, “value”: [“2019”, “2020”, “2021”, “2022”],“font”:{“size”:11, “color”: “#ff00ff”, “bold”: true}, “required”: true})}}

Example 1 specifies a checkbox field named teams using a font with size 10, yellow color and bold text, with a checkstyle of Circle style checkbox.

Example 2 specifies a textbox field named username with value “Input your name!” and font with size 15, red color and bold text, with the field being a required field in the form.

Example 3 specifies a listbox field named cities with value showing the JavaScript array of strings [“Xi’An”, “BeiJing”] using a font with size 11, magenta color and bold text, with the field being a required field in the form.

Example 4 specifies a combobox field named dates with value showing the JavaScript array of strings listing the years 2019-2022 using a font with size 11, magenta color and bold text, with the field being a required field in the form.

Common PDF Form Field Properties

There are many PDF Form Field properties as shown in the examples above which can be applied to any PDF Form Field type. The identifiers named and described in the following table are not case-sensitive:

Note: The table below is an excerpt of the full table in the documentation here – please see the documentation for value types and examples.

#web #.net #desktop #document apis

Generate PDF Forms with GrapeCity Documents for Excel (.NET and Java)
1.95 GEEK