How to build PDF Forms using Stylus Studio

PDF Form Capabilities
The following tutorial will show you how to build a PDF form in order to collect information regarding applicants looking for employment.

Watch the Video >

We start with a simple XML file that contains the applicant information, we will use it as a template for creating a static PDF document then, will modified the generated source to take advantage of the new FO extensions to create a PDF form.

Now we can create our XML report. As output format, we want XSL-FO and PDF

Let's start creating the title "APPLICATION FOR EMPLOYMENT"
Then we create a section called "PERSONAL INFORMATION"

Then we fill the form body with the data we want to capture, for that we will be using a table, with two columns [remove column].

We have some basic information we want to capture, we start with First name, then we add rows for Last name, street, city, state, zip, phone and if the applicant is currently employed. We want to hide the border in the table and in the cells and change the column width to a 30 70 ratio. Next we add the live data from the input document. From the data source panel we drag and drop first name , last name, and the remaining elements.

The data binding is completed we can now save our report and preview the result. The result is rendered in the preview window, the second column contains the data pulled from the input document. Great! it's time for the final placeholder for the submit button to complete our form.

Stylus Studio® XML Editor

Our report is done, it's time to generate the XSLT code. The all report has been captured as XSLT transformation that generates an XSL-FO document. When we preview the result Stylus Studio runs the XSLT processor first, then the FO processor and the final PDF document appears directly embedded in the preview window.

The first task is completed, now we want to allow the applicant to review the form and fix any potential error. We need to create a PDF document that can be open in Acrobat Reader with the initial values and also allow to change these values. We have prepared a small XSLT library that encapsulates the RenderX Form extensions for creating text fields, combo-boxes and buttons.

We just need to import the library in our main XSLT. We need to replace the static data binding with a call to the "textField" template; the Stylus Studio auto-complete suggests the template name and the parameters: field ID and initial value.

When we preview the result we can see that the field "First Name" is now an edit-box.
We can use the same approach for the remaining fields: "Last name", street, city, state, zip and phone. For the last field which indicates if the applicant is currently working, we use a drop-down control. The parameter "options" allows to specify which values will appear in the drop-down and which value is selected by default.
We run the preview again to see how Acrobat Reader renders the form at runtime. Our drop-down works perfectly.

Stylus Studio® XML Editor

To complete our form we need to implement the Submit button, the call to action is sending the form as email attachment, HTTP endpoints can also be used.
In the preview window we can see a new submit button, the tooltip shows the endpoint where the form will be posted.

The project is now completed, our PDF form is initialized with data from the backend system and the applicant may review it send it back as email attachment. Now you know how to have fun with the new PDF form capabilities, for more video tutorials visit stylusstudio.com

PURCHASE STYLUS STUDIO ONLINE TODAY!!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Try Stylus Powerful XQuery IDE

Download a free trial of our award-winning IDE for XQuery today!

Learn XQuery in 10 Minutes!

Say goodbye to 10-minute abs, and say Hello to "Learn XQuery in Ten Minutes!", the world's fastest and easiest XQuery primer, now available for free!

Ask Someone You Know

Does your company use Stylus Studio? Do your competitors? Engineers from over 100,000 leading companies use Stylus Studio, and now you can ask someone from your own organization about their experiences using Stylus Studio.

Top Ten XQuery Trends

Read about the top 10 XQuery Trends and how they will impact change the way enterprise software applications are built.

 
Free Stylus Studio XML Training:
W3C Member