Create a Layout from a Predefined PDF Form

There're many PDF forms available online that you may want to use as layouts for the report data. For example, government forms that your company is required to submit. You can use these downloaded PDF files as the report layouts, supplying the XML data at runtime to fill in the report fields.

Some of these forms already have form fields defined, some don't. If the PDF form already has fields defined, then you can use one of the following methods to match the form field names to the data field names:

  • Use Adobe Acrobat Professional to rename the fields in the document to match the names of the elements in the XML data file.

  • Use BI Publisher's Data Model Editor to rename the XML element names in the data file to match the field names in the PDF form.

If the form fields are not already defined in the downloaded PDF, then you must create them.

Determine If a PDF Has Form Fields Defined

Follow these steps to determine if a PDF has form fields defined and to get a list of the field names.

  1. Open the document in Adobe Acrobat Professional.
  2. Click Highlight Fields. Form fields that exist in the document are highlighted.
  3. From the Form menu, select Add or Edit Fields. The field names display in the document as well as in the Fields pane.

Use a Predefined PDF Form as a Layout by Renaming the Form Fields

You can use a PDF form as a template for another form.

To use a predefined PDF form as a layout:

  1. Download or import the PDF file to the local system.
  2. Open the file in Adobe Acrobat Professional.
  3. From the Form menu, select Add or Edit Fields. This highlights text fields that have already been defined.

    The following illustration shows a sample W-2 PDF form after selecting Add or Edit Fields to highlight the text fields.

    To map the existing form fields to the data from the incoming XML file, rename the fields to match the element names in the XML file.

  4. Open the form field Text Field Properties dialog by either double-clicking the field, or by selecting the field then selecting Properties from the right-mouse menu.
  5. In the Name field, enter the element name from the input XML file.
  6. Repeat for all fields that you want populated by the data file.
  7. When all fields have been updated, click Close Form Editing.
  8. Save the layout.

Use the Comb of Characters Option

The comb of characters option for a PDF form field in Adobe Acrobat spreads the text evenly across the width of the text field.

Use this option when the form field requires the characters to be entered in specific positions, as the Routing number field shown in the following figure:

To use this feature, perform the following:

  1. In Adobe Acrobat Professional, add the form field as a text field. An example is shown in the following figure:

    Creating the routing form field

  2. Open the Text Field Properties dialog and click the Options tab. Clear all check boxes and select the Comb of characters check box.

    Note:

    The Comb of characters option is only enabled when all other options are cleared.
    Enter the number of characters in the text field. For the routing number example, a value of 9 is entered in the Comb of field as shown in the following figure:

    If your data may not contain the number of characters specified each time, you can set the Alignment option to specify whether the value will be aligned to the right, left, or center within the field.

When you run the report, the characters comprising the value for the routing field will be spread across the text field as shown in the following figure:

The following figure shows how the data will display in the field when the data for the routing field doesn't contain the full nine characters and the Alignment option is set to left: