8.13 Using templates
Templates specify the locations of elements on your card layouts in a consistent and accurate way. Each template comprises a number of zones; each zone specifies a size and position for an element on the card layout. Each zone may also be associated with a field that associates the zone with a specific element.
For example, the template PIV Front may have a zone that contains the following information:
- x="3.0" – the element is positioned 3mm from the left of the card.
- y="5.0" – the element is positioned 5mm from the top of the card.
- w="26.7" – the element is 26.7mm wide.
- h="36.0" – the element is 36.0mm high.
- n="z1" – the internal unique ID of the zone.
- f="[[Image]]" – the zone is associated with the Image field – this is the user's photograph.
- 1 : Photo – the name of the zone as it appears in the drop-down list.
Note: The provided PIV Front template assumes you have the card in a vertical orientation, while the PIV Back template assumes you have the card in a horizontal orientation.
8.13.1 Applying zone settings
To apply a zone to an element:
-
Within the Card Layout Editor, select a template from the Template drop-down list.
For example, select PIV Front.
The Zone drop-down list and Apply this template to all items appear when you have a template selected.
-
Select an element on the card layout.
For example, select the user photograph.
-
From the Zone drop-down list, select the zone that corresponds to the element.
For example, select the 1 : Photo zone.
The Card Layout Editor positions and sizes the element as specified by the template. In the case of the user photo, this is 3mm from the left, 5mm from the top, 26.7mm wide and 36mm high.
The association of the element to the template and zone is stored with the card layout when you save it. You can override the size and position; the association is retained, and you can reset the element to the template settings by reselecting the zone from the Zone list.
To apply all the zones in a template:
-
Within the Card Layout Editor, select a template from the Template drop-down list.
For example, select PIV Front.
-
Click Apply this template to all items
.
The Card Layout Editor applies the settings of each zone in the template to the elements on the card layout.
The editor matches the template zone to the element based on the field content (for example, the user photograph) or the text content of text labels (for example, the Rank label). It cannot match any element that does not have a field or label; this means you must set the template zone for the photo border or name background manually.
8.13.2 Template XML structure
The templates are stored in the templates.xml file in the following folder:
C:\Program Files\Intercede\MyID\Web\
The XML uses the following format:
<?xml version="1.0" encoding="UTF-8"?> <templates> <template name="name"> <zone x="xpos" y="ypos" w="width" h="height" n="uniqueID" f="content" >zonelabel </zone> … </template> … </templates>
where:
-
template – a template. There may be multiple templates in the <templates> node. Each template may contain multiple zones. The template has the following attribute:
- name – the name of the template. This is displayed within the Card Layout Editor in the Template drop-down list.
-
zone – a zone on the card. The content of the node (the zonelabel) is displayed within the Card Layout Editor in Zone drop-down list. The zone has the following attributes:
- x – the position in mm from the left of the card. This may be between 0 and 200.
- y – the position in mm from the top of the card. This may be between 0 and 200.
- w – the width in mm of the element. This may be between 0 and 200.
- h – the height in mm of the element. This may be between 0 and 200.
- n – the unique identifier for the zone.
-
f – the content of the element. This may be a field (for example, [[Image]] for the user photograph; [[ExpiryDate]] for the card's expiry date) or the content of a text label (for example, Expires for the label next to the expiry date). If the element does not have any content, omit this attribute.
This attribute is used to match the template zone to the appropriate layout element.
8.13.2.1 Example templates.xml
<?xml version="1.0" encoding="UTF-8"?> <templates> <template name="PIV Front"> <zone x="3.0" y="5.0" w="26.7" h="36.0" n="z1" f="[[Image]]" >1 : Photo</zone> <zone x="3.2" y="41.5" w="51.5" h="5.0" n="z2a" f="[[Surname]]" >2a : Last Name</zone> <zone x="3.2" y="45.5" w="51.5" h="5.0" n="z2b" f="[[[FirstNameInitial]]]" >2b : First Name</zone> <zone x="2.5" y="51.0" w="49.0" h="7.0" n="z3" f="[[Xu16]]" >3 : Signature</zone> <zone x="2.5" y="2.5" w="27.5" h="2.5" n="z4" >4 : Miscellaneous</zone> <zone x="42.0" y="62.0" w="12.0" h="3.6" n="z5" f="[[Xu1]]" >5 : Rank</zone> <zone x="42.0" y="60.0" w="6.0" h="3.1" n="z5L" f="Rank" >5L : Rank Label</zone> <zone x="2.5" y="2.5" w="27.5" h="2.0" n="z6" >6 : 2D Barcode</zone> <zone x="32.0" y="22.1" w="25.7" h="3.4" n="z8" f="[[Xu53]]" >8 : Affiliation</zone> <zone x="32.0" y="20.0" w="15.0" h="3.1" n="z8L" f="Affiliation" >8L : Affiliation Label</zone> <zone x="2.5" y="2.5" w="27.8" h="2.5" n="z9" f="United States Government" >9 : Header</zone> <zone x="32.0" y="26.9" w="21.0" h="5.6" n="z10" f="[[GroupName]]" >10 : Organization</zone> <zone x="32.0" y="25.0" w="21.0" h="3.1" n="z10L" f="Agency / Department" >10L : Organization Label</zone> <zone x="31.2" y="20.5" w="20.0" h="20.0" n="z11" f="[[Xg18]]" >11 : Seal</zone> <zone x="2.5" y="81.3" w="49.0" h="4.3" n="z12" >12 : Footer</zone> <zone x="32.0" y="34.0" w="21.0" h="3.4" n="z13" f="[[[IssueDate]]]" >13 : Issued</zone> <zone x="32.0" y="32.0" w="21.0" h="3.1" n="z13L" f="Issued" >13L : Issued Label</zone> <zone x="32.0" y="38.5" w="21.0" h="3.4" n="z14" f="[[[ExpiryDate]]]" >14 : Expiration</zone> <zone x="32.0" y="36.5" w="21.0" h="3.1" n="z14L" f="Expires" >14L : Expiration Label</zone> <zone x="2.5" y="41.7" w="49.0" h="8.5" n="z15" >15 : Name background</zone> <zone x="2.5" y="4.5" w="27.7" h="37.0" n="z16" >16 : Photo Border</zone> <zone x="2.5" y="2.5" w="27.7" h="2.5" n="z17" >17 : Miscellaneous</zone> </template> <template name="PIV Back"> <zone x="20.0" y="48.5" w="22.0" h="3.0" n="z1" f="[[[SerialNumber]]]" >1 : Card number</zone> <zone x="43.0" y="48.5" w="22.0" h="3.0" n="z2" f="[[[IssuerID]]]" >2 : Issuer ID</zone> <zone x="2.5" y="32.0" w="32.5" h="6.0" n="z4" >4 : Return to</zone> <zone x="2.5" y="29.6" w="32.5" h="2.5" n="z4L" f="Return to:" >4L : Return to label</zone> <zone x="35.0" y="34.0" w="9.5" h="3.5" n="z5a" f="[[[Height]]]" >5 : Height</zone> <zone x="35.0" y="31.6" w="9.5" h="2.5" n="z5l" f="Height" >5L : Height Label</zone> <zone x="42.5" y="34.0" w="9.5" h="3.5" n="z5b" f="[[[EyeColor]]]" >5 : Eyes</zone> <zone x="42.5" y="31.6" w="9.5" h="2.5" n="z5m" f="Eyes" >5L : Eyes Label</zone> <zone x="50.0" y="34.0" w="9.5" h="3.5" n="z5c" f="[[[HairColor]]]" >5 : Hair</zone> <zone x="50.0" y="31.6" w="9.5" h="2.5" n="z5n" f="Hair" >5L : Hair Label</zone> <zone x="2.5" y="23.0" w="60.0" h="5.0" n="z6" >6 : Emgy Rspdr info</zone> <zone x="2.5" y="18.0" w="60.0" h="5.0" n="z7" >7 : Section 499</zone> <zone x="2.5" y="38.0" w="80.0" h="9.5" n="z8" >8 : Linear barcode</zone> </template> </templates>