Tech Tip: Filling out a Table on a PDF Form
By: Sarah Seene
Laserfiche Workflow automates repeatable processes with great precision and speed. It particularly excels at transferring data so that it’s displayed in the most accessible format. With the Fill Out PDF Form activity, you can write metadata, Laserfiche Form field values, information from data sources, and more to a PDF form. If you have information that needs to be displayed in a table on the PDF form, the Table tab of the Fill Out PDF Form can insert values into the table from multi-value tokens.
Example: Invoices are stored in Company ABC’s repository as fillable PDF Forms. A Laserfiche field on each invoice contains a list of all the items purchased. The price for each item needs to be retrieved from the company database, and a table in the PDF form needs to be populated with the items in one column and the prices in another.
Company ABC built the following workflow:
- Retrieve Field Values gets the contents of the “Items” field in a multi-value token.
- Assign Token Values creates a “Prices” token that will hold the prices from the company database.
- For Each Value goes through each item in the “Items” token and the Query Database activity finds the corresponding price.
Note: For a large scale deployment, use a Custom Query activity to reduce the number of calls to the database.
- Assign Token Values stores the price in the multi-value “Prices” token.
- Fill Out PDF Form fills out a PDF Form table with each item and price.
To fill out multiple fields in a PDF with values from a multi-value token, select the Table tab.
- Under Name, type a name for the group of PDF fields you want to fill out. As you type a name, the Pattern column will try to guess which fields you want filled out with the multi-value token’s values.
- Under Pattern, change the pre-configured regular expression or type a new regular expression that specifies which PDF fields will be filled out. The pre-configured regular expression expects the fields in a column to have the same name and to be numbered sequentially (i.e., Field_1, Field_2, Field_3, etc.). The PDF table’s fields must have unique names for a regular expression to return multiple fields. Click the Regular Expression button to choose from a list of regular expression symbols.
- The Fields Included in Current Group section of this dialog box shows the fields with names that satisfy the pattern you typed into the Pattern
- Under Value, use the Token button (right arrow) to select a multi-value token. Each value in the token will be used, one after another, to fill out the fields listed in the Fields Included in Current Group.
Example: Each value in the “RetrieveFieldValues_Item_All” token will be inserted on a separate line in the Item column in the PDF form. Each value in the “Price List” token will be inserted on a separate line of the Price column in the PDF form.
- Optional: Select the box under All Pages to retrieve fields that match the specified pattern from all pages instead of only the current page. Clear this box to only retrieve fields from the current page.
- If the values do not appear in the PDF after testing the workflow, select Align field data in the Advanced section of the Fill Out PDF Form activity’s properties.
For more information, see the Fill Out PDF Form topic in the Workflow help files.