ReportBuilder 16 introduced PDF form fields and checkboxes. This allowed for the creation of dynamic PDF forms that could be altered and printed with the user’s custom data. ReportBuilder 19 includes a number of new ways to manipulate the existing form fields as well as the addition of PDF buttons.
Form Field customization
In the past, PDF form fields were defined using the TppLabel.FormField boolean property. This property has now been deprecated and replaced with the TppLabel.FormFieldSettings property. Use the FormFieldType sub-property to define which type of form field you would like to use. There are also a number of useful settings such as required fields, read only fields, and the ability to limit the number of characters a form field can hold. The FormFieldTitle property has also been moved into the FormFieldSettings and can be very useful for manual form editing and form submission. See the following help topics in the installed RB documentation for more information on each property.
– TppFormFieldSettings.FormFieldType
– TppFormFieldSettings.FieldRequired
– TppFormFieldSettings.FieldReadOnly
– TppFormFieldSettings.FieldMaxChars
– TppFormFieldSettings.FieldTitle
PDF Form submit, reset, execute
ReportBuilder 19 also introduces PDF Buttons. A button inside a PDF document can be used to submit form data to a web app (similar to an HTML form), reset all existing form data, or execute Adobe-supported JavaScript from within the document.
To create a PDF button, place a TppLabel on a report and simply set the FormFieldSettings.FormFieldType property to fftSubmit or fftReset. When the fftSubmit option is selected, you will use the FormFieldSettings.FormSubmitInfo property to define its behavior.
From whithin the FormSubmitInfo options, it is possible to define a URL that the form data will be sent. Use the SubmitMethod to define whether the web application receiving the form data expects HTTP GET or HTTP POST format.
Finally it is possible to take complete control over how the PDF button behaves by executing custom Adobe-supported JavaScript. Use the JavaScript property to define the script to be executed. Below is a simple example of how this can be done.
1 2 3 |
lblSubmit.FormFieldSettings.PDFFormFieldType := fftSubmit; lblSubmit.FormFieldSettings.FormSubmitInfo.SubmitMethod := fstJavaScript; lblSubmit.FormFieldSettings.FormSubmitInfo.JavaScript.Add('app.alert("Congratulations! You just pressed a button!");'); |
Note that all JavaScript needs to be Adobe supported. See the following web site for more information.
https://www.adobe.com/devnet/acrobat/javascript.html
Hopefully this will give you a better idea how the new interactive PDF features can be utilized to create even more powerful PDF reports. An updated RBWiki article has been posted with the above information and a new example. Enjoy!