Print Properties
4 - Creating and working with PDF forms

Inforama tutorial

 

You can download the Inforama project files for this example by clicking the attachments link at the bottom of this page.

 

Inforama allows you to create new PDF forms within the Studio using the embedded OpenOffice editor. Alternatively, you can import existing PDF forms into your Inforama project.

 

Creating a PDF form from an OpenOffice document

To create the document click the File – New document... menu item and the new document dialog will appear.

 

Figure 1: Creating a new AcroForm from Document

 

In this case we're creating a change of address form which needs to be printed out and signed by customers of Dividy Films. Enter the name ChangeOfAddressForm and select AcroForm from Document from the Document type dropdown list. Click the Create button and the new document will appear in the Document frame tree and the new document will open for editing in the OpenOffice editor.

When this document is saved it will be automatically converted to a PDF. In order to make form fields appear in the resulting PDF it's necessary to insert OpenOffice form controls into the document. To see the OpenOffice form controls toolbar make the OpenOffice menu bar visible and click the View – Toolbars – Form Controls menu item as shown in figure 2.

 

Figure 2: Enabling the form controls toolbar

 

The toolbar shown in figure 3 below shows the form control toolbar.

 

Figure 3: The form control toolbar

 

Begin creating the form by opening the new ChangeOfAddressForm document. Insert a frame into the document using the Insert – Frame OpenOffice menu item. Resize the frame so that it appears about 4cm from the top of the document, is about 4cm in height and spans the width of the document. Now create a new 2 column x 5 row table in the frame. In the right hand columns we want to create text fields. First make sure design mode is switched on in OpenOffice by toggling the button indicated by the number 1 in figure 3. Next click the new Text Box button as indicated by the number 3 in figure 3. Draw the Text Box in the second column on the second row of the table.

Double-click the new Text Box to display the form control properties dialog as shown in figure 4. Change the default name of the Text Box and also change the Border property to Flat.

 

Figure 4: Form control properties dialog

 

Continue to add the form controls and prompts until the table looks like that shown in figure 5 below.

 

Figure 5: The customer details frame

 

Binding data to the PDF form

In order to create the PDF form and bind data to it we now need to switch the view of the document. First save your changes and click the Switch to AcroForm button shown in figure 6.

 

Figure 6: Switch to acroform button

 

The document is automatically converted to a PDF form as shown in figure 7.

 

 

 Figure 7: The document converted to PDF

 

The Text Box controls which were created in the OpenOffice editor are converted to PDF form fields and are listed in the Components Frame at the bottom left of the Studio. If you click on one of the names in the Component Frame the component will highlight in red in the editor. It is also possible to add new PDF form fields in this view but this is not recommended as the PDF document is generated from the OpenOffice document and any changes to the layout, etc. should be made in this.

 

In order to bind data from the database to the form fields expand the Data Frame, select the form field you wish to bind to and double-click the field which should appear there. The mapping will appear in the Data text box in the Components Frame. Continue to create your mappings and preview the document by clicking the Document Manager toolbar button. In the Document Manager dialog click the Preview button and the document will appear as in figure 8.

 

 

 

Figure 8: Preview of the document with data merged

  

Create a PDF letterhead

Using this type of document it's possible to create a letterhead which can be applied to documents. To demonstrate this we'll create a new document of type AcroForm from Document with the name Letterhead.

When this document opens for editing insert logos and address information at the top and bottom of the document to produce something like that shown in figure 9.

 

Figure 9: Sample letterhead document

 

Now to apply this letterhead to a document we need to create a compound document which we can do in the Letter Manager dialog. But first re-open the WelcomeLetter document and move the entire body of the letter down by about 6 lines in order to accommodate the header.

Now click the Project – Manage documents... menu item and move the WelcomeLetter to the Selected fragments list. In the Background dropdown list select the Letterhead document and now click the Preview button. The document will appear as shown in figure 10.

 

Figure 10: Previewing the letterhead document

 

Importing existing PDF forms

In Inforama Studio it's possible to import and modify existing PDF forms. In this example Dividy Films have hired an external design company to create their application form. To import this form click the File – Import a document... menu item and the import dialog will appear as in figure 11.

 

Figure 11: Importing an existing PDF form

 

Select PDF as the Document type from the dropdown list and locate the PDF on the filesystem. The Import as field will automatically default to the current file name but this can be changed if you want to import the document under a different name. Click the Import button and the document will appear in the tree in the Documents frame and will open for editing in the main editor.

 

Figure 12: The imported PDF form

 

You can see that the PDF editor is similar to the one used when switching from the OpenOffice document earlier in this step. Once again, the PDF fields are listed in the Components frame on the bottom left of the Studio and data can be bound by double-clicking the fields in the Data frame. So we can go ahead and create the bindings as before and preview the document using the Letter manager dialog. The document will preview as shown below in figure 13.

 

Figure 13: Previewing the PDF form with merged data

 

Modifying PDF forms

In many cases the PDF documents which you import don't have form fields embedded within them or there may be more information which you would like to add. If this is the case then it's possible to add fields using Inforama Studio.

 

Figure 14: The PDF editor toolbar

 

Figure 14 shows the PDF editor toolbar which can be used to add and remove form fields

Item

Description

1

Zoom in on the PDF document

2

Zoom out from the PDF document

3

Select the page to edit in the document

4

Remove a component from the document

5

Unlock the document. If locked, components cannot be resized or moved

6

Add a text field to the document

7

Add a bar code to the document

8

Add an image to the document

9

Add a checkbox to the document

10

Preview the document


 

As an example imagine that the form needed an amendment to include the customer reference. Unlock the form by clicking toolbar button 5 above. Add a text field to the document by clicking toolbar button 6 and clicking the form where you want it to appear. Resize the text component and set the background and border colours.

 

Figure 15: The text component properties

 

Now create the binding with the following text.

 

Reference : $F{customerDS.customer_id}

Now preview the document and it will appear as shown in figure 16.

 

Figure 16: The custom text field previewing with merged data

4753 Views, 1 Attachments 1 Attachments

  • Comments
Copyright © 2008 - 2010