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

Ruby Ghostscript Barcode

Now(after rghost version 0.9), you can easily create 82 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     

Generate barcode catalog


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


See the catalog of 82 Barcodes

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_hibcpdf417 'A123BJC5D6E71',:columns => 2, :rows=> 10, :text => {:size => 10}   

Supported codes

  • auspost – AusPost 4 State Customer Code
  • azteccode – Aztec Code
  • bc412 – BC412
  • channelcode – Channel Code
  • codablockf – Codablock F
  • code11 – Code 11
  • code128 – Code 128
  • code16k – Code 16K
  • code2of5 – Code 25
  • code32 – Italian PharmaCode
  • code39ext – Code 39 Extended
  • code39 – Code 39
  • code49 – Code 49
  • code93ext – Code 93 Extended
  • code93 – Code 93
  • codeone – Code One
  • daft – Raw DAFT succession for custom 4 state symbologies
  • databarexpandedcomposite – GS1 DataBar Expanded Composite
  • databarexpandedstackedcomposite – GS1 DataBar Expanded Stacked Composite
  • databarexpandedstacked – GS1 DataBar Expanded Stacked
  • databarexpanded – GS1 DataBar Expanded
  • databarlimitedcomposite – GS1 DataBar Limited Composite
  • databarlimited – GS1 DataBar Limited
  • databaromnicomposite – GS1 DataBar Omnidirectional Composite
  • databaromni – GS1 DataBar Omnidirectional
  • databarstackedcomposite – GS1 DataBar Stacked Composite
  • databarstackedomnicomposite – GS1 DataBar Stacked Omnidirectional Composite
  • databarstackedomni – GS1 DataBar Stacked Omnidirectional
  • databarstacked – GS1 DataBar Stacked
  • databartruncatedcomposite – GS1 DataBar Truncated Composite
  • databartruncated – GS1 DataBar Truncated
  • datamatrix – Data Matrix
  • ean13composite – EAN-13 Composite
  • ean13 – EAN-13
  • ean14 – GS1-14
  • ean2 – EAN-2 (2 digit addon)
  • ean5 – EAN-5 (5 digit addon)
  • ean8composite – EAN-8 Composite
  • ean8 – EAN-8
  • flattermarken – Flattermarken
  • gs1_128composite – GS1-128 Composite
  • gs1_128 – GS1-128
  • gs1_cc – GS1 Composite 2D Component
  • hibccodablockf – HIBC Codablock F
  • hibccode128 – HIBC Code 128
  • hibccode39 – HIBC Code 39
  • hibcdatamatrix – HIBC Data Matrix
  • hibcmicropdf417 – HIBC MicroPDF417
  • hibcpdf417 – HIBC PDF417
  • hibcqrcode – HIBC QR Code
  • identcode – Deutsche Post Identcode
  • interleaved2of5 – Interleaved 2 of 5 (ITF)
  • isbn – ISBN
  • ismn – ISMN
  • issn – ISSN
  • itf14 – ITF-14
  • japanpost – Japan Post 4 State Customer Code
  • kix – Royal Dutch TPG Post KIX 4-State Barcode
  • leitcode – Deutsche Post Leitcode
  • maxicode – MaxiCode
  • micropdf417 – MicroPDF417
  • msi – MSI Modified Plessey
  • onecode – United States Postal Service Intelligent Mail
  • pdf417 – PDF417
  • pharmacode2 – Two-track Pharmacode
  • pharmacode – Pharmaceutical Binary Code
  • planet – United States Postal Service PLANET
  • plessey – Plessey UK
  • posicode – PosiCode
  • postnet – United States Postal Service POSTNET
  • pzn – Pharmazentralnummer (PZN)
  • qrcode – QR Code
  • rationalizedCodabar – Rationalized Codabar
  • raw – Raw bar space succession for custom symbologies
  • royalmail – Royal Mail 4 State Customer Code (RM4SCC)
  • sscc18 – SSCC-18
  • symbol – Miscellaneous symbols
  • telepen – Telepen
  • upcacomposite – UPC-A Composite
  • upca – UPC-A
  • upcecomposite – UPC-E Composite
  • upce – UPC-E

For more details see Terry Burton page.

Documentation

Thanks

Terry Burton for all.