6.8. Encoding String
In an encoding environment, there are many parameters that must be configured in order to the
encoding to be performed correctly.
We have seen above how to set-up the hardware, a way to configure the formatting and
positioning of the data with sophisticated plugins, and now there's one thing left:
The user data that actually needs to be encoded on the card.
Since this data is different for each printed card, it is placed directly on the layout.
The encoding string has a special format that can be recognized by the printer driver. There are
several keywords that are reserved and required by the driver to determine what needs to be done.
The basic syntax of an encoding string is:
{pi="<pluginname>" [ft="<formattemplatename>"] [so="<n>"] [pre] [pid="<n>"]
[[field1="abcd"] [field2="732894732984"]...] }
Attributes in square brackets [...] are optional.
Attributes in pointy brackets <...> are mandatory.
Double quotes "..." must be present in the string
Double-quotes inside encoding data must be escaped with a backslash before the character, e.g.
when encoding the string
John "Doe" Wood
the attribute must look like:
{ pi=... field1="John \"Doe\" Wood" ...}
The encoding string always starts and ends with the curly brackets {...}, containing the encoding
information for one encoding. There may be multiple encoding strings on the layout, as described
in 6.6.
User Data
The "field1" and "field2" attributes contain the user data that will be encoded and must be named
according to the plugin and the used format template. There is no fixed naming convention, so
field1 may be Firstname or EmployeeNo or anything else except the reserved keywords (see
table below for a description).
The number of user data attributes depends on the plugin and the template format that is used for
the encoding string.
Since the encoding string is fixed in the layout, it is the responsibility of the application to replace
the variable user data on runtime, when printing the layout.
Many card managements and even other standard applications allow the replacement of
placeholders when a job is sent to the printer.
Since almost every application handles variable data in a different way, it is far beyond the scope
of this document to give instructions on how to do this. It is recommended to look up the
Prima 2e Driver Manual
Page 65 of 77