Module: RGhost::Config

Defined in:
lib/rghost_barcode/rghost_barcode_adapter.rb

Constant Summary collapse

BARCODE_EXAMPLES =
{
  'plessey' => ['01234ABCD',{ :text => {:size => 10}}],
  'isbn' => ['978-1-56592-479',{:text => {:size => 10}, :guard=>{:whitespace => true }}],
  'rsslimited' => ['00978186074271',{:height => 1 , :text => {:size => 10}}],
  'pdf417' => ['^453^178^121^239',{:text => {:size => 10}, :columns => 2,  :rows=> 10}],
  'royalmail' => ['LE28HS9Z',{:text => {:size => 10}}],
  'ean13' => ['977147396801',{ :guard=>{:whitespace => true }}],
  'code11' => ['0123456789',{:text => {:size => 10}}],
  'symbol' => ['fima',{:text => {:size => 10}}],
  'qrcode' => ['000100000010000000001100010101100110000110000',{:text => {:size => 10}}],
  'msi' => ['0123456789',{:text => {:size => 10}}],
  'upca' => ['78858101497',{:text => {:size => 10}}],
  'pharmacode' => ['117480',{:text => {:size => 10}}],
  'kix' => ['1231FZ13XHS',{:text => {:size => 10}}],
  'datamatrix' => ['^142^164^186',{:columns => 32,  :rows=> 32}],
  'rssexpanded' => ['000000010011001010100001000000010000',{:text => {:size => 10}}],
  'ean2' => ['05',{:text => {:size => 10}}],
  'rationalizedcodabar' => ['A0123456789B',{:text => {:size => 10}}],
  'upce' => ['0123456',{:text => {:size => 10}}],
  'ean5' => ['90200',{:text => {:size => 10}}],
  'code2of5' => ['01234567',{:text => {:size => 10}}],
  'code93' => ['THIS IS CODE 93',{:text => {:size => 10}}],
  'postnet' => ['012345',{:text => {:size => 10}}],
  '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, :text => {:size => 10}}],
  'raw' => ['331132131313411122131311333213114131131221323',{:text => {:size => 10}}],
  'onecode' => ['0123456709498765432101234567891',{:text => {:size => 10}}],
  'code39' => ['THIS IS CODE 39',{:text => {:size => 10}}],
  'auspost' => ['5956439111ABA 9',{:text => {:size => 10}}],
  'azteccode' => ['00100111001000000101001101111000010100111100101000000110',{:text => {:size => 10}, :format=> :compact}],
  'ean8' => ['01335583',{:text => {:size => 10}}],
  'interleaved2of5' => ['24012345678905',{
      :text => {:size => 10, :offset => [0,-10], :enable => [:text, :check, :checkintext] }, 
      :border => {:width => 4, :left => 15, :right => 15, :show => true}, 
      :height => 2
    }],
  'code128' => ['^104^102Count^0990123456789^101!',{:text => {:size => 10}}],
  'rss14' => ['24012345678905',{:text => {:size => 10}}]


}

Class Method Summary collapse

Class Method Details

.barcode_examplesObject

Generates catalog of barcodes.

RGhost::Config.barcode_examples.render :pdf, :filename => “/tmp/barcode_catalog.pdf”



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/rghost_barcode/rghost_barcode_adapter.rb', line 216

def self.barcode_examples() #(options={:text => {:size => 10}})
  d=RGhost::Document.new :paper => [15,8], :margin_left => 2
  #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)
  #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)
  #d.barcode_isbn("978-1-56592-479", :x => 1, :y => 10, :text =>{:size => 10})
  d.define_template :barcode_template,  File.join(File.dirname(__FILE__),'ps',"barcode_template.eps")
  d.before_page_create do
    use_template :barcode_template
  end
  RGhost::Config::BARCODE_EXAMPLES.each do |k,v|
    
    d.show "Barcode Name: #{k}"
    d.jump_rows 6
    #opt=v[1][:text][:size]=10
    opt=v[1]
    d.send "barcode_#{k}".to_sym,v[0],opt.dup
    d.jump_rows 2
    d.show "Code String: #{v[0]}"
    d.next_row
    d.text("Options: #{opt.inspect}",false)
    d.next_page
  end
  license=%Q{<big>Barcode Writer License</big><br/>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>   }
  d.text license
  d.next_row
  d.show "RGhost::VERSION #{RGhost::VERSION::STRING}" , :align => :page_right, :tag => :b
  d.next_row
  d.show "RGhost::Barcode::VERSION #{RGhost::Barcode::VERSION::STRING}" , :align => :page_right, :tag => :b
  d
end