PDF Forms

Creating PDF files with editable form fields:

ReportBuilder includes ability to create editable PDF forms. The form data can also be submitted via HTTP or manipulated via JavaScript using PDF buttons.

There are two ReportBuilder components used to create form fields: TMyCheckbox and TppLabel.

CheckBox:

To create an interactive checkbox in PDF, place a TMyCheckbox on a report, assign its visual properties, and set the FormField property to True. An interactive checkbox will now appear inside the exported PDF with the same style assigned inside the report.

Edit/Button:

To create an interactive edit box, or button in PDF, place a TppLabel on a report and use the TppLabel.FormFieldSettings properties to define its various options. The TppLabel component can represent four different types of form fields using the FormFieldSettings.FormFieldType property:

– fftText: Text Box
– fftSignature: Signature Text Box
– fftSubmit: Submit/Execute Button
– fftReset: Form Reset Button

When creating submit buttons, use the FormFieldSettings.FormSubmitInfo properties to define what action takes place when the button is pressed. Below are examples of the two options provided.

1. Submit form data to a web application:

– FormSubmitInfo.URL: Web application address
– FormSubmitInfo.SubmitMethod: HTTP submit method (POST or GET)

The following code uses the FormSpree.io service to email the form data to the specified email address.

2. Execute Adobe-supported JavaScript:

– FormSubmitInfo.JavaScript: Valid Adobe-Supported JavaScript

See the following website for more information on how JavaScript can be used inside PDF documents.

https://www.adobe.com/devnet/acrobat/javascript.html

The following code shows how to create a simple JS routine via code to print the current page silently.

Notes:

Each form field may be empty or contain default text which will be displayed in the PDF file when opened.  Form fields should be manually horizontally sized with the AutoSize property set to False.

Below is an example of a form created with ReportBuilder and exported to PDF with editable fields.

Download: PDFForm.zip