pdf-labels 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. data/History.txt +8 -0
  2. data/LICENCE +38 -0
  3. data/Manifest.txt +141 -0
  4. data/README.txt +72 -0
  5. data/Rakefile +30 -0
  6. data/lib/alias.rb +8 -0
  7. data/lib/glabel_template.rb +36 -0
  8. data/lib/label.rb +52 -0
  9. data/lib/layout.rb +13 -0
  10. data/lib/length_node.rb +47 -0
  11. data/lib/markup.rb +25 -0
  12. data/lib/pdf_label_page.rb +171 -0
  13. data/lib/pdf_labels.rb +6 -0
  14. data/lib/template.rb +37 -0
  15. data/templates/avery-iso-templates.xml +222 -0
  16. data/templates/avery-other-templates.xml +21 -0
  17. data/templates/avery-us-templates.xml +599 -0
  18. data/templates/glabels-2.0.dtd +329 -0
  19. data/templates/misc-iso-templates.xml +434 -0
  20. data/templates/misc-other-templates.xml +21 -0
  21. data/templates/misc-us-templates.xml +183 -0
  22. data/templates/paper-sizes.xml +37 -0
  23. data/templates/zweckform-iso-templates.xml +197 -0
  24. data/test/test_pdf_label_page.rb +91 -0
  25. data/vendor/color.rb +87 -0
  26. data/vendor/color/cmyk.rb +182 -0
  27. data/vendor/color/css.rb +27 -0
  28. data/vendor/color/grayscale.rb +135 -0
  29. data/vendor/color/hsl.rb +130 -0
  30. data/vendor/color/palette.rb +15 -0
  31. data/vendor/color/palette/gimp.rb +107 -0
  32. data/vendor/color/palette/monocontrast.rb +180 -0
  33. data/vendor/color/rgb-colors.rb +189 -0
  34. data/vendor/color/rgb.rb +311 -0
  35. data/vendor/color/rgb/metallic.rb +28 -0
  36. data/vendor/color/yiq.rb +78 -0
  37. data/vendor/pdf/charts.rb +13 -0
  38. data/vendor/pdf/charts/stddev.rb +433 -0
  39. data/vendor/pdf/grid.rb +135 -0
  40. data/vendor/pdf/math.rb +108 -0
  41. data/vendor/pdf/pagenumbers.rb +288 -0
  42. data/vendor/pdf/quickref.rb +331 -0
  43. data/vendor/pdf/simpletable.rb +947 -0
  44. data/vendor/pdf/techbook.rb +901 -0
  45. data/vendor/pdf/writer.rb +2801 -0
  46. data/vendor/pdf/writer/arc4.rb +63 -0
  47. data/vendor/pdf/writer/fontmetrics.rb +202 -0
  48. data/vendor/pdf/writer/fonts/Courier-Bold.afm +342 -0
  49. data/vendor/pdf/writer/fonts/Courier-BoldOblique.afm +342 -0
  50. data/vendor/pdf/writer/fonts/Courier-Oblique.afm +342 -0
  51. data/vendor/pdf/writer/fonts/Courier.afm +342 -0
  52. data/vendor/pdf/writer/fonts/Helvetica-Bold.afm +2827 -0
  53. data/vendor/pdf/writer/fonts/Helvetica-BoldOblique.afm +2827 -0
  54. data/vendor/pdf/writer/fonts/Helvetica-Oblique.afm +3051 -0
  55. data/vendor/pdf/writer/fonts/Helvetica.afm +3051 -0
  56. data/vendor/pdf/writer/fonts/Symbol.afm +213 -0
  57. data/vendor/pdf/writer/fonts/Times-Bold.afm +2588 -0
  58. data/vendor/pdf/writer/fonts/Times-BoldItalic.afm +2384 -0
  59. data/vendor/pdf/writer/fonts/Times-Italic.afm +2667 -0
  60. data/vendor/pdf/writer/fonts/Times-Roman.afm +2419 -0
  61. data/vendor/pdf/writer/fonts/ZapfDingbats.afm +225 -0
  62. data/vendor/pdf/writer/graphics.rb +813 -0
  63. data/vendor/pdf/writer/graphics/imageinfo.rb +365 -0
  64. data/vendor/pdf/writer/lang.rb +44 -0
  65. data/vendor/pdf/writer/lang/en.rb +104 -0
  66. data/vendor/pdf/writer/object.rb +23 -0
  67. data/vendor/pdf/writer/object/action.rb +40 -0
  68. data/vendor/pdf/writer/object/annotation.rb +42 -0
  69. data/vendor/pdf/writer/object/catalog.rb +39 -0
  70. data/vendor/pdf/writer/object/contents.rb +69 -0
  71. data/vendor/pdf/writer/object/destination.rb +40 -0
  72. data/vendor/pdf/writer/object/encryption.rb +53 -0
  73. data/vendor/pdf/writer/object/font.rb +68 -0
  74. data/vendor/pdf/writer/object/fontdescriptor.rb +34 -0
  75. data/vendor/pdf/writer/object/fontencoding.rb +40 -0
  76. data/vendor/pdf/writer/object/image.rb +308 -0
  77. data/vendor/pdf/writer/object/info.rb +79 -0
  78. data/vendor/pdf/writer/object/outline.rb +30 -0
  79. data/vendor/pdf/writer/object/outlines.rb +30 -0
  80. data/vendor/pdf/writer/object/page.rb +195 -0
  81. data/vendor/pdf/writer/object/pages.rb +115 -0
  82. data/vendor/pdf/writer/object/procset.rb +46 -0
  83. data/vendor/pdf/writer/object/viewerpreferences.rb +74 -0
  84. data/vendor/pdf/writer/ohash.rb +58 -0
  85. data/vendor/pdf/writer/oreader.rb +25 -0
  86. data/vendor/pdf/writer/state.rb +48 -0
  87. data/vendor/pdf/writer/strokestyle.rb +140 -0
  88. data/vendor/transaction/simple.rb +693 -0
  89. data/vendor/transaction/simple/group.rb +133 -0
  90. data/vendor/transaction/simple/threadsafe.rb +52 -0
  91. data/vendor/transaction/simple/threadsafe/group.rb +23 -0
  92. data/vendor/xml-mapping/ChangeLog +128 -0
  93. data/vendor/xml-mapping/LICENSE +56 -0
  94. data/vendor/xml-mapping/README +386 -0
  95. data/vendor/xml-mapping/README_XPATH +175 -0
  96. data/vendor/xml-mapping/Rakefile +214 -0
  97. data/vendor/xml-mapping/TODO.txt +32 -0
  98. data/vendor/xml-mapping/doc/xpath_impl_notes.txt +119 -0
  99. data/vendor/xml-mapping/examples/company.rb +34 -0
  100. data/vendor/xml-mapping/examples/company.xml +26 -0
  101. data/vendor/xml-mapping/examples/company_usage.intin.rb +19 -0
  102. data/vendor/xml-mapping/examples/company_usage.intout +39 -0
  103. data/vendor/xml-mapping/examples/order.rb +61 -0
  104. data/vendor/xml-mapping/examples/order.xml +54 -0
  105. data/vendor/xml-mapping/examples/order_signature_enhanced.rb +7 -0
  106. data/vendor/xml-mapping/examples/order_signature_enhanced.xml +9 -0
  107. data/vendor/xml-mapping/examples/order_signature_enhanced_usage.intin.rb +12 -0
  108. data/vendor/xml-mapping/examples/order_signature_enhanced_usage.intout +16 -0
  109. data/vendor/xml-mapping/examples/order_usage.intin.rb +73 -0
  110. data/vendor/xml-mapping/examples/order_usage.intout +147 -0
  111. data/vendor/xml-mapping/examples/time_augm.intin.rb +19 -0
  112. data/vendor/xml-mapping/examples/time_augm.intout +23 -0
  113. data/vendor/xml-mapping/examples/time_node.rb +27 -0
  114. data/vendor/xml-mapping/examples/xpath_create_new.intin.rb +85 -0
  115. data/vendor/xml-mapping/examples/xpath_create_new.intout +181 -0
  116. data/vendor/xml-mapping/examples/xpath_docvsroot.intin.rb +30 -0
  117. data/vendor/xml-mapping/examples/xpath_docvsroot.intout +34 -0
  118. data/vendor/xml-mapping/examples/xpath_ensure_created.intin.rb +62 -0
  119. data/vendor/xml-mapping/examples/xpath_ensure_created.intout +114 -0
  120. data/vendor/xml-mapping/examples/xpath_pathological.intin.rb +42 -0
  121. data/vendor/xml-mapping/examples/xpath_pathological.intout +56 -0
  122. data/vendor/xml-mapping/examples/xpath_usage.intin.rb +51 -0
  123. data/vendor/xml-mapping/examples/xpath_usage.intout +57 -0
  124. data/vendor/xml-mapping/install.rb +40 -0
  125. data/vendor/xml-mapping/lib/xml/mapping.rb +14 -0
  126. data/vendor/xml-mapping/lib/xml/mapping/base.rb +571 -0
  127. data/vendor/xml-mapping/lib/xml/mapping/standard_nodes.rb +343 -0
  128. data/vendor/xml-mapping/lib/xml/mapping/version.rb +8 -0
  129. data/vendor/xml-mapping/lib/xml/xxpath.rb +354 -0
  130. data/vendor/xml-mapping/test/all_tests.rb +6 -0
  131. data/vendor/xml-mapping/test/company.rb +56 -0
  132. data/vendor/xml-mapping/test/documents_folders.rb +33 -0
  133. data/vendor/xml-mapping/test/fixtures/bookmarks1.xml +24 -0
  134. data/vendor/xml-mapping/test/fixtures/company1.xml +85 -0
  135. data/vendor/xml-mapping/test/fixtures/documents_folders.xml +71 -0
  136. data/vendor/xml-mapping/test/fixtures/documents_folders2.xml +30 -0
  137. data/vendor/xml-mapping/test/multiple_mappings.rb +80 -0
  138. data/vendor/xml-mapping/test/tests_init.rb +2 -0
  139. data/vendor/xml-mapping/test/xml_mapping_adv_test.rb +84 -0
  140. data/vendor/xml-mapping/test/xml_mapping_test.rb +201 -0
  141. data/vendor/xml-mapping/test/xpath_test.rb +273 -0
  142. metadata +191 -0
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0"?>
2
+ <Glabels-templates xmlns="http://snaught.com/glabels/2.0/">
3
+
4
+
5
+ <!-- ******************************************************************** -->
6
+ <!-- Avery non-standard size products (not US-Letter/Legal or ISO) -->
7
+ <!-- ******************************************************************** -->
8
+
9
+ <!-- =================================================================== -->
10
+ <!-- OfficeMax 86112: Multi-Purpose Labels, 2'' x 4'', 3 per sheet -->
11
+ <!-- =================================================================== -->
12
+ <Template name="OfficeMax 86112" size="Other" width="297pt" height="450pt"
13
+ description="Multi-Purpose Labels">
14
+ <Label-rectangle id="0" width="288pt" height="144pt" round="9pt" waste="0pt">
15
+ <Markup-margin size="9pt"/>
16
+ <Layout nx="1" ny="3" x0="4.5pt" y0="3.6pt" dx="288pt" dy="148.5pt"/>
17
+ </Label-rectangle>
18
+ </Template>
19
+
20
+
21
+ </Glabels-templates>
@@ -0,0 +1,183 @@
1
+ <?xml version="1.0"?>
2
+ <Glabels-templates>
3
+
4
+
5
+
6
+ <!-- ******************************************************************** -->
7
+ <!-- Misc. US-Letter products. -->
8
+ <!-- ******************************************************************** -->
9
+
10
+ <!-- =================================================================== -->
11
+ <!-- Southworth BC: Business Cards, 2'' x 3_1/2'', 10 per sheet -->
12
+ <!-- =================================================================== -->
13
+ <Template name="Southworth BC" size="US-Letter" _description="Business Cards">
14
+ <Label-rectangle id="0" width="252" height="144" round="0">
15
+ <Markup-margin size="5"/>
16
+ <Layout nx="2" ny="5" x0="36" y0="36" dx="288" dy="144"/>
17
+ </Label-rectangle>
18
+ </Template>
19
+
20
+ <!-- =================================================================== -->
21
+ <!-- Memorex CD Labels * -->
22
+ <!-- =================================================================== -->
23
+ <Template name="Memorex CD Labels" size="US-Letter"
24
+ _description="CD/DVD Labels">
25
+ <Label-cd id="0" radius="166.5" hole="58.5" waste="5">
26
+ <Markup-margin size="5"/>
27
+ <Layout nx="1" ny="1" x0="40.5" y0="45" dx="0" dy="0"/>
28
+ <Layout nx="1" ny="1" x0="238.5" y0="414" dx="0" dy="0"/>
29
+ </Label-cd>
30
+ </Template>
31
+
32
+ <!-- =================================================================== -->
33
+ <!-- Neato USCD2lbl.NTT: CD/DVD Labels (face only), 2 per sheet -->
34
+ <!-- =================================================================== -->
35
+ <Template name="Neato USCD2lbl.NTT" size="US-Letter"
36
+ _description="CD/DVD Labels (face only)">
37
+ <Label-cd id="0" radius="166.5" hole="58.5" waste="5">
38
+ <Markup-margin size="5"/>
39
+ <Layout nx="1" ny="2" x0="139.5" y0="49.5" dx="0" dy="360"/>
40
+ </Label-cd>
41
+ </Template>
42
+
43
+ <!-- =================================================================== -->
44
+ <!-- Neato USCD2lbl.NTT: CD/DVD Labels (rectangles), 2 per sheet -->
45
+ <!-- =================================================================== -->
46
+ <Template name="Neato USCD2lbl Rectangles" size="US-Letter"
47
+ _description="CD Template Rectangles">
48
+ <Label-rectangle id="0" width="77.04" height="234.36" round="10">
49
+ <Markup-margin size="2.016"/>
50
+ <Layout nx="2" ny="1" x0="51.3" y0="279.72" dx="433.44" dy="0"/>
51
+ </Label-rectangle>
52
+ </Template>
53
+
54
+ <!-- =================================================================== -->
55
+ <!-- Neato CLP-192328/26: HandiCD-R 50MB, 3" x 2_1/8'', 9 per sheet -->
56
+ <!-- =================================================================== -->
57
+ <Template name="Neato HandiCD-R" size="US-Letter"
58
+ _description="Business Card CD">
59
+ <Label-cd id="0" radius="108" width="171" hole="58" waste="5">
60
+ <Markup-margin size="5"/>
61
+ <Layout nx="3" ny="3" x0="36.5" y0="54" dx="184.5" dy="234"/>
62
+ </Label-cd>
63
+ </Template>
64
+
65
+ <!-- =================================================================== -->
66
+ <!-- CD STOMPER PRO CD Label Refills, (Face Only) * -->
67
+ <!-- =================================================================== -->
68
+ <Template name="Stomper PRO CD" size="US-Letter"
69
+ _description="PRO CD Labels 2-up (face only)">
70
+ <Label-cd id="0" radius="166.5" hole="58.5" waste="5">
71
+ <Markup-margin size="5"/>
72
+ <Layout nx="1" ny="1" x0="34" y0="43" dx="0" dy="0"/>
73
+ <Layout nx="1" ny="1" x0="245" y0="416" dx="0" dy="0"/>
74
+ </Label-cd>
75
+ </Template>
76
+
77
+ <Template name="Stomper PRO Zip" size="US-Letter"
78
+ _description="PRO CD Labels 2-up (Face only)">
79
+ <Label-rectangle id="0" width="168" height="142" round="0">
80
+ <Markup-margin size="5"/>
81
+ <Layout nx="1" ny="2" x0="407" y0="68" dx="0" dy="142"/>
82
+ <Layout nx="1" ny="2" x0="37" y0="440" dx="0" dy="142"/>
83
+ </Label-rectangle>
84
+ </Template>
85
+
86
+ <Template name="Stomper PRO Spine" size="US-Letter"
87
+ _description="PRO CD Labels 2-up (CD spine only)">
88
+ <Label-rectangle id="0" width="288" height="20" round="0">
89
+ <Markup-margin size="2"/>
90
+ <Layout nx="2" ny="1" x0="18" y0="385" dx="288" dy="0"/>
91
+ </Label-rectangle>
92
+ </Template>
93
+
94
+ <!-- ===================================================================-->
95
+ <!-- Meritline Mini CD/DVD Labels (face only), 5 per sheet -->
96
+ <!-- ===================================================================-->
97
+ <Template name="Meritline Mini-CD" size="US-Letter"
98
+ _description="Mini-CD Labels">
99
+ <Label-cd id="0" radius="110.5" hole="57.5" waste="5">
100
+ <Markup-margin size="5"/>
101
+ <Layout nx="2" ny="2" x0="48.4" y0="47.6" dx="299.5" dy="481.5"/>
102
+ <Layout nx="1" ny="1" x0="197.3" y0="289.5" dx="0" dy="0"/>
103
+ </Label-cd>
104
+ </Template>
105
+
106
+ <!-- ===================================================================-->
107
+ <!-- Neato Slimline CD Jewel Case Insert, 2 per sheet. -->
108
+ <!-- Left margin area is CD spine; ignore other margins. -->
109
+ <!-- To write text on spine, use "upside down" template, "rotated", -->
110
+ <!-- spine is bottom margin, print label sheet BOTTOM FIRST. -->
111
+ <!-- ===================================================================-->
112
+ <Template name="Neato Slimline CD Case" size="US-Letter"
113
+ _description="Slimline CD Case (rightside up)">
114
+ <Label-rectangle id="0" width="394.5" height="342.5" round="0">
115
+ <Markup-margin size="7.5"/>
116
+ <Layout nx="1" ny="2" x0="130" y0="41.9" dx="0" dy="363"/>
117
+ </Label-rectangle>
118
+ </Template>
119
+ <Template name="Neato Slimline CD Case, spine" size="US-Letter"
120
+ _description="Slimline CD Case (upside down)">
121
+ <Label-rectangle id="0" width="394.5" height="342.5" round="0">
122
+ <Markup-margin size="7.5"/>
123
+ <Layout nx="1" ny="2" x0="96.5" y0="41.9" dx="0" dy="363"/>
124
+ </Label-rectangle>
125
+ </Template>
126
+
127
+ <!-- =================================================================== -->
128
+ <!-- Great Gizmos : CD/DVD Labels (face only), 2 per sheet * -->
129
+ <!-- =================================================================== -->
130
+ <Template name="Great Gizmos" size="US-Letter"
131
+ _description="CD/DVD Labels (face only)">
132
+ <Label-cd id="0" radius="166.5" hole="58.5" waste="5">
133
+ <Markup-margin size="5"/>
134
+ <Layout nx="1" ny="2" x0="139.5" y0="42.52" dx="0" dy="374.17"/>
135
+ </Label-cd>
136
+ </Template>
137
+
138
+ <!-- =================================================================== -->
139
+ <!-- Imation-SoniX CD/DVD Labels (Face Only) * -->
140
+ <!-- =================================================================== -->
141
+ <Template name="Imation-SoniX No.5112 15954" size="US-Letter"
142
+ _description="CD/DVD Labels (Face Only)">
143
+ <Label-cd id="0" radius="167.8" hole="18.5" waste="5">
144
+ <Markup-margin size="5"/>
145
+ <Layout nx="1" ny="1" x0="40.5" y0="370" dx="0" dy="0"/>
146
+ </Label-cd>
147
+ </Template>
148
+
149
+ <!-- =================================================================== -->
150
+ <!-- Netc Label Stock: DLT Labels, (www.netclabels.com), 30 per sheet -->
151
+ <!-- =================================================================== -->
152
+ <Template name="Netc 749303-70001 " size="US-Letter" _description="DLT Labels">
153
+ <Label-rectangle id="0" width="162" height="59.4" round="0">
154
+ <Markup-margin size="18"/>
155
+ <Layout nx="3" ny="10" x0="36" y0="45" dx="189" dy="72"/>
156
+ </Label-rectangle>
157
+ </Template>
158
+
159
+ <!-- =================================================================== -->
160
+ <!-- Tough-Tags TTLW-2016 Microtube labels, 85 per sheet. -->
161
+ <!-- =================================================================== -->
162
+ <Template name="Tough-Tags TTLW-2016" size="US-Letter" _description="Microtube labels">
163
+ <Label-rectangle id="0" width="92.16" height="36" round="5">
164
+ <Markup-margin size="5"/>
165
+ <Layout nx="5" ny="17" x0="68" y0="4.17" dx="100.8" dy="45.3"/>
166
+ </Label-rectangle>
167
+ </Template>
168
+
169
+ <!-- =================================================================== -->
170
+ <!-- Kingdom L Cassette Labels, 12 per sheet. -->
171
+ <!-- =================================================================== -->
172
+ <Template name="Kingdom L" size="US-Letter" _description="Cassette Labels">
173
+ <Label-rectangle id="0" width="252pt" height="117pt" round="9pt" x_waste="2.376pt" y_waste="2.376pt">
174
+ <Markup-margin size="9pt"/>
175
+ <Layout nx="2" ny="6" x0="33.12pt" y0="27pt" dx="261pt" dy="126.144pt"/>
176
+ </Label-rectangle>
177
+ </Template>
178
+
179
+ </Glabels-templates>
180
+
181
+
182
+
183
+
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0"?>
2
+ <Glabels-paper-sizes>
3
+
4
+ <!-- Most popular (at top of list) -->
5
+ <Paper-size id="US-Letter" _name="US Letter" width="8.5in" height="11in"/>
6
+ <Paper-size id="A4" _name="A4" width="210mm" height="297mm"/>
7
+
8
+ <!-- Other US paper sizes -->
9
+ <Paper-size id="US-Legal" _name="US Legal" width="8.5in" height="14in"/>
10
+ <Paper-size id="US-Executive" _name="US Executive" width="7.25in" height="10.5in"/>
11
+
12
+ <!-- Other ISO A series sizes -->
13
+ <Paper-size id="A0" _name="A0" width="841mm" height="1189mm"/>
14
+ <Paper-size id="A1" _name="A1" width="594mm" height="841mm"/>
15
+ <Paper-size id="A2" _name="A2" width="420mm" height="594mm"/>
16
+ <Paper-size id="A3" _name="A3" width="297mm" height="420mm"/>
17
+ <Paper-size id="A5" _name="A5" width="148mm" height="210mm"/>
18
+ <Paper-size id="A6" _name="A6" width="105mm" height="148mm"/>
19
+ <Paper-size id="A7" _name="A7" width="74mm" height="105mm"/>
20
+ <Paper-size id="A8" _name="A8" width="52mm" height="74mm"/>
21
+ <Paper-size id="A9" _name="A9" width="37mm" height="52mm"/>
22
+ <Paper-size id="A10" _name="A10" width="26mm" height="37mm"/>
23
+
24
+ <!-- ISO B series sizes -->
25
+ <Paper-size id="B0" _name="B0" width="1000mm" height="1414mm"/>
26
+ <Paper-size id="B1" _name="B1" width="707mm" height="1000mm"/>
27
+ <Paper-size id="B2" _name="B2" width="500mm" height="707mm"/>
28
+ <Paper-size id="B3" _name="B3" width="353mm" height="500mm"/>
29
+ <Paper-size id="B4" _name="B4" width="250mm" height="353mm"/>
30
+ <Paper-size id="B5" _name="B5" width="176mm" height="250mm"/>
31
+ <Paper-size id="B6" _name="B6" width="125mm" height="176mm"/>
32
+ <Paper-size id="B7" _name="B7" width="88mm" height="125mm"/>
33
+ <Paper-size id="B8" _name="B8" width="62mm" height="88mm"/>
34
+ <Paper-size id="B9" _name="B9" width="44mm" height="62mm"/>
35
+ <Paper-size id="B10" _name="B10" width="31mm" height="44mm"/>
36
+
37
+ </Glabels-paper-sizes>
@@ -0,0 +1,197 @@
1
+ <?xml version="1.0"?>
2
+ <Glabels-templates>
3
+
4
+
5
+ <!-- ******************************************************************** -->
6
+ <!-- Zweckform A4 products -->
7
+ <!-- ******************************************************************** -->
8
+
9
+ <!-- =================================================================== -->
10
+ <!-- Zweckform 4761: Lever Arch File Labels, 192 x 61 mm, 4 per sheet -->
11
+ <!-- =================================================================== -->
12
+ <Template name="Zweckform 4761" size="A4" _description="Lever Arch File Labels">
13
+ <Label-rectangle id="0" width="544.25" height="172.9" round="5">
14
+ <Markup-margin size="5"/>
15
+ <Layout nx="1" ny="4" x0="25" y0="75" dx="544.25" dy="172.9"/>
16
+ </Label-rectangle>
17
+ </Template>
18
+
19
+ <!-- =================================================================== -->
20
+ <!-- Zweckform 3651: Rectangular Labels, 52 x 29.5 mm, 40 per sheet -->
21
+ <!-- =================================================================== -->
22
+ <Template name="Zweckform 3651" size="A4" _description="Rectangular Labels">
23
+ <Label-rectangle id="0" width="147.4016" height="83.6220" round="0">
24
+ <Markup-margin size="5"/>
25
+ <Layout nx="4" ny="10" x0="2.834" y0="2.834" dx="147.4016" dy="83.6220"/>
26
+ </Label-rectangle>
27
+ </Template>
28
+
29
+ <!-- ====================================================================-->
30
+ <!-- Zweckform 3654: CD Labels 2 per Template -->
31
+ <!-- ====================================================================-->
32
+ <Template name="Zweckform 3654" size="A4" _description="CD/DVD Labels">
33
+ <Label-cd id="0" radius="165.78" hole="58.09" waste="5">
34
+ <Markup-margin size="5"/>
35
+ <Layout nx="1" ny="2" x0="131.78" y0="58.7998" dx="0" dy="387.97"/>
36
+ </Label-cd>
37
+ </Template>
38
+
39
+ <!-- =================================================================== -->
40
+ <!-- Zweckform 3659: Rectangular Labels, 97 x 42.125 mm, 12 per sheet -->
41
+ <!-- =================================================================== -->
42
+ <Template name="Zweckform 3659" size="A4" _description="Mailing Labels">
43
+ <Label-rectangle id="0" width="274" height="120.5" round="0">
44
+ <Markup-margin size="5"/>
45
+ <Layout nx="2" ny="6" x0="22.68" y0="60" dx="274" dy="120.5"/>
46
+ </Label-rectangle>
47
+ </Template>
48
+
49
+ <!-- =================================================================== -->
50
+ <!-- Zweckform 3669: Rectangular Labels, 70 x 50.8mm, 15 per sheet -->
51
+ <!-- =================================================================== -->
52
+ <Template name="Zweckform 3669" size="A4" _description="QSL-Karten Etiketten 70mm x 50,8mm">
53
+ <Label-rectangle id="0" width="198.425" height="144" round="0">
54
+ <Markup-margin size="5"/>
55
+ <Layout nx="3" ny="5" x0="0" y0="61" dx="198.425" dy="144"/>
56
+ </Label-rectangle>
57
+ </Template>
58
+
59
+ <!-- =================================================================== -->
60
+ <!-- Zweckform 3688: Ordnerruecken Labels -->
61
+ <!-- =================================================================== -->
62
+ <Template name="Zweckform 3688" size="A4" description="File Back Labels">
63
+ <Label-rectangle id="0" width="544.252pt" height="172.913pt" round="0pt" waste="0pt">
64
+ <Markup-margin size="9.07087pt"/>
65
+ <Layout nx="1" ny="4" x0="28.3465pt" y0="76.5354pt" dx="544.252pt" dy="172.913pt"/>
66
+ </Label-rectangle>
67
+ </Template>
68
+
69
+ <!-- =================================================================== -->
70
+ <!-- Zweckform 4732: Multi-purpose Stick+Lift labels -->
71
+ <!-- =================================================================== -->
72
+ <Template name="Zweckform 4732" size="A4" description="Multi-purpose Stick+Lift Labels">
73
+ <Label-rectangle id="0" width="102.047pt" height="48.189pt" round="5.66929pt" waste="0pt">
74
+ <Markup-margin size="5.66929pt"/>
75
+ <Layout nx="5" ny="16" x0="31.1811pt" y0="36.8504pt" dx="107.717pt" dy="48.189pt"/>
76
+ </Label-rectangle>
77
+ </Template>
78
+
79
+ <!-- =================================================================== -->
80
+ <!-- Zweckform 4746: Video Labels, 147,32 x 20 mm, 13 per sheet -->
81
+ <!-- =================================================================== -->
82
+ <Template name="Zweckform 4746" size="A4" _description="Video Labels (back)">
83
+ <Label-rectangle id="0" width="416.6" height="56.6929" round="5">
84
+ <Markup-margin size="5"/>
85
+ <Layout nx="1" ny="13" x0="88.8377" y0="52.2425" dx="416.6" dy="56.6929"/>
86
+ </Label-rectangle>
87
+ </Template>
88
+
89
+ <!-- =================================================================== -->
90
+ <!-- Zweckform 4780: Allround Labels, 48,5 x 25,4 mm, 40 per sheet -->
91
+ <!-- =================================================================== -->
92
+ <Template name="Zweckform 4780" size="A4" _description="Allround Labels">
93
+ <Label-rectangle id="0" width="137.48" height="72" round="0">
94
+ <Markup-margin size="5"/>
95
+ <Layout nx="4" ny="10" x0="23" y0="53.8898" dx="137.48" dy="72"/>
96
+ </Label-rectangle>
97
+ </Template>
98
+
99
+ <!-- =================================================================== -->
100
+ <!-- Zweckform 3474: Address Labels, 70 x 37 mm, 24 per sheet -->
101
+ <!-- =================================================================== -->
102
+ <Template name="Zweckform 3474" size="A4" _description="Address Labels">
103
+ <Label-rectangle id="0" width="70mm" height="37mm" round="0">
104
+ <Markup-margin size="0"/>
105
+ <Layout nx="3" ny="8" x0="0" y0="0" dx="70mm" dy="37mm"/>
106
+ </Label-rectangle>
107
+ </Template>
108
+
109
+ <!-- =================================================================== -->
110
+ <!-- Zweckform 3475: Address Labels, 70 x 30 mm, 24 per sheet -->
111
+ <!-- =================================================================== -->
112
+ <Template name="Zweckform 3475" size="A4" _description="Address Labels">
113
+ <Label-rectangle id="0" width="198.570" height="102.121" round="0">
114
+ <Markup-margin size="0"/>
115
+ <Layout nx="3" ny="8" x0="0" y0="12.566" dx="198.570" dy="102.121"/>
116
+ </Label-rectangle>
117
+ </Template>
118
+
119
+ <!-- =================================================================== -->
120
+ <!-- Zweckform 3490: Rectangular Labels, 70 x 36 mm, 24 per sheet -->
121
+ <!-- =================================================================== -->
122
+ <Template name="Zweckform 3490" size="A4" _description="Rectangular Copier Labels">
123
+ <Label-rectangle id="0" width="198.425" height="102.047" round="0">
124
+ <Markup-margin size="5"/>
125
+ <Layout nx="3" ny="8" x0="" y0="12.557" dx="198.425" dy="102.047"/>
126
+ </Label-rectangle>
127
+ </Template>
128
+
129
+ <!-- =================================================================== -->
130
+ <!-- Zweckform 4781: Rectangular Labels, 97 x 42.3 mm, 12 per sheet -->
131
+ <!-- =================================================================== -->
132
+ <Template name="Zweckform 4781" size="A4" _description="Rectangular Copier Labels">
133
+ <Label-rectangle id="0" width="274.960" height="119.905" round="0">
134
+ <Markup-margin size="5"/>
135
+ <Layout nx="2" ny="6" x0="22.677" y0="61.030" dx="274.960" dy="119.905"/>
136
+ </Label-rectangle>
137
+ </Template>
138
+
139
+ <!-- =================================================================== -->
140
+ <!-- Zweckform 6091: Correction and Cover, 64.6 x 33.8 mm, 24 per sheet -->
141
+ <!-- =================================================================== -->
142
+ <Template name="Zweckform 6091" size="A4" _description="Correction and Cover-up Labels">
143
+ <Label-rectangle id="0" width="183.118" height="95.811" round="0">
144
+ <Markup-margin size="5"/>
145
+ <Layout nx="3" ny="8" x0="22.961" y0="37.502" dx="183.118" dy="95.881"/>
146
+ </Label-rectangle>
147
+ </Template>
148
+
149
+ <!-- =================================================================== -->
150
+ <!-- Zweckform 6015: CD Labels, 2 per Template -->
151
+ <!-- =================================================================== -->
152
+ <Template name="Zweckform 6015" size="A4" _description="CD/DVD Labels">
153
+ <Label-cd id="0" radius="165.827" hole="58.110" waste="5">
154
+ <Markup-margin size="5"/>
155
+ <Layout nx="1" ny="2" x0="131.811" y0="60.746" dx="0" dy="388.346"/>
156
+ </Label-cd>
157
+ </Template>
158
+
159
+ <!-- =================================================================== -->
160
+ <!-- Zweckform 6021: Allround Labels -->
161
+ <!-- =================================================================== -->
162
+ <Template name="Zweckform 6021" size="A4" description="Allround Labels">
163
+ <Label-rectangle id="0" width="130.392pt" height="47.9055pt" round="0pt" waste="0pt">
164
+ <Markup-margin size="5pt"/>
165
+ <Layout nx="4" ny="16" x0="24.0945pt" y0="39.6853pt" dx="136.913pt" dy="47.9055pt"/>
166
+ </Label-rectangle>
167
+ </Template>
168
+
169
+ <!-- =================================================================== -->
170
+ <!-- Zweckform 32010: Business Cards, 54.0 x 85.0 mm, 10 per sheet -->
171
+ <!-- =================================================================== -->
172
+ <Template name="Zweckform 32010" size="A4" _description="Business Cards">
173
+ <Label-rectangle id="0" width="240.94" height="153.07" round="0">
174
+ <Markup-margin size="5"/>
175
+ <Layout nx="2" ny="5" x0="40" y0="40" dx="269" dy="153"/>
176
+ </Label-rectangle>
177
+ <Alias name="DECAdry SCW-2090"/>
178
+ <Alias name="DECAdry OCB-3327"/>
179
+ <Alias name="DECAdry DAW-327"/>
180
+ </Template>
181
+
182
+ <!-- =================================================================== -->
183
+ <!-- Zweckform 4760: File Labels, 192 x 38 mm, 7 per sheet -->
184
+ <!-- =================================================================== -->
185
+ <Template name="Zweckform 4760" size="A4" description="File Back Labels">
186
+ <Label-rectangle id="0" width="544.252pt" height="107.717pt" round="5.66929pt" waste="0pt">
187
+ <Markup-margin size="9pt"/>
188
+ <Layout nx="1" ny="7" x0="25.5118pt" y0="43.7386pt" dx="544.252pt" dy="107.717pt"/>
189
+ </Label-rectangle>
190
+ </Template>
191
+
192
+
193
+ </Glabels-templates>
194
+
195
+
196
+
197
+
@@ -0,0 +1,91 @@
1
+ $: << File.expand_path(File.dirname(__FILE__) + "/../lib")
2
+ require 'test/unit'
3
+ require 'pdf_label_page'
4
+
5
+ class TestPDFLabelPage < Test::Unit::TestCase
6
+
7
+ def setup
8
+ end
9
+
10
+ def test_new_with_tempalte_name
11
+ p = PDFLabelPage.new("Avery 5366")
12
+ assert p
13
+ assert_equal p.template.name, "Avery 5366"
14
+ end
15
+
16
+ def test_new_with_alias_name
17
+ p = PDFLabelPage.new("Avery 8166")
18
+ assert p
19
+ assert_equal p.template.name, "Avery 5366"
20
+ end
21
+
22
+ def test_new_with_paper_type
23
+ p = PDFLabelPage.new("Avery 5366", {:paper => 'Legal'})
24
+ assert p
25
+ assert_equal p.pdf.page_width, 612.0
26
+ assert_equal p.pdf.page_height, 1008.0
27
+ end
28
+
29
+ def test_new_with_tempalte_not_found
30
+ assert_raise(RuntimeError) {
31
+ p = PDFLabelPage.new("Some Non-Existing")
32
+ }
33
+ end
34
+
35
+ #TODO other options are possible for pdf_options, we need to test those at some point
36
+
37
+ def test_PDFLabelPage_load_tempalte_set
38
+ PDFLabelPage.load_template_set(File.expand_path(File.dirname(__FILE__) + "/../templates/avery-iso-templates.xml"))
39
+ #Avery 7160 is found in avery-iso-templates
40
+ p = PDFLabelPage.new("Avery 7160")
41
+ assert p
42
+ assert_equal p.pdf.page_width, 595.28
43
+ assert_equal p.pdf.page_height, 841.89
44
+ PDFLabelPage.load_template_set(File.expand_path(File.dirname(__FILE__) + "/../templates/avery-us-templates.xml"))
45
+ end
46
+
47
+ def test_PDFLabelPage_all_template_names
48
+ #what happens if we havn't loaded a template yet?
49
+ t = PDFLabelPage.all_template_names
50
+ assert t
51
+ assert_equal t.class, Array
52
+ assert_equal t.size, 291
53
+ assert_equal t[0], "Avery 3274.1"
54
+ end
55
+
56
+
57
+ def test_add_label_2_by_10
58
+ p = PDFLabelPage.new("Avery 8160") # label is 2 x 10
59
+ p.add_label() # should add to col 1, row 1
60
+ p.add_label(:position => 1) # should add col 1, row 2
61
+ p.add_label(:text => "Positoin 15", :position => 15) # should add col 2, row 1
62
+ #does the use_margin = true work?
63
+ p.add_label(:margin => true, :position => 4)
64
+ #with out the margin?
65
+ p.add_label(:text => 'No Margin', :position => 5, :use_margin => false)
66
+ p.add_label(:position => 7, :text => 'This is the song that never ends, yes it goes on and on my friends')
67
+ p.add_label(:position => 9, :text => "X Offset = 4, Y Offset = -6", :offset_x => 4, :offset_y => -6)
68
+ p.add_label(:text => "Centered", :position => 26, :justification => :center) # should add col 2, row 15
69
+ p.add_label(:text => "[Right justified]", :justification => :right, :position => 28)# col 2, row 14, right justified.
70
+ p.add_label(:position => 29) # should add col 2, row 15
71
+ p.add_label(:position => 8, :text => "This was added last and has a BIG font", :font_size => 18)
72
+ p.draw_boxes(false, true)
73
+ #TODO Anybody out there think of a better way to test this?
74
+ p.save_as("../test_add_label_output.pdf")
75
+ end
76
+
77
+ def test_add_many_labels
78
+ p = PDFLabelPage.new("Avery 8160") # label is 2 x 10
79
+ #without positoin, so start at 1
80
+ p.add_many_labels(:text => "Hello Five Times!", :count => 5)
81
+ p.add_many_labels(:text => "Hellow four more times, starting at 15", :count => 4, :position => 15)
82
+ p.save_as("../test_add_many_label_output.pdf")
83
+ end
84
+
85
+ def test_draw_boxes
86
+ p = PDFLabelPage.new("Avery 5366") # label is 2 x 10
87
+ p.draw_boxes
88
+ p.save_as("../test_draw_boxes_output.pdf")
89
+ end
90
+
91
+ end