pdf417
A wrapper for the pdf417lib C Library, from the README:
A library to generate the 2D barcode PDF417
Project: http://pdf417lib.sourceforge.net/
Creator: Paulo Soares ([email protected])
License: LGPL or MPL 1.1
This library generates a PDF417 image of the barcode in a 1x1 scale.
It requires that the displayed image be as least stretched 3 times
in the vertical direction in relation with the horizontal dimension.
Fetching the codewords only can be handy for using rtex and the pst-barcode package. If you’re using prawn or RMagic the to_blob function should help generate a complete barcode.
Much of this was based off of reading through the Nokogiri and RMagic source code. Thanks!
Usage
There are a few ways to use the library, at its simplest:
PDF417.encode_text("readable barcode data") => [12, 827, 120, 90, 41, 146, 30, 512, 423, 146, 90, 570]
If you want to get the raw barcode data from the PDF417 library:
= PDF417.new("readable barcode data")
.to_blob # oops, wrong text
.text = "ACTUAL barcode data"
.to_blob
If you want to get it as an array of strings (each array element representing a line)
.encoding
If you have chunky_png installed and you’d rather have a PNG
.to_png
See the RDocs for more information.
Note on Patches/Pull Requests
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but
bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright
Copyright © 2011 jamesprior. See LICENSE for details.