Magic Smoke Label (Ticket/Voucher) Templates

Both tickets and vouchers are handled as labels by MagicSmoke.

The ticket template file must be called ticket.xtt.

The voucher template file must be called voucher.xtt.

Templates for labels are ZIP archive files that contain a description of the label layout as XML and all necessary pictures and optionally font files. The XML description must link all other resources in the archive file to make them visible to the system.

The description file must be called template.xml and must be in the root directory of the archive.

XML format

The template.xml file describes the painting operations that form the label. The operations are executed in the order that appears in the template file - that means an element that appears later in the file can erase an earlier element if it occupies the same position. The XML format looks like:

<LabelTemplate unit="mm|in|px" size="11 22">
  <LoadFont file="nameInsideArchive.ttf"/>
  <Picture file="nameInsideArchive.png" size="11 22" offset="33 44" smooth="1"/>
  <Text font="fontFamilyName" fontsize="sizeInPt" offset="11 22" size="33 44" align="left|right|center"
     valign="top|bottom|center" >some string with @VARIABLES@ to print</Text>
  <Barcode offset="11 22" size="33 44"/>
The elements are:
LabelTemplatethis is the document element, it describes the complete label (actually the current implementation ignores the name of this element)
LoadFontloads a font file (only TTF is supported) that is stored in the template ZIP file into the internal font database - it is removed from it after the label is rendered
Picturepaints a picture file that is stored in the template ZIP onto the label; a number of formats are supported, but it is recommended to use PNG; if size is present it is scaled first - it is recommended to scale, since different printers can have different resolutions and hence the picture will have different sizes; the default scaling algorithm is smooth
Textdescribes text that is rendered on the label
Barcodegenerates a code-39 barcode from the BARCODE variable and scales it onto the label

The attributes are
unitdescribes in what unit sizes and offsets are described in the template, possible values are "mm" (Millimeter), "in" (Inches); the default is "mm". All of them are allowed to use fractions.
sizedescribes the size the element is scaled to (or in the case of the complete label: its total size), it is two positive numbers separated by a space: "width height"
offsetdescribes the position of the element as "X Y" coordinates. They describe the distance from the upper left corner.
filea relative file name within the template ZIP file
smoothfor Pictures: describes whether the scaling should be done using edged (0) or smooth (1) scaling
fontcontains the name of a font family that is used for rendering the text (eg. "Helvetica"), the font is searched in the complete font database of the host
fontsizethe height of the text to render in pt (default is 10)
alignhorizontal alignment of the text: "left" starts the text at its offset, "right" places the text left of its offset, "center" puts the horizontal center of the text on the offset
valignvertical alignment of the text: "top" puts the text below its offset, "bottom" places the text above of its offset, "center" puts the vertical center of the text on the offset

Variables for Text elements are enclosed in "@" signs (eg. @VARNAME@).

Ticket Variables

The following variables exist for tickets:
TICKETIDthe ID of the ticket
PRICEthe price of the ticket
ROOMthe room of the tickets event
TITLEthe title of the tickets event
DATETIMEthe localized date and time when the event starts
ARTISTthe artist for this event
PRICECATEGORYthe price category name this ticket is in
PRICECATEGORYABBRthe abbreviation of the price category this ticket is in

Voucher Variables

The following variables exist for vouchers:
VOUCHERIDthe ID of the voucher
PRICEthe price of the voucher
VALUEthe remaining value of the voucher (the system does not store the initial value)