How to build PDF Forms using Stylus Studio
PDF Form Capabilities
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 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.
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.
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.
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!
Try Stylus Powerful XQuery IDE
Download a free trial of our award-winning IDE for XQuery today!
Attend a Live Webinar This Week!
Learn about Stylus Studio's unique features and benefits in just under an hour. Register for the Stylus Studio QuickStart Training WebCast!
Top Ten XQuery Trends
Read about the top 10 XQuery Trends and how they will impact change the way enterprise software applications are built.