Filling PDF Forms

PDF forms which contain fillable fields can be populated with XpressDox data

PDF documents which have been prepared with PDF Form Fields (using a suitable PDF Form editor) can be filled with data captured with an XpressDox interview. In fact, the PDF form can be filled with data from ANY source, as long as it is in XML form.

 

 

First prepare the PDF

  • From the XpressDox ribbon, click Useful Tools>Prepare PDF
  • Select your PDF form (one with fillable fields, not a flat PDF)
  • You will see some columns, including the PDF form field # and the Internal name (the name inside the PDF).
  • Initially the internal name of the PDF form field will be assigned as the data element name in the first column but the point of this step is to map XpressDox data elements to the form fields in the PDF. Often the PDF form field names are not very friendly.
  • You can set data element names for  the fields by clicking in the data element name field itself on the Prepare PDF form and assign the name you would like (much as you would rename a file in the Windows Explorer).
  • Aside from data element names you could also assign scripts, function names and XPATH expressions in the field map, as described here. This feature was introduced with version 11.4.

 

 

Identifying those fields!

Sometimes you will be preparing a PDF form which has been authored by someone in a different organization (e.g. you may be preparing some or other government PDF form for filling with XpressDox) and it may be that the fields are not named in a way that lets you see how the fields appear on the PDF form.

  • Click the checkbox to “Identify fields” (as pictured below) and then “Open in PDF viewer”

XpressDox Document Automation can fillable PDF

 

  • You will then see the form in a PDF viewer, and the fields will be identified i.e. the internal name will be identified at the position in the form. As you change the Unfortunately, there is no easy way like this to identify fields like check boxes and radio buttons, so at worst these will have to be named and tested and identified by trial and error.
  • Close the PDF viewer, make changes in the XpressDox Prepare PDF form, and then Open the PDF viewer again to test where the fields have been positioned.
  • Clicking OK on the form will prompt you to save changes; you can return to the form to continue changes if you are not yet done.

 

 

Using a CSV file to import/export data element names

Should you find it easier to do so, data element names can be changed in a csv file. Right click on any one of the data element names and then click on Export to csv. Make your changes, save your file, and then right click again to Import.

 

 

Create your XpressDox template

Now click “Create Interview Template”, as shown below, to create the XpressDox template which will merge the PDF form.

 

XpressDox Document Automation can fillable PDF

A new template, which contains a set of XpressDox «Define()» commands, will be created. One Define command will be created for each of the elements from the Prepare PDF Utility, and will contain a set of attributes about the data element. This is particularly useful for arriving at the correct definition of what is required for check box and radio button controls, but they can be tweaked if necessary. The interview can be improved (Manage Interview is a good tool here), you can use all the normal techniques of IncludeTemplate etc.

 

 

MergePDFForm

On the template that has been created you will find a «MergePDFForm()» function.  This function enables you to indicate the name of the PDF form file to be filled, and optionally the name of the file with which the merged result must be saved.  For example:

«MergePDFForm(‘Declaration by Purchaser’)»

and/or

«MergePDFForm(‘Declaration by Purchaser’, ‘Declaration by Purchaser – Merged’)»

The actual location of the PDF files is governed by the XpressDox configuration in the same way as the source and location XpressDox templates and assembled files is controlled.

Note that the name of the PDF form as well as the output merged field name are in quotes. This is because MergePDFForm is a function. It has the powerful benefit that the names of those two files can be constructed at template run time using XpressDox conditional logic. For example «MergePDFForm(concat(‘Declaration by ’, PartyType))»

 

 

Using scripts in a PDF form

Scripts can be used in PDF forms, however they have to be saved in a “PDFScripts.xdtpx” file. This is explained in more detail here.

 

 

Backups are created

You will notice that several versions of your PDF form are created. A backup (the original), and an -xdidentity (a version that contains the identified fields)