Preparing a PDF document
The action Fill PDF document is used for filling existing PDF forms. So that fields in the PDF form can be filled with content of a form element, the structure of the PDF document must be known. The easiest way to get to this information is to open the PDF form with the program, with which is has been created.
Another possibility is the use of the online tool PDFEscape. which you canfind under the following address: pdfescape.com. Here you can upload a PDF document and edit and analyse it. If you chose a form element in the PDF with the left-click, than you right-click to the opject properties. Here you can than consult and if necessary change the current name under name.
Preparation PDF
Fonts
All characters set for a form field in the PDF document must be available in the font set for this field. The font itself must be embedded in the PDF document as well. Additionally, you should validate all Xima® Formcycle form fields whether they contain any characters not supported by the font.
For example, when you only wish to support English, set a font for English and validate that all form field only contain letters, numbers, and punctuation; but not Chinese or Arabic characters etc.
Analyse PDF
Form fields in a PDF document have like in a Xima® Formcycle form all a certain name.
Open the PDF, which is to be filled, with a corresponding editor and note the name of the elements that you want to fill.
Radio buttons and checkboxes always have a value for on and off! The value for off is in general Off, see figure.
Assignment to form fields
Now the fields in the PDF document have to assign to a form element. There are two possibilities for this assignment (Mapping) between form field names and the PDF field names.
- In the PDF are the same field names used as in the form, e.g. s1 or tf1. If this pertains, no alterations of the form are necessary.
- If the field names in the PDF cannot be changed anymore, then an alias must be used for the form elements. These are allocated directly in the Xima® Formcycle Designer to an element on the right under properties. Indicate the name here, which is used in the PDF document.
Conversion of form values
The value of the form element of the type pick list is not the value that is displayed in the form. For a pick list on the right under properties text, value and title can be allocated in the Xima® Formcycle Designer. Text is the text that is displayed in the form for the user, value is the text that is used internally in the HTML and at the PDF filling.
To now use the text of text instead of the value, there are functions, similar to the action type Word (Fill). For example to display the text of text of the form element with the name sel1, you insert sel1-lsttxt in the PDF instead of sel1.
To use an available function, you part their name with a hyphen and add it to the name or rather the alias of the form element.
Conversion function
The following functions are available to change the values of the PDF.
Function | Description | Example | Explanation |
---|---|---|---|
lsttxt | For a form field of type selection, uses the text of the selected option instead of the value of the selection element. Stands for list text. | SEL1-lsttxt | Inserts the text of the selected option of the selection element named SEL1. |
lsttitle | Uses the value of the title attribute of a form field element instead of its value, if present. Stands for list title. | SEL1-lsttitle | Inserts the title of the selection element named SEL1. |
b64img | Interprets the value as a Base64 encoded image and inserts the image into the document. | edSig-b64img | Inserts the hand-written signature as an image. See the help pages on jSignature for how to enable hand-written signatures for forms. |
[+] | Makes it possible to connect the values of two form fields. Takes the part before and after the [+] and searches for form fields with those names. | FirstName[+]LastName | Connects the values of the form fields named FirstName and LastName. |
[br] | Inserts a line break \n. Must be used together with the operator [+]. | Word1[+][br][+]Word2[+][br][+]Word3 | Inserts the values of the form fields named Word1, Word2 und Word3, separated with a line break. |
[sp] | Inserts a space . Must be used together with the operator [+]. | Word1[+][sp][+]Word2[+][sp][+]Word3 | Inserts the values of the form fields named Word1, Word2 und Word3, separated with a space. |
[cb_] | Used with selection element that may have have multiple options selected. PDF specification require each option to have a unique name. This name must be the name of the Xima® Formcycle element suffixed with [cb_<index>]. For example, the names for the two options of a select element called sel1 should be sel1[cb_1] and sel1[cb_2]. | selChoice[cb_1] | The first option yes of a selection element named selChoice. |