rghost_barcode 0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. data/lib/doc/classes/RGhost.html +109 -0
  2. data/lib/doc/classes/RGhost/Barcode.html +147 -0
  3. data/lib/doc/classes/RGhost/Barcode/Auspost.html +113 -0
  4. data/lib/doc/classes/RGhost/Barcode/Azteccode.html +113 -0
  5. data/lib/doc/classes/RGhost/Barcode/Base.html +266 -0
  6. data/lib/doc/classes/RGhost/Barcode/Base.src/M000004.html +34 -0
  7. data/lib/doc/classes/RGhost/Barcode/Base.src/M000005.html +30 -0
  8. data/lib/doc/classes/RGhost/Barcode/Base.src/M000006.html +20 -0
  9. data/lib/doc/classes/RGhost/Barcode/Border.html +170 -0
  10. data/lib/doc/classes/RGhost/Barcode/Border.src/M000001.html +27 -0
  11. data/lib/doc/classes/RGhost/Barcode/Code11.html +113 -0
  12. data/lib/doc/classes/RGhost/Barcode/Code128.html +113 -0
  13. data/lib/doc/classes/RGhost/Barcode/Code2of5.html +113 -0
  14. data/lib/doc/classes/RGhost/Barcode/Code39.html +113 -0
  15. data/lib/doc/classes/RGhost/Barcode/Code93.html +113 -0
  16. data/lib/doc/classes/RGhost/Barcode/Datamatrix.html +113 -0
  17. data/lib/doc/classes/RGhost/Barcode/Ean13.html +113 -0
  18. data/lib/doc/classes/RGhost/Barcode/Ean2.html +113 -0
  19. data/lib/doc/classes/RGhost/Barcode/Ean5.html +113 -0
  20. data/lib/doc/classes/RGhost/Barcode/Ean8.html +113 -0
  21. data/lib/doc/classes/RGhost/Barcode/Guard.html +174 -0
  22. data/lib/doc/classes/RGhost/Barcode/Guard.src/M000003.html +27 -0
  23. data/lib/doc/classes/RGhost/Barcode/Interleaved2of5.html +113 -0
  24. data/lib/doc/classes/RGhost/Barcode/Isbn.html +113 -0
  25. data/lib/doc/classes/RGhost/Barcode/Kix.html +113 -0
  26. data/lib/doc/classes/RGhost/Barcode/Maxicode.html +113 -0
  27. data/lib/doc/classes/RGhost/Barcode/Msi.html +113 -0
  28. data/lib/doc/classes/RGhost/Barcode/Onecode.html +113 -0
  29. data/lib/doc/classes/RGhost/Barcode/Parameter.html +262 -0
  30. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000007.html +20 -0
  31. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000008.html +18 -0
  32. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000009.html +18 -0
  33. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000010.html +18 -0
  34. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000011.html +18 -0
  35. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000012.html +24 -0
  36. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000013.html +18 -0
  37. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000014.html +18 -0
  38. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000015.html +16 -0
  39. data/lib/doc/classes/RGhost/Barcode/Pdf417.html +113 -0
  40. data/lib/doc/classes/RGhost/Barcode/Pharmacode.html +113 -0
  41. data/lib/doc/classes/RGhost/Barcode/Plessey.html +113 -0
  42. data/lib/doc/classes/RGhost/Barcode/Postnet.html +113 -0
  43. data/lib/doc/classes/RGhost/Barcode/Qrcode.html +113 -0
  44. data/lib/doc/classes/RGhost/Barcode/Rationalizedcodabar.html +113 -0
  45. data/lib/doc/classes/RGhost/Barcode/Raw.html +113 -0
  46. data/lib/doc/classes/RGhost/Barcode/Royalmail.html +113 -0
  47. data/lib/doc/classes/RGhost/Barcode/Rss14.html +113 -0
  48. data/lib/doc/classes/RGhost/Barcode/Rssexpanded.html +113 -0
  49. data/lib/doc/classes/RGhost/Barcode/Rsslimited.html +113 -0
  50. data/lib/doc/classes/RGhost/Barcode/Symbol.html +113 -0
  51. data/lib/doc/classes/RGhost/Barcode/Text.html +193 -0
  52. data/lib/doc/classes/RGhost/Barcode/Text.src/M000002.html +30 -0
  53. data/lib/doc/classes/RGhost/Barcode/Upca.html +113 -0
  54. data/lib/doc/classes/RGhost/Barcode/Upce.html +113 -0
  55. data/lib/doc/classes/RGhost/Config.html +150 -0
  56. data/lib/doc/classes/RGhost/Config.src/M000016.html +45 -0
  57. data/lib/doc/classes/RGhost/Document.html +704 -0
  58. data/lib/doc/classes/RGhost/Document.src/M000017.html +19 -0
  59. data/lib/doc/classes/RGhost/Document.src/M000018.html +18 -0
  60. data/lib/doc/classes/RGhost/Document.src/M000019.html +18 -0
  61. data/lib/doc/classes/RGhost/Document.src/M000020.html +18 -0
  62. data/lib/doc/classes/RGhost/Document.src/M000021.html +18 -0
  63. data/lib/doc/classes/RGhost/Document.src/M000022.html +18 -0
  64. data/lib/doc/classes/RGhost/Document.src/M000023.html +18 -0
  65. data/lib/doc/classes/RGhost/Document.src/M000024.html +18 -0
  66. data/lib/doc/classes/RGhost/Document.src/M000025.html +18 -0
  67. data/lib/doc/classes/RGhost/Document.src/M000026.html +18 -0
  68. data/lib/doc/classes/RGhost/Document.src/M000027.html +18 -0
  69. data/lib/doc/classes/RGhost/Document.src/M000028.html +18 -0
  70. data/lib/doc/classes/RGhost/Document.src/M000029.html +18 -0
  71. data/lib/doc/classes/RGhost/Document.src/M000030.html +18 -0
  72. data/lib/doc/classes/RGhost/Document.src/M000031.html +18 -0
  73. data/lib/doc/classes/RGhost/Document.src/M000032.html +18 -0
  74. data/lib/doc/classes/RGhost/Document.src/M000033.html +18 -0
  75. data/lib/doc/classes/RGhost/Document.src/M000034.html +18 -0
  76. data/lib/doc/classes/RGhost/Document.src/M000035.html +18 -0
  77. data/lib/doc/classes/RGhost/Document.src/M000036.html +18 -0
  78. data/lib/doc/classes/RGhost/Document.src/M000037.html +18 -0
  79. data/lib/doc/classes/RGhost/Document.src/M000038.html +18 -0
  80. data/lib/doc/classes/RGhost/Document.src/M000039.html +18 -0
  81. data/lib/doc/classes/RGhost/Document.src/M000040.html +18 -0
  82. data/lib/doc/classes/RGhost/Document.src/M000041.html +18 -0
  83. data/lib/doc/classes/RGhost/Document.src/M000042.html +18 -0
  84. data/lib/doc/classes/RGhost/Document.src/M000043.html +18 -0
  85. data/lib/doc/classes/RGhost/Document.src/M000044.html +18 -0
  86. data/lib/doc/classes/RGhost/Document.src/M000045.html +18 -0
  87. data/lib/doc/classes/RGhost/Document.src/M000046.html +18 -0
  88. data/lib/doc/classes/RGhost/Document.src/M000047.html +18 -0
  89. data/lib/doc/classes/RGhost/Document.src/M000048.html +18 -0
  90. data/lib/doc/created.rid +1 -0
  91. data/lib/doc/files/rghost_barcode/rghost_barcode_adapter_rb.html +101 -0
  92. data/lib/doc/files/rghost_barcode/rghost_barcode_base_rb.html +101 -0
  93. data/lib/doc/files/rghost_barcode/rghost_barcode_classes_rb.html +101 -0
  94. data/lib/doc/files/rghost_barcode/rghost_barcode_examples_rb.html +101 -0
  95. data/lib/doc/files/rghost_barcode/rghost_barcode_version_rb.html +101 -0
  96. data/lib/doc/files/rghost_barcode_rb.html +111 -0
  97. data/lib/doc/files/teste_main_rb.html +110 -0
  98. data/lib/doc/fr_class_index.html +67 -0
  99. data/lib/doc/fr_file_index.html +33 -0
  100. data/lib/doc/fr_method_index.html +74 -0
  101. data/lib/doc/index.html +24 -0
  102. data/lib/rghost_barcode.rb +7 -0
  103. data/lib/rghost_barcode/ps/auspost.ps +192 -0
  104. data/lib/rghost_barcode/ps/azteccode.ps +357 -0
  105. data/lib/rghost_barcode/ps/barcode_template.eps +1193 -0
  106. data/lib/rghost_barcode/ps/code11.ps +128 -0
  107. data/lib/rghost_barcode/ps/code128.ps +121 -0
  108. data/lib/rghost_barcode/ps/code2of5.ps +106 -0
  109. data/lib/rghost_barcode/ps/code39.ps +109 -0
  110. data/lib/rghost_barcode/ps/code93.ps +117 -0
  111. data/lib/rghost_barcode/ps/datamatrix.ps +328 -0
  112. data/lib/rghost_barcode/ps/ean13.ps +183 -0
  113. data/lib/rghost_barcode/ps/ean2.ps +101 -0
  114. data/lib/rghost_barcode/ps/ean5.ps +116 -0
  115. data/lib/rghost_barcode/ps/ean8.ps +101 -0
  116. data/lib/rghost_barcode/ps/interleaved2of5.ps +132 -0
  117. data/lib/rghost_barcode/ps/isbn.ps +118 -0
  118. data/lib/rghost_barcode/ps/kix.ps +98 -0
  119. data/lib/rghost_barcode/ps/maxicode.ps +307 -0
  120. data/lib/rghost_barcode/ps/msi.ps +104 -0
  121. data/lib/rghost_barcode/ps/onecode.ps +276 -0
  122. data/lib/rghost_barcode/ps/pdf417.ps +428 -0
  123. data/lib/rghost_barcode/ps/pharmacode.ps +69 -0
  124. data/lib/rghost_barcode/ps/plessey.ps +121 -0
  125. data/lib/rghost_barcode/ps/postnet.ps +114 -0
  126. data/lib/rghost_barcode/ps/qrcode.ps +530 -0
  127. data/lib/rghost_barcode/ps/rationalizedcodabar.ps +117 -0
  128. data/lib/rghost_barcode/ps/raw.ps +35 -0
  129. data/lib/rghost_barcode/ps/render.ps +307 -0
  130. data/lib/rghost_barcode/ps/render.ps~ +308 -0
  131. data/lib/rghost_barcode/ps/royalmail.ps +119 -0
  132. data/lib/rghost_barcode/ps/rss14.ps +237 -0
  133. data/lib/rghost_barcode/ps/rssexpanded.ps +211 -0
  134. data/lib/rghost_barcode/ps/rsslimited.ps +191 -0
  135. data/lib/rghost_barcode/ps/symbol.ps +49 -0
  136. data/lib/rghost_barcode/ps/upca.ps +128 -0
  137. data/lib/rghost_barcode/ps/upce.ps +157 -0
  138. data/lib/rghost_barcode/rghost_barcode_adapter.rb +249 -0
  139. data/lib/rghost_barcode/rghost_barcode_base.rb +210 -0
  140. data/lib/rghost_barcode/rghost_barcode_classes.rb +96 -0
  141. data/lib/rghost_barcode/rghost_barcode_examples.rb +35 -0
  142. data/lib/rghost_barcode/rghost_barcode_version.rb +8 -0
  143. data/lib/teste_main.rb +94 -0
  144. metadata +218 -0
@@ -0,0 +1,210 @@
1
+ module RGhost::Barcode
2
+
3
+ class Parameter < RGhost::PsObject
4
+
5
+ def initialize(options=nil)
6
+ @options=options
7
+ @params=[]
8
+ make() if options
9
+ end
10
+ def map
11
+ @params.join(" ")
12
+ end
13
+
14
+ def add(key,value)
15
+ @params << "#{key}=#{value}" if value
16
+ end
17
+
18
+ def add_color(key,value)
19
+ add(key, value.to_s.gsub(/[^0-9A-F]/,'') )
20
+ end
21
+ def add_single(entry)
22
+ @params << entry
23
+ end
24
+
25
+ #using the framework unit
26
+ def add_with_unit(key,value)
27
+
28
+
29
+
30
+ v=if RGhost::Config::GS[:unit] == RGhost::Units::Cm
31
+ (value.to_f/2.545)
32
+ end
33
+ add(key, v || value )
34
+ end
35
+
36
+ def inspect
37
+ "#{self.class} - #{map}"
38
+ end
39
+ def to_s
40
+ map
41
+ end
42
+ def make() end #prototype
43
+
44
+
45
+ end
46
+
47
+
48
+ #Enables properties of text. It's used on the contructor of the class RGhost::Barcode::Base(parent of all barcodes) by Hash :text.
49
+ #Between parenthesis the original parameter.
50
+ #* <tt>:size</tt> - (textsize) - size of text in points.
51
+ #* <tt>:font</tt> - (textfont) - name of font, see the font catalog.
52
+ #* <tt>:offset</tt> - (textxoffset, textyoffset) - Used as array. Example :offset => [10,8], textxoffset[0] and textyoffset[1]
53
+ #* <tt>:x and :y</tt> - (textxalign, textyalign) - Align of X and Y. Example :x => 0.2, :y => 5
54
+ #* <tt>:color</tt> - (textcolor) - Color of text. Only rgb hex. Example: :color => 'FF0000'
55
+ #* <tt>:enable </tt> Array
56
+ #Enables
57
+ #* <tt>:text</tt> - (includetext) - Show human readable text for data in symbol.
58
+ #* <tt>:check</tt> - (includecheck) - Generate check digit(s), where relevant.
59
+ #* <tt>:checkintext</tt> - (includecheckintext) - Generate check digit(s), where relevant.
60
+ #Example:
61
+ # doc=Document.new
62
+ # doc.barcode_interleaved2of5('0123456789', :text => {:size => 10, :offset => [0,-10], :enable => [:text, :check, :checkintext] })
63
+ class Text < RGhost::Barcode::Parameter
64
+
65
+ def make
66
+ add_single("includetext")
67
+ @options.each do |key,value|
68
+ case key
69
+ when :enable then value.each{|item| add_single("include#{item}") }
70
+ when :offset
71
+ add("textxoffset", value[0])
72
+ add("textyoffset", value[1])
73
+ when :color then add_color("textcolor", value)
74
+ when :x, :y then add("text#{key}align",value)
75
+ else
76
+ add("text#{key}",value)
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ #Display whitespace guards or the specified width and height, in points. (Most useful for EANs). It's used on the contructor of the class RGhost::Barcode::Base(parent of all barcodes) by Hash :guard.
83
+ #Between parenthesis the original parameter.
84
+ #* <tt>:whitespace</tt>(guardwhitespace) - Enabled by true. Example: :whitespace => true
85
+ #* <tt>:height and :width </tt>(guardwidth and guardheight)
86
+ #Amount of whitespace to guard to left and right of the symbol and vertical position of the guard symbols, in points.
87
+ #* <tt>:left,right,:left_y, :right_y </tt>(guardleftpos, guardrightpos, guardleftypos and guardrightypos)
88
+ #
89
+ #Example:
90
+ # doc=Document.new
91
+ # doc.barcode_ean13('977147396801', :guard=>{:whitespace => true, :width => 0.2 })
92
+ class Guard < RGhost::Barcode::Parameter
93
+ def make
94
+ #
95
+ @options.each do |key,value|
96
+ case key
97
+ when :left,:right,:left_y, :right_y then add("guard#{key.to_s.gsub(/_/,'')}pos",value)
98
+ when :whitespace then add_single("guardwhitespace")
99
+ else
100
+ add("guard#{key}",value)
101
+ end
102
+ end
103
+
104
+ end
105
+
106
+
107
+ end
108
+ #Display border properties. It's used on the contructor of the class RGhost::Barcode::Base(parent of all barcodes) by Hash :border.
109
+ #Between parenthesis the original parameter.
110
+ #* <tt>:show</tt>(showborder) - Enabled by true. Example: :show => true
111
+ #* <tt>:width</tt>(borderwidth) - Width of border in points.
112
+ #* <tt>:left, :right, :top, :bottom</tt>( borderleft, borderright, bordertop, borderbottom) - specifies the width of the each side of border.
113
+ #* <tt>:color</tt>(textcolor) - Color of text. Only rgb hex. Example: :color => 'FF0000'
114
+ #
115
+ #Example:
116
+ # doc=Document.new
117
+ # doc.barcode_interleaved2of5('0123456789', :border => {:width => 4, :left => 15, :right => 15, :show => true} )
118
+ class Border < RGhost::Barcode::Parameter
119
+
120
+ def make
121
+
122
+ @options.each do |key,value|
123
+ case key
124
+ when :color then add_color("bordercolor", value)
125
+ when :show then add_single("showborder")
126
+ else
127
+ add("border#{key}",value)
128
+ end
129
+ end
130
+
131
+ end
132
+
133
+
134
+ end
135
+
136
+ #Base of all kinds of barcodes. It's used to creates barcode. For more details about options see http://groups.google.com/group/postscriptbarcode/web/Options
137
+ #
138
+ #==Options
139
+ #Facades
140
+ #* <tt>:text</tt> RGhost::Barcode::Text
141
+ #* <tt>:guard</tt> RGhost::Barcode::Guard
142
+ #* <tt>:border</tt> RGhost::Barcode::Border
143
+ #Options. Between parenthesis the original parameter.
144
+ #* <tt>:scale</tt> Scale in Array([x,y]). Example for twice the original size, :scale => [2,2]
145
+ #* <tt>:rotate</tt> Rotate angle.
146
+ #* <tt>:color</tt>(barcolor) Foreground color.
147
+ #* <tt>:background</tt>(backgroundcolor)
148
+ #* <tt>:x and :y</tt> Position. RGhost::Config::GS[:unit] will be used. Default :current_row and :limit_left
149
+ #* <tt>:width and :height</tt>(width and height). Width and height of barcode, RGhost::Config::GS[:unit] will be used.
150
+ #
151
+ #Example:
152
+ # doc=Document.new
153
+ # doc.barcode_interleaved2of5('0123456789',
154
+ # :text => {:size => 10, :offset => [0,-10], :enable => [:text, :check, :checkintext] },
155
+ # :border => {:width => 4, :left => 15, :right => 15, :show => true},
156
+ # :height => 2
157
+ # )
158
+ #Without options
159
+ # doc=Document.new
160
+ # doc.barcode_code39('0123456789')
161
+ class Base <RGhost::Barcode::Parameter
162
+
163
+ attr_reader :text, :guard, :border ,:point
164
+
165
+ def initialize(barcode_string,options={})
166
+ options||={}
167
+
168
+ @options=options.dup
169
+ @options[:x]||= :limit_left
170
+ @options[:y]||= :current_row
171
+ @barcode=barcode_string
172
+ @text = RGhost::Barcode::Text.new(@options[:text])
173
+
174
+ @guard = RGhost::Barcode::Guard.new(@options[:guard])
175
+ @border = RGhost::Barcode::Border.new(@options[:border])
176
+ @point=RGhost::Cursor.translate(@options)
177
+ @rotate=RGhost::Cursor.rotate @options[:rotate]
178
+ @scale=RGhost::Scale.new @options[:scale][0],@options[:scale][1] if @options[:scale]
179
+ [:scale, :enable, :text,:guard,:border, :x, :y, :rotate].each{|v| @options.delete v}
180
+ super(@options)
181
+ @self_name=self.class.to_s.downcase.split(/::/).last
182
+ RGhost::Config::GS[:preload] << @self_name
183
+ end
184
+
185
+ def make
186
+
187
+ [:x,:y].each{|v| @options.delete v}
188
+
189
+ @options.each do |key,value|
190
+ case key
191
+ when :color then add_color("barcolor", value)
192
+ when :background then add_color("backgroundcolor", value)
193
+ when :width, :height then add_with_unit(key,value)
194
+ #when :inkspread then add(key,value)
195
+ else add(key,value)
196
+ end
197
+ end
198
+
199
+ end
200
+
201
+ def ps
202
+ formated_params=[ @text.map, @border.map, @guard.map, self.map].join(" ")
203
+
204
+ "gsave newpath #{@point.ps} #{@rotate} #{@scale} 0 0 moveto (#{@barcode}) (#{formated_params}) #{@self_name} barcode closepath grestore"
205
+ end
206
+
207
+
208
+ end
209
+
210
+ end
@@ -0,0 +1,96 @@
1
+ class RGhost::Barcode::Auspost < RGhost::Barcode::Base
2
+
3
+ end
4
+ class RGhost::Barcode::Azteccode < RGhost::Barcode::Base
5
+
6
+ end
7
+ class RGhost::Barcode::Code11 < RGhost::Barcode::Base
8
+
9
+ end
10
+ class RGhost::Barcode::Code128 < RGhost::Barcode::Base
11
+
12
+ end
13
+ class RGhost::Barcode::Code2of5 < RGhost::Barcode::Base
14
+
15
+ end
16
+ class RGhost::Barcode::Code39 < RGhost::Barcode::Base
17
+
18
+ end
19
+ class RGhost::Barcode::Code93 < RGhost::Barcode::Base
20
+
21
+ end
22
+ class RGhost::Barcode::Datamatrix < RGhost::Barcode::Base
23
+
24
+ end
25
+ class RGhost::Barcode::Ean13 < RGhost::Barcode::Base
26
+
27
+ end
28
+ class RGhost::Barcode::Ean2 < RGhost::Barcode::Base
29
+
30
+ end
31
+ class RGhost::Barcode::Ean5 < RGhost::Barcode::Base
32
+
33
+ end
34
+ class RGhost::Barcode::Ean8 < RGhost::Barcode::Base
35
+
36
+ end
37
+ class RGhost::Barcode::Interleaved2of5 < RGhost::Barcode::Base
38
+
39
+ end
40
+ class RGhost::Barcode::Isbn < RGhost::Barcode::Base
41
+
42
+ end
43
+ class RGhost::Barcode::Kix < RGhost::Barcode::Base
44
+
45
+ end
46
+ class RGhost::Barcode::Maxicode < RGhost::Barcode::Base
47
+
48
+ end
49
+ class RGhost::Barcode::Msi < RGhost::Barcode::Base
50
+
51
+ end
52
+ class RGhost::Barcode::Onecode < RGhost::Barcode::Base
53
+
54
+ end
55
+ class RGhost::Barcode::Pdf417 < RGhost::Barcode::Base
56
+
57
+ end
58
+ class RGhost::Barcode::Pharmacode < RGhost::Barcode::Base
59
+
60
+ end
61
+ class RGhost::Barcode::Plessey < RGhost::Barcode::Base
62
+
63
+ end
64
+ class RGhost::Barcode::Postnet < RGhost::Barcode::Base
65
+
66
+ end
67
+ class RGhost::Barcode::Qrcode < RGhost::Barcode::Base
68
+
69
+ end
70
+ class RGhost::Barcode::Rationalizedcodabar < RGhost::Barcode::Base
71
+
72
+ end
73
+ class RGhost::Barcode::Raw < RGhost::Barcode::Base
74
+
75
+ end
76
+ class RGhost::Barcode::Royalmail < RGhost::Barcode::Base
77
+
78
+ end
79
+ class RGhost::Barcode::Rss14 < RGhost::Barcode::Base
80
+
81
+ end
82
+ class RGhost::Barcode::Rssexpanded < RGhost::Barcode::Base
83
+
84
+ end
85
+ class RGhost::Barcode::Rsslimited < RGhost::Barcode::Base
86
+
87
+ end
88
+ class RGhost::Barcode::Symbol < RGhost::Barcode::Base
89
+
90
+ end
91
+ class RGhost::Barcode::Upca < RGhost::Barcode::Base
92
+
93
+ end
94
+ class RGhost::Barcode::Upce < RGhost::Barcode::Base
95
+
96
+ end
@@ -0,0 +1,35 @@
1
+ @codes={
2
+ 'plessey' => ['01234ABCD',{}],
3
+ 'isbn' => ['978-1-56592-479',{:guard=> {:whitespace => true}}],
4
+ 'rsslimited' => ['00978186074271',{:format => 1}],
5
+ 'pdf417' => ['^453^178^121^239',{:columns => 2, :rows=> 10}],
6
+ 'royalmail' => ['LE28HS9Z',{}],
7
+ 'ean13' => ['977147396801',{:guard=> {:whitespace => true}}],
8
+ 'code11' => ['0123456789',{}],
9
+ 'symbol' => ['fima',{}],
10
+ 'qrcode' => ['000100000010000000001100010101100110000110000',{}],
11
+ 'msi' => ['0123456789',{}],
12
+ 'upca' => ['78858101497',{}],
13
+ 'pharmacode' => ['117480',{}],
14
+ 'kix' => ['1231FZ13XHS',{}],
15
+ 'datamatrix' => ['^142^164^186',{}],
16
+ 'rssexpanded' => ['000000010011001010100001000000010000',{}],
17
+ 'ean2' => ['05',{}],
18
+ 'rationalizedcodabar' => ['A0123456789B',{}],
19
+ 'upce' => ['0123456',{}],
20
+ 'ean5' => ['90200',{}],
21
+ 'code2of5' => ['01234567',{}],
22
+ 'code93' => ['THIS IS CODE 93',{}],
23
+ 'postnet' => ['012345',{}],
24
+ 'maxicode' => ['^059^042^041^059^040^03001^02996152382802^029840^029001^0291Z00004951^029UPSN^02906X610^029159^0291234567^0291^0471^029^029Y^029634 ALPHA DR^029PITTSBURGH^029PA^030^062^004^063', {:mode=> 2}],
25
+ 'raw' => ['331132131313411122131311333213114131131221323',{}],
26
+ 'onecode' => ['0123456709498765432101234567891',{}],
27
+ 'code39' => ['THIS IS CODE 39',{}],
28
+ 'auspost' => ['5956439111ABA 9',{}],
29
+ 'azteccode' => ['00100111001000000101001101111000010100111100101000000110',{:fofrmat=> :compact}],
30
+ 'ean8' => ['01335583',{}],
31
+ 'interleaved2of5' => ['24012345678905',{}],
32
+ 'code128' => ['^104^102Count^0990123456789^101!',{}],
33
+ 'rss14' => ['24012345678905',{}]
34
+
35
+ }
@@ -0,0 +1,8 @@
1
+ module RGhost::Barcode::VERSION #:nodoc:
2
+ MAJOR = 0
3
+ MINOR = 8
4
+ TINY = 0
5
+ DATE=1211827153
6
+ STRING = [MAJOR, MINOR, TINY].join('.')
7
+
8
+ end
data/lib/teste_main.rb ADDED
@@ -0,0 +1,94 @@
1
+ require 'rubygems'
2
+
3
+ require 'rghost_barcode'
4
+
5
+
6
+ #puts RGhost::Barcode::Text.new(:size => 10, :font => "Courier", :offset => [0,0], :x => 0, :y => 0, :color => '#000000', :enable => [:text, :check, :checkintext]).inspect
7
+ #puts RGhost::Barcode::Guard.new( :height => 1, :width => 10, :left=>3, :right => 4, :left_y => 5, :right_y => 6 ).inspect
8
+ #puts RGhost::Barcode::Border.new( :width => 1, :top => 0, :right => 0, :bottom => 0, :left => 0, :color => '#000000' ).inspect
9
+
10
+ p={:text => { :size => 10, :font => "Courier", :offset => [0,0], :x => 0, :y => 0, :color => '#000000', :enable => [:text, :check, :checkintext]},
11
+ :guard => { :height => 1, :width => 10, :left=>3, :right => 4, :left_y => 5, :right_y => 6 },
12
+ :border =>{ :width => 1, :top => 0, :right => 0, :bottom => 0, :left => 0, :color => '#000000'},
13
+ :height => 1, :width => 10,
14
+ :color => '000000', :background => 'FFFFFF',
15
+ :x => :limit_left, :y => :current_row,
16
+ :inkspread => 0.5
17
+ }
18
+
19
+
20
+ #puts RGhost::Barcode::Interleaved2of5.new("KJAHDFJASHDFAKSJDFASD",p).ps
21
+
22
+ #d=RGhost::Document.new :paper => [15,8], :margin_left => 2
23
+ ##d.set RGhost::Barcode::Code39.new("ASDHAJSDF", :x => 1, :y => 5, :color => 'FF0000', :border =>{:color => '00FF00'}, :text =>{:size => 10, :color => '553297' }, :height => 1, :width => 4.545)
24
+ ##d.barcode_isbn("978-1-56592-479", :x => 1, :y => 5, :color => 'FF0000', :border =>{:color => '00FF00'}, :text =>{:size => 10, :color => '553297' }, :height => 1, :width => 4.545)
25
+ ##d.barcode_isbn("978-1-56592-479", :x => 1, :y => 10, :text =>{:size => 10})
26
+ #d.define_template :barcode_template, File.join(File.dirname(__FILE__),'ps',"barcode_template.eps")
27
+ #d.before_page_create do
28
+ # use_template :barcode_template
29
+ #end
30
+ #@codes.each do |k,v|
31
+ #
32
+ # #d.rotate 90
33
+ # d.show "Barcode Name: #{k}"
34
+ #
35
+ # d.jump_rows 7
36
+ #
37
+ # opt=v[1].merge( :text => {:size => 10})
38
+ # #d.translate :x => 2
39
+ # d.send "barcode_#{k}".to_sym,v[0],opt.dup
40
+ # #d.translate :x => -2
41
+ # d.jump_rows 2
42
+ # d.show "Code String: #{v[0]}"
43
+ # d.next_row
44
+ # d.show "Options: #{opt.inspect}"
45
+ # d.next_page
46
+ #end
47
+ #text=%Q{
48
+ #<big>Barcode Writer License</big><br/>
49
+ #Anybody is free to use and develop this code as they see fit, under the terms of the permissive MIT/X-Consortium license(http://postscriptbarcode.googlecode.com/svn/trunk/LICENSE), which requires that developers attribute any derivative code to this project in both the source code and documentation. As such I take no liability for its use or misuse.<br/><br/>Thanks a lot Terry!<br/> <i>Shairon Toledo</i>
50
+ #
51
+ #}
52
+ #d.text text
53
+
54
+ f="/tmp/fonte#{rand*100}.pdf"
55
+ RGhost::Config.barcode_examples.render :pdf, :filename => "/tmp/rghost_barcode_catalog.pdf", :debug => true, :logfile => '/tmp/teste.txt'
56
+ exit
57
+ include RGhost
58
+ doc=Document.new :paper => [10.8,4], :margin => 0.3
59
+ doc.jump_rows 5
60
+ #doc.barcode_datamatrix '^142^164^186',:columns => 32, :rows=> 32
61
+ #doc.barcode_pdf417 '^453^178^121^239', :columns => 2, :rows=> 10
62
+ #doc.barcode_interleaved2of5 '24012345678905',:text => {:size => 10, :offset => [0,-10], :enable => [:text, :check, :checkintext] }
63
+ #doc.barcode_interleaved2of5 '24012345678905',:rotate => 90, :x => 4,
64
+ # :text => {
65
+ # :size => 10,
66
+ # :offset => [0,-10],
67
+ # :enable => [:text, :check, :checkintext]
68
+ #
69
+ #}
70
+ #doc.barcode_code39 'THIS IS CODE 39',:text => {:size => 10, :enable=>[:check] }
71
+
72
+ f="/local/junk/bc/f5.png"
73
+ #doc.render :png, :filename => f, :resolution => 120
74
+ =begin
75
+ 'code11' => ['0123456789',{:text => {:size => 10}}],
76
+ 'symbol' => ['fima',{:text => {:size => 10}}],
77
+ 'qrcode' => ['000100000010000000001100010101100110000110000',{:text => {:size => 10}}],
78
+ =end
79
+ #RGhost::Config::GS[:extensions] << "/tmp/foo"
80
+
81
+ #RGhost::Config.environment_fonts.render :pdf, :filename => 'mycatalog.pdf'
82
+
83
+
84
+ `evince #{f}`
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+