Skip to content
shairontoledo edited this page Mar 27, 2011 · 26 revisions

Ruby Ghostscript Barcode

Now(after rghost version 0.8), you can easily create 32 kinds of barcode in Ruby using RGhost and Barcode Writer in Pure PostScript by Terry Burton together in the same project rghost_barcode.


 require 'rghost'
 require 'rghost_barcode'  
 doc=RGhost::Document.new
 doc.barcode_code39('1234567', :x => 5, :y=> 10)    

After that you can convert the barcode to pdf, png, jpeg, tif and other formats or use it inside the document.

Installation


 gem install rghost
 gem install rghost_barcode      

or


 gem install rghost_barcode -y     

Generate barcode catalog


 RGhost::Config.barcode_examples.render :pdf, :filename => '/tmp/barcodes.pdf' 

Architecture

All barcodes will be available as the factory method of the class Document prefixed by barcode_. The following grammar is used

Document_instance.barcode_barcodename(code(String), options(Hash) )

Example for PDF417

doc=RGhost::Document.new 
doc.barcode_pdf417 '^453^178^121^239',:columns => 2, :rows=> 10, :text => {:size => 10}   

Supported codes

auspost, azteccode, code11, code128, code2of5, code39, code93, datamatrix, ean13, ean2, ean5, ean8, interleaved2of5, isbn, kix, maxicode, msi, onecode, pdf417, pharmacode, plessey, postnet, qrcode, rationalizedcodabar, raw, royalmail, rss14, rssexpanded, rsslimited, symbol, upca and upce.

For more details see Terry Burton page.

Documentation

Thanks

Terry Burton for all.

Clone this wiki locally