toretore / barby

The Ruby barcode generator

Home Page:http://toretore.github.com/barby/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues in scanning generated pdf417 barcode

Piyushchandra1987 opened this issue · comments

Additional information for #47
I have added a sample program in Pdf417Barcode

Here is sample program I am using
code file

barcode_data = "Test Barcode"
postal_barcode = Barby::Pdf417.new(barcode_data)
image = Barby::PngOutputter.new(postal_barcode).to_png
File.open('barcode.png', 'w'){|f| f.write image }

you can check generated barcode

I am able to scan barcode generated by java library using
java Pdf417lib test_barcode.ps "Test Barcode"

OS : Mac OS X Yoesmite 10.10.3
Jruby version : jruby 1.7.20 (1.9.3p551) 2015-05-04 3086e6a on Java HotSpot(TM) 64-Bit Server VM 1.8.0_25-b17 +jit [darwin-x86_64]
Gems Used

for verifying I am using this site Online Barcode Decoder

and Barcode scanners by manatee Works on my android phone

Finally found the issue. In Pdf417 class in encoding method while parsing the byte stream we have to remove first bit from output of sprintf("%08b", (byte & 0xff) | 0x100) .

I have overriden encoding method of Pdf417 class to solve it. Here is my implementation

byte stream before removing first bit
111111111101010100101111101101001111110110101100001100100011101101011100100001111111101000110100100

byte stream after removing first bit
1111111101010100011111010100111110110101000011000001110101011100000011111110100010100100

now i am able to scan the generated barcode.

Had same issue +1 for superb solution!!!!

Kudos Piyushchandra1987