About Arbortext Styler > Scripting and Interactivity > Including PDF Forms in PDF Output
Including PDF Forms in PDF Output
PDF Forms allow a user to interact with a PDF document. These types of PDF form field are supported by Arbortext Styler:
Text boxes
Radio buttons
Check boxes
List boxes
Combo boxes
Your Arbortext Styler environment must be setup to use PTC ALD as the print engine for PDF output. For more information, see Logic for Print Engine Selection
Stylesheet modules that provide sample code for defining and embedding PDF Forms are provided in Arbortext-path/samples/APP/pdfFormFields. Advanced users of Arbortext Styler can use the modules in their stylesheet or customize them.
The sample stylesheets provide User Formatting Elements (UFE), Property Sets and custom PTC ALD Functions to insert and use the PDF Form fields.
Sample Stylesheet Module
The stylesheet module pdfFormFields_MODULE.style includes sample code to support all supported types of PDF Form. Associate the module with another stylesheet to load its provided components.
The module provides three types of defined component:
UFEs – a set of UFEs that are referenced by the generated text of elements in the base stylesheet
For more information about UFEs, see Adding User Formatting Elements to Generated Text
Property sets – a set of property sets (prefixed pdfForms_) which all contain PTC ALD edited source to call PTC ALD user functions
PTC ALD user functions – a set of custom PTC ALD JavaScript functions that contain the code that creates and applies the different PDF Form fields. The functions are called by the pdfForms_ property sets.
For more information about PTC ALD functions, see Custom JavaScript Functions
Description of Components in Stylesheet Module
The sample provides components for each type of PDF Form supported by Arbortext Styler (with PTC ALD engine). The components for each type are defined and used in the same pattern:
The base stylesheet includes an element that represents the PDF Form type
The element is styled as Hidden
The element applies some Before-text generated text that inserts a UFE that represents the PDF Form field in output.
The UFE (defined in the stylesheet module) has two jobs:
Wrap the content to apply to the field (either explicitly or added using XPath)
Carry attributes that set properties of the field
The UFE is also styled as Hidden
The UFE applies a property set that references a custom APP function
The property set (defined in the stylesheet module) uses the attribute values set on the UFE, plus some default values, to call a custom PTC ALD function to add the field
The property set only contains only edited PTC ALD source
The custom PTC ALD function (defined in the stylesheet module) creates the form field object with values passed from the property set, using a create function. It then uses the general-purpose insert function to output the form field.
Further Information
For more information about PDF Form Fields, see the PTC Arbortext Layout Developer (PTC ALD) Help Center. It contains information about the JavaScript objects that support PDF Forms, for example fPDFFormItem, and the objects which inherit it, such as fPDFFormListBox.
The Help Center also contains information about the types of PDF Action supported by PTC ALD.