1 <page xmlns="http://projectmallard.org/1.0/"
2 xmlns:e="http://projectmallard.org/experimental/"
3 xmlns:its="http://www.w3.org/2005/11/its"
8 <link type="guide" xref="index#advanced"/>
9 <revision pkgversion="3.0" version="0.1" date="2010-05-04" status="incomplete"/>
10 <revision pkgversion="3.0.1" version="0.1" date="2011-06-20" status="incomplete"/>
12 Create your templates manually.
14 <credit type="author">
15 <name>Jim Evins</name>
16 <email>evins@snaught.com</email>
18 <credit type="author">
19 <name>Mario Blättermann</name>
20 <email>mario.blaettermann@gmail.com</email>
23 <p>Creative Commons Share Alike 3.0</p>
27 <title>Manually creating new templates</title>
31 <!-- ****************** -->
32 <!-- BEGIN Introduction -->
33 <!-- ****************** -->
34 <p>This page is a reference guide to manually creating <app>gLabels</app> templates.
35 <app>gLabels</app> templates are defined in simple XML files as described in the DTD:
36 <link href="http://glabels.org/xmlns/2.3/glabels-2.3.dtd.txt">glabels-2.3.dtd</link>
37 (this DTD also describes other XML files used by <app>gLabels</app>).</p>
39 <p>Manually created template files should be placed in the <file>${HOME}/.glabels</file>
40 and be named with a <file>.template</file> extension.</p>
42 <note style="advanced">
43 <p><app>gLabels</app> searches for templates in several other locations as defined here:</p>
44 <table frame="all" rules="rows">
46 <td><p>Location</p></td>
47 <td><p>Description</p></td>
54 <td its:translate="no"><p><file>${prefix}/share/libglabels-3.0/templates</file></p></td>
55 <td><p>Predefined templates distributed with <app>gLabels</app>.</p>
56 <p><file>${prefix}</file> is usually <file>/usr</file> or <file>/usr/local</file>,
57 depending on where <app>gLabels</app> was installed.</p></td>
60 <td its:translate="no"><p><file>${XDG_CONFIG_HOME}/libglabels/templates</file></p></td>
61 <td><p>User defined templates created with the <app>gLabels</app> <gui>Template Designer</gui>.
62 <em>Do not put manually created templates in this directory.</em></p>
63 <p>If <file>${XDG_CONFIG_HOME}</file> is not defined, it defaults to
64 <file>${HOME}/.config</file>.</p></td>
67 <td its:translate="no"><p><file>${HOME}/.glabels</file></p></td>
68 <td><p>User defined templates that have been created manually should be placed in this
70 Older versions of the <app>gLabels</app> <gui>Template Designer</gui> (prior to 3.0)
71 would also put templates in this directory.</p></td>
76 <note><p>Completed template files can be sent to the
77 <app>gLabels</app> template
78 <link href="mailto:glabels-templates@lists.sourceforge.net">mailing list</link>
79 for possible inclusion in future versions of <app>gLabels</app>.</p>
81 <!-- ****************** -->
82 <!-- END Introduction -->
83 <!-- ****************** -->
86 <!-- ***************** -->
87 <!-- BEGIN Assumptions -->
88 <!-- ***************** -->
89 <section id="template-assumptions">
90 <title>Assumptions/caveats</title>
93 <p>A sheet contains only one size of label or card (if a sheet
94 contains more than one size of item, it can be split into
95 multiple templates for multiple pass printing)</p>
98 <p>Distances can be expressed in units of <code>pt</code>, <code>in</code>,
99 <code>mm</code>, <code>cm</code>, or <code>pc</code>. For example:
100 "<code>1.0in</code>" or "<code>2.54cm</code>". If no
101 units are specified, computer points (<code>pt</code>) will
102 be assumed (1 <em>pt</em> =
103 1/72 <em>in</em> = 0.352778 <em>mm</em>).
108 <!-- ***************** -->
109 <!-- END Assumptions -->
110 <!-- ***************** -->
114 <!-- ******************** -->
115 <!-- BEGIN Template Files -->
116 <!-- ******************** -->
117 <section id="template-file">
118 <title>Template Files</title>
120 <p>A template file contains a single <code>Glabels-templates</code> top-level
123 <code mime="text/xml">
124 <?xml version="1.0"?>
125 <Glabels-templates>
127 <var>...templates...</var>
129 </Glabels-templates></code>
132 <title>Example Template</title>
133 <desc>Example <app>gLabels</app> template file containing a single
134 <code>Template</code> node.</desc>
135 <code mime="text/xml" its:translate="no">
136 <?xml version="1.0"?>
137 <Glabels-templates>
139 <Template brand="Avery" part="8160" size="US-Letter" description="Mailing Labels">
140 <Meta category="label"/>
141 <Meta category="mail"/>
142 <Meta product_url="http://www.avery.com/avery/en_us/"/>
143 <Label-rectangle id="0" width="189pt" height="72pt" round="5pt">
144 <Markup-margin size="5pt"/>
145 <Layout nx="3" ny="10" x0="11.25pt" y0="36pt" dx="200pt" dy="72pt"/>
146 </Label-rectangle>
149 </Glabels-templates></code>
153 <!-- ******************** -->
154 <!-- END Template Files -->
155 <!-- ******************** -->
159 <!-- ******************** -->
160 <!-- BEGIN Template Node -->
161 <!-- ******************** -->
162 <section id="template-template-node">
163 <title><code>Template</code> Node</title>
165 <p>A <code>Template</code> node describes a single
166 stationery product. It must contain one instance of any type of Label node
167 (<code>Label-rectangle</code>,
168 <code>Label-round</code>, or
169 <code>Label-cd</code>).</p>
171 <table frame="all" rules="rows">
173 <td><p>Property</p></td> <td><p>Description</p></td>
176 <td><p></p></td> <td><p></p></td>
179 <td its:translate="no"><p><code>brand</code></p></td>
180 <td><p>Brand or manufacturer of stationery product. E.g. "Avery"</p></td>
183 <td its:translate="no"><p><code>part</code></p></td>
184 <td><p>Part number or name of stationery product. E.g. "8160"</p></td>
187 <td its:translate="no"><p><code>size</code></p></td>
188 <td><p>Size of sheet.
189 E.g., "<code>US-Letter</code>", "<code>A4</code>", ...
193 <td its:translate="no"><p><code>description</code></p></td>
194 <td><p>Description of stationery product. E.g, "Mailing Labels."</p></td>
197 <td its:translate="no"><p><code>_description</code></p></td>
198 <td><p>Translatable description of stationery product. E.g, "Mailing Labels."
199 (Only useful for predefined templates)</p></td>
202 <td its:translate="no"><p><code>width</code></p></td>
203 <td><p>Page width. Only valid if size="Other"</p></td>
206 <td its:translate="no"><p><code>height</code></p></td>
207 <td><p>Page height. Only valid if size="Other"</p></td>
210 <td its:translate="no"><p><code>equiv</code></p></td>
211 <td><p>Equivalent part number. If this property is present, the template
212 is a clone of another template of the same brand. The template will
213 inherit all properties, except brand and name from the other template.
214 This equiv property must refer to a previously defined template -
215 <app>gLabels</app> does not currently support forward references.</p></td>
220 <!-- ******************** -->
221 <!-- END Template Node -->
222 <!-- ******************** -->
225 <!-- ******************** -->
226 <!-- BEGIN Meta Node -->
227 <!-- ******************** -->
228 <section id="meta-template-node">
229 <title><code>Meta</code> Node</title>
231 <p>A <code>Meta</code> node contains some additional
232 information about the template. A <code>Template</code>
233 node may contain zero or more <code>Meta</code> nodes.</p>
235 <table frame="all" rules="rows">
237 <td><p>Subnode</p></td> <td><p>Description</p></td>
240 <td><p></p></td> <td><p></p></td>
243 <td its:translate="no"><p><code>category</code></p></td>
244 <td><p>A category for the template.
245 A template can belong to multiple categories by simply adding multiple
246 <code>Meta</code> nodes to the parent
247 <code>Template</code> node.
248 Template categories are used by the <app>gLabels</app> <gui>New Label
249 Dialog</gui> to filter the results of template searches.</p>
251 <p>The value of this category must match a predefined category ID defined in
252 the file <file>${prefix}/libglabels-3.0/templates/categories.xml</file>.
253 Currently defined category IDs include:</p>
255 <item its:translate="no"><p><code>label</code></p></item>
256 <item its:translate="no"><p><code>round-label</code></p></item>
257 <item its:translate="no"><p><code>elliptical-label</code></p></item>
258 <item its:translate="no"><p><code>square-label</code></p></item>
259 <item its:translate="no"><p><code>rectangle-label</code></p></item>
260 <item its:translate="no"><p><code>card</code></p></item>
261 <item its:translate="no"><p><code>business-card</code></p></item>
262 <item its:translate="no"><p><code>media</code></p></item>
263 <item its:translate="no"><p><code>mail</code></p></item>
264 <item its:translate="no"><p><code>foldable</code></p></item>
265 <item its:translate="no"><p><code>photo</code></p></item>
272 <td its:translate="no"><p><code>product_url</code></p></td>
273 <td><p>A URL pointing to the vendor's webpage for the specific product, if available.</p></td>
277 <note><p>Suggestions for additional categories can be sent to the
278 <app>gLabels</app> developer's
279 <link href="mailto:glabels-devel@lists.sourceforge.net">mailing list</link>.</p>
280 <p>Product URLs may be of limited use, because they may not be permanent.</p>
284 <!-- ******************** -->
285 <!-- END Meta Node -->
286 <!-- ******************** -->
289 <!-- ************************** -->
290 <!-- BEGIN Label-rectangle Node -->
291 <!-- ************************** -->
292 <section id="template-label-rectangle-node">
293 <title><code>Label-rectangle</code> Node</title>
295 <p>A <code>Label-rectangle</code> node describes the
296 dimensions of a single label or business card that is rectangular
297 in shape (may have rounded edges).</p>
299 <table frame="all" rules="rows">
301 <td><p>Property</p></td> <td><p>Description</p></td>
304 <td><p></p></td> <td><p></p></td>
307 <td its:translate="no"><p><code>id</code></p></td>
308 <td><p>Reserved for future use. Should always be 0.</p></td>
311 <td its:translate="no"><p><code>width</code></p></td>
312 <td><p>Width of label/card</p></td>
315 <td its:translate="no"><p><code>height</code></p></td>
316 <td><p>Height of label/card</p></td>
319 <td its:translate="no"><p><code>round</code></p></td>
320 <td><p>Radius of corners. For items with square edges (business cards),
321 the radius should be 0.</p></td>
324 <td its:translate="no"><p><code>x_waste</code></p></td>
325 <td><p>Amount of horizontal waste (over-print) to allow. This is useful
326 for minimizing alignment problems when using non-white
327 backgrounds (e.g. images).</p></td>
330 <td its:translate="no"><p><code>y_waste</code></p></td>
331 <td><p>Amount of vertical waste (over-print) to allow. This is useful
332 for minimizing alignment problems when using non-white
333 backgrounds (e.g. images).</p></td>
337 <!-- ==== Figure ==== -->
339 <desc><code>Label-rectangle</code> parameters</desc>
340 <media its:translate="no" type="image" src="figures/glabels-template-rect-label.png" mime="image/png" style="right">
341 <p><code>Label-rectangle</code> parameters</p>
344 <!-- ==== End of Figure ==== -->
347 <!-- ************************** -->
348 <!-- END Label-rectangle Node -->
349 <!-- ************************** -->
352 <!-- ************************ -->
353 <!-- BEGIN Label-ellipse Node -->
354 <!-- ************************ -->
355 <section id="template-label-ellipse-node">
356 <title><code>Label-ellipse</code> Node</title>
358 <p>A <code>Label-ellipse</code> node describes the
359 dimensions of a single label or business card that is elliptic
362 <table frame="all" rules="rows">
364 <td><p>Property</p></td> <td><p>Description</p></td>
367 <td><p></p></td> <td><p></p></td>
370 <td its:translate="no"><p><code>id</code></p></td>
371 <td><p>Reserved for future use. Should always be 0.</p></td>
374 <td its:translate="no"><p><code>width</code></p></td>
375 <td><p>Width of the ellipse</p></td>
378 <td its:translate="no"><p><code>height</code></p></td>
379 <td><p>Height of the ellipse</p></td>
382 <td its:translate="no"><p><code>waste</code></p></td>
383 <td><p>Amount of waste (over-print) to allow. This is useful
384 for minimizing alignment problems when using non-white
385 backgrounds (e.g. images).</p></td>
389 <!-- ==== Figure ==== -->
391 <desc><span>Label-ellipse</span> parameters</desc>
392 <media type="image" src="figures/glabels-template-ellipse-label.png" mime="image/png" style="right">
393 <p><code>Label-ellipse</code> parameters</p>
396 <!-- ==== End of Figure ==== -->
399 <!-- ************************ -->
400 <!-- END Label-ellipse Node -->
401 <!-- ************************ -->
404 <!-- ********************** -->
405 <!-- BEGIN Label-round Node -->
406 <!-- ********************** -->
407 <section id="template-label-round-node">
408 <title><code>Label-round</code> Node</title>
410 <p>A <code>Label-round</code> node describes the dimensions
411 of a simple round label (not a CD).</p>
413 <table frame="all" rules="rows">
415 <td><p>Property</p></td> <td><p>Description</p></td>
418 <td><p></p></td> <td><p></p></td>
421 <td its:translate="no"><p><code>id</code></p></td>
422 <td><p>Reserved for future use. Should always be 0.</p></td>
425 <td its:translate="no"><p><code>radius</code></p></td>
426 <td><p>Radius (1/2 diameter) of label</p></td>
429 <td its:translate="no"><p><code>waste</code></p></td>
430 <td><p>Amount of waste (over-print) to allow. This is useful
431 for minimizing alignment problems when using non-white
432 backgrounds (e.g. images).</p></td>
436 <!-- ==== Figure ==== -->
438 <desc><code>Label-ellipse</code> parameters</desc>
439 <media its:translate="no" type="image" src="figures/glabels-template-circle-label.png" mime="image/png" style="right">
440 <p><code>Label-ellipse</code> parameters</p>
443 <!-- ==== End of Figure ==== -->
446 <!-- ********************** -->
447 <!-- END Label-round Node -->
448 <!-- ********************** -->
451 <!-- ******************* -->
452 <!-- BEGIN Label-cd Node -->
453 <!-- ******************* -->
454 <section id="template-label-cd-node">
455 <title><code>Label-cd</code> Node</title>
457 <p>A <code>Label-cd</code> node describes the dimensions
458 of a CD, DVD, or business card CD.</p>
460 <table frame="all" rules="rows">
462 <td><p>Property</p></td> <td><p>Description</p></td>
465 <td><p></p></td> <td><p></p></td>
468 <td its:translate="no"><p><code>id</code></p></td>
469 <td><p>Reserved for future use. Should always be 0.</p></td>
472 <td its:translate="no"><p><code>radius</code></p></td>
473 <td><p>Outer radius of label</p></td>
476 <td its:translate="no"><p><code>hole</code></p></td>
477 <td><p>Radius of concentric hole</p></td>
480 <td its:translate="no"><p><code>width</code></p></td>
481 <td><p>If present, the label is clipped to the given width.
482 (Useful for "business card CDs").</p></td>
485 <td its:translate="no"><p><code>height</code></p></td>
486 <td><p>If present, the label is clipped to the given height.
487 (Useful for "business card CDs").</p></td>
490 <td its:translate="no"><p><code>waste</code></p></td>
491 <td><p>Amount of waste (over-print) to allow. This is useful
492 for minimizing alignment problems when using non-white
493 backgrounds (e.g. images).</p></td>
497 <!-- ==== Figure ==== -->
499 <desc><code>Label-cd</code> parameters</desc>
500 <media its:translate="no" type="image" src="figures/glabels-template-cd-label.png" mime="image/png" style="right">
501 <p>CD label parameters</p>
504 <!-- ==== End of Figure ==== -->
507 <!-- ******************* -->
508 <!-- END Label-cd Node -->
509 <!-- ******************* -->
512 <!-- ***************** -->
513 <!-- BEGIN Markup Node -->
514 <!-- ***************** -->
515 <section id="template-markup">
516 <title><code>Markup</code> Nodes</title>
518 <p>Templates may contain optional markup nodes. These nodes are used to describe
519 a simple set of markup lines that are visible in the <app>glabels</app> drawing canvas, but
520 not visible when printed. These lines can represent margins, fold lines, center lines,
521 special areas, or other helpful hints to the user of a template.</p>
524 <!-- ======================== -->
525 <!-- BEGIN Markup-margin Node -->
526 <!-- ======================== -->
527 <section id="template-markup-margin-node">
528 <title><code>Markup-margin</code> Node</title>
530 <p>A <code>Markup-margin</code> describes a margin along
531 all edges of a label.</p>
533 <table frame="all" rules="rows">
535 <td><p>Property</p></td> <td><p>Description</p></td>
538 <td><p></p></td> <td><p></p></td>
541 <td its:translate="no"><p><code>size</code></p></td>
542 <td><p>Size of the margin. I.e. the distance of the margin
543 line from the edge of the card/label.</p></td>
547 <!-- ======================== -->
548 <!-- END Markup-margin Node -->
549 <!-- ======================== -->
552 <!-- ====================== -->
553 <!-- BEGIN Markup-line Node -->
554 <!-- ====================== -->
555 <section id="template-markup-line-node">
556 <title><code>Markup-line</code> Node</title>
558 <p>A <code>Markup-line</code> node describes a markup line.</p>
560 <table frame="all" rules="rows">
562 <td><p>Property</p></td> <td><p>Description</p></td>
565 <td><p></p></td> <td><p></p></td>
568 <td its:translate="no"><p><code>x1</code></p></td>
569 <td><p>x coordinate of 1st endpoint of the line segment.</p></td>
572 <td its:translate="no"><p><code>y1</code></p></td>
573 <td><p>y coordinate of 1st endpoint of the line segment.</p></td>
576 <td its:translate="no"><p><code>x2</code></p></td>
577 <td><p>x coordinate of 2nd endpoint of the line segment.</p></td>
580 <td its:translate="no"><p><code>y2</code></p></td>
581 <td><p>y coordinate of 2nd endpoint of the line segment.</p></td>
585 <!-- ====================== -->
586 <!-- END Markup-line Node -->
587 <!-- ====================== -->
590 <!-- ======================== -->
591 <!-- BEGIN Markup-circle Node -->
592 <!-- ======================== -->
593 <section id="template-markup-circle-node">
594 <title><code>Markup-circle</code> Node</title>
596 <p>A <code>Markup-circle</code> describes a markup circle.</p>
598 <table frame="all" rules="rows">
600 <td><p>Property</p></td> <td><p>Description</p></td>
603 <td><p></p></td> <td><p></p></td>
606 <td its:translate="no"><p><code>x0</code></p></td>
607 <td><p>x coordinate of circle origin (center).</p></td>
610 <td its:translate="no"><p><code>y0</code></p></td>
611 <td><p>y coordinate of circle origin (center).</p></td>
614 <td its:translate="no"><p><code>radius</code></p></td>
615 <td><p>Radius of circle.</p></td>
619 <!-- ======================== -->
620 <!-- END Markup-circle Node -->
621 <!-- ======================== -->
624 <!-- ====================== -->
625 <!-- BEGIN Markup-rect Node -->
626 <!-- ====================== -->
627 <section id="template-markup-rect-node">
628 <title><code>Markup-rect</code> Node</title>
630 <p>A <code>Markup-rect</code> describes a markup rectangle.</p>
632 <table frame="all" rules="rows">
634 <td><p>Property</p></td> <td><p>Description</p></td>
637 <td><p></p></td> <td><p></p></td>
640 <td its:translate="no"><p><code>x1</code></p></td>
641 <td><p>x coordinate of upper left corner of rectangle.</p></td>
644 <td its:translate="no"><p><code>y1</code></p></td>
645 <td><p>y coordinate of upper left corner of rectangle.</p></td>
648 <td its:translate="no"><p><code>w</code></p></td>
649 <td><p>Width of rectangle.</p></td>
652 <td its:translate="no"><p><code>h</code></p></td>
653 <td><p>Height of rectangle.</p></td>
656 <td its:translate="no"><p><code>r</code></p></td>
657 <td><p>Radius of rounded corners of rectangle.</p></td>
661 <!-- ====================== -->
662 <!-- END Markup-rect Node -->
663 <!-- ====================== -->
666 <!-- ========================= -->
667 <!-- BEGIN Markup-ellipse Node -->
668 <!-- ========================= -->
669 <section id="template-markup-ellipse-node">
670 <title><code>Markup-ellipse</code> Node</title>
672 <p>A <code>Markup-ellipse</code> describes a markup ellipse.</p>
674 <table frame="all" rules="rows">
676 <td><p>Property</p></td> <td><p>Description</p></td>
679 <td><p></p></td> <td><p></p></td>
682 <td its:translate="no"><p><code>x1</code></p></td>
683 <td><p>x coordinate of upper left corner of ellipse.</p></td>
686 <td its:translate="no"><p><code>y1</code></p></td>
687 <td><p>y coordinate of upper left corner of ellipse.</p></td>
690 <td its:translate="no"><p><code>w</code></p></td>
691 <td><p>Width of ellipse.</p></td>
694 <td its:translate="no"><p><code>h</code></p></td>
695 <td><p>Height of ellipse.</p></td>
699 <!-- ========================= -->
700 <!-- END Markup-ellipse Node -->
701 <!-- ========================= -->
704 <!-- ***************** -->
705 <!-- END Markup Node -->
706 <!-- ***************** -->
709 <!-- ***************** -->
710 <!-- BEGIN Layout Node -->
711 <!-- ***************** -->
712 <section id="template-layout-node">
713 <title><code>Layout</code> Node</title>
715 <p>A label node may contain multiple <code>Layout</code>
716 children. If labels are arranged in a simple grid pattern, only
717 one layout is needed. However, if labels are arranged in multiple
718 grids, such as a running bond pattern, multiple
719 <code>Layout</code> tags can be used.</p>
720 <p>A common example for multiple layouts is a sheet with three
723 <!-- ==== Figure ==== -->
725 <desc>CD label sheet</desc>
726 <media its:translate="no" type="image" src="figures/layouts-cdlabel.png" mime="image/png" style="right">
727 <p>CD label sheet</p>
730 <!-- ==== End of Figure ==== -->
732 <p>The two labels on the left edge can be assigned to a grid, assuming we
733 can define the coordinates for the top left label and the distance to
734 the second label properly. The distance to the left edge is common to
735 these labels. The third one on the right edge has no common distance
736 values with the other ones, that's why we have to define a second layout,
737 with unique coordinates for the top left corner of that label.</p>
740 <p>You can define multiple layouts only if the labels on the sheet
741 have the same shape. If your sheet contains different shapes, you have
742 to define each shape in another template separately. Future versions
743 of <app>gLabels</app> will probably be able to concatenate such sheets
744 with different shapes within a single template.</p>
748 <p>A single label can always be treated as a grid of one.</p>
751 <table frame="all" rules="rows">
753 <td><p>Property</p></td> <td><p>Description</p></td>
756 <td><p></p></td> <td><p></p></td>
759 <td its:translate="no"><p><code>nx</code></p></td>
760 <td><p>Number of labels/cards across in the grid (horizontal)</p></td>
763 <td its:translate="no"><p><code>ny</code></p></td>
764 <td><p>Number of labels/cards across in the grid (vertical)</p></td>
767 <td its:translate="no"><p><code>x0</code></p></td>
768 <td><p>Distance from left edge of sheet to the left edge of
769 the left column of cards/labels in the layout.</p></td>
772 <td its:translate="no"><p><code>y0</code></p></td>
773 <td><p>Distance from the top edge of sheet to the top edge of
774 the top row of labels/cards in the layout.</p></td>
777 <td its:translate="no"><p><code>dx</code></p></td>
778 <td><p>Horizontal pitch of grid.</p></td>
781 <td its:translate="no"><p><code>dy</code></p></td>
782 <td><p>Vertical pitch of grid.</p></td>
786 <!-- ==== Figure ==== -->
788 <desc><code>Layout</code> parameters</desc>
789 <media its:translate="no" type="image" src="figures/glabels-template-layout.png" mime="image/png" style="right">
790 <p><span>Layout</span> Parameters</p>
793 <!-- ==== End of Figure ==== -->
796 <!-- ***************** -->
797 <!-- END Layout Node -->
798 <!-- ***************** -->