Manually Creating New Templates
Predefined templates are defined by XML files located in ${prefix}/share/glabels/, where ${prefix} is usually something like /usr/local or /usr depending on the configuration option prefix. gLabels will use all files of the form *-templates.xml or *.template, that it finds in ${prefix}/share/glabels/ and ${HOME}/.glabels/. Additional templates can be added by creating additional *.template files in either of these directories.
The format for these files is defined in the DTD: glabels-2.2.dtd. (This DTD also describes other XML formats used by gLabels.)
- 6.1. Assumptions/caveats
- 6.2. Template Files
- 6.3. Example Template
- 6.4. Template Node
- 6.5. Label-rectangle Node
- 6.6. Label-round Node
- 6.7. Label-cd Node
- 6.8. Markup-margin Node
- 6.9. Markup-line Node
- 6.10. Markup-circle Node
- 6.11. Markup-rect Node
- 6.12. Layout Node
- 6.13. Alias Node
6.1. Assumptions/caveats
- A sheet contains only one size of label or card (if a sheet contains more than one size of item, it can be split into multiple templates for multiple pass printing)
- Distances can be expressed in units of pt, in, mm, cm, or pc. For example: "1.0in" or "2.54cm". If no units are specified, computer points (pt) will be assumed (1 pt = 1/72 in = 0.352778 mm).
6.3. Example Template
<Template brand="Avery" part="8160" size="US-Letter" description="Mailing Labels"> <Label-rectangle id="0" width="189pt" height="72pt" round="5pt"> <Markup-margin size="5pt"/> <Layout nx="3" ny="10" x0="11.25pt" y0="36pt" dx="200pt" dy="72pt"/> </Label-rectangle> <Alias brand="Avery" part="5160"/> <Alias brand="Avery" part="6233"/> </Template>
6.4. Template Node
A Template node describes a single stationary product. It must contain one instance of any type of Label node (Label-rectangle, Label-round, or Label-cd). This node can be followed by zero or more Alias nodes.
Property | Description |
---|---|
brand | Brand or manufacturer of stationary product. E.g. "Avery" |
part | Part number or name of stationary product. E.g. "8160" |
size | Size of sheet. E.g., "US-Letter," "A4", ... |
description | Description of stationary product. E.g, "Mailing Labels." |
_description | Translatable description of stationary product. E.g, "Mailing Labels." (Only useful for predefined templates) |
width | Page width. Only valid if size="Other" |
height | Page height. Only valid if size="Other" |
6.5. Label-rectangle Node
A Label-rectangle node describes the dimensions of a single label or business card that is rectangular in shape (may have rounded edges).
Property | Description |
---|---|
id | Reserved for future use. Should always be 0. |
width | Width of label/card |
height | Height of label/card |
round | Radius of corners. For items with square edges (business cards), the radius should be 0. |
x_waste | Amount of horizontal waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images). |
y_waste | Amount of vertical waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images). |
6.6. Label-round Node
A Label-round node describes the dimensions of a simple round label (not a CD).
Property | Description |
---|---|
id | Reserved for future use. Should always be 0. |
radius | Radius (1/2 diameter) of label |
waste | Amount of waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images). |
6.7. Label-cd Node
A Label-cd node describes the dimensions of a CD, DVD, or business card CD.
Property | Description |
---|---|
id | Reserved for future use. Should always be 0. |
radius | Outer radius of label |
hole | Radius of concentric hole |
width | If present, the label is clipped to the given width. (Useful for "business card CDs"). |
height | If present, the label is clipped to the given height. (Useful for "business card CDs"). |
waste | Amount of waste (over-print) to allow. This is useful for minimizing alignment problems when using non-white backgrounds (e.g. images). |
6.8. Markup-margin Node
A Markup-margin describes a margin along all edges of a label.
Property | Description |
---|---|
size | Size of the margin. I.e. the distance of the margin line from the edge of the card/label. |
6.9. Markup-line Node
A Markup-line describes a markup line.
Property | Description |
---|---|
x1 | x coordinate of 1st endpoint of the line segment. |
y1 | y coordinate of 1st endpoint of the line segment. |
x2 | x coordinate of 2nd endpoint of the line segment. |
y2 | y coordinate of 2nd endpoint of the line segment. |
6.10. Markup-circle Node
A Markup-circle describes a markup circle.
Property | Description |
---|---|
x0 | x coordinate of circle origin (center). |
y0 | y coordinate of circle origin (center). |
radius | Radius of circle. |
6.11. Markup-rect Node
A Markup-rect describes a markup rectangle.
Property | Description |
---|---|
x1 | x coordinate of upper left corner of rectangle. |
y1 | y coordinate of upper left corner of rectangle. |
w | Width of rectangle. |
h | Height of rectangle. |
r | Radius of rounded corners of rectangle. |
6.12. Layout Node
A label node may contain multiple Layout children. If labels are arranged in a simple grid pattern, only one layout is needed. However, if labels are arranged in multiple grids, such as a running bond pattern, multiple layout tags can be used. Note: a single label can always be treated as a grid of one.
Property | Description |
---|---|
nx | Number of labels/cards across in the grid (horizontal) |
ny | Number of labels/cards up and down in the grid (vertical) |
x0 | Distance from left edge of sheet to the left edge of the left column of cards/labels in the layout. |
y0 | Distance from the top edge of sheet to the top edge of the top row of labels/cards in the layout. |
dx | Horizontal pitch of grid. |
dy | Vertical pitch of grid. |