Hello,
I'm new using Barby Gem and generating barcodes. I'm working in Rails 4 and Postgresql.
The Barby gem work fine in DEVELOPMENT ENVIRONMENT, I created and printed a lot of barcodes without problems to read using a handheld scanner and cellphone's apps.
I have a problem: In PRODUCTION ENVIRONMENT the Barby Gem not work fine. I generate barcodes in a png files and I printed. When using a handheld scanner or cellphone's apps to read printed out barcodes back into the computer the numbers of the barcodes are wrong.
For example: I created the barcode 744, but when scanned barcode always show the number 653.
All barcodes created and printed in production environment always are same, with the number 653.
This is the code
Controller:
require 'barby'
require 'barby/barcode/code_128'
require 'barby/outputter/png_outputter'
def show
respond_with(@extintor)
@extintors = Extintor.where(pro_estado: 0)
@producto = Producto.all
@clientes = Cliente.all
barcode_value = sprintf('%012d', @extintor.ext_codigo)
barcode = Barby::Code128.new(barcode_value)
@blob = Barby::PngOutputter.new(barcode).to_png #Raw PNG data
files_path = "app/assets/images/ext_barcode.png"
File.open(files_path, 'wb') { |f| f.write @blob }
end
View:
<div id="myPrintCode">
<center>
<font face="Arial" size="0.5">
<%= @extintor.producto.pro_sigla %>
</font>
<br>
<%= image_tag("ext_barcode.png", size: "208x50") %>
<br>
<font face="Arial">
</font>
</center>
</div>
I hope to help me.
Thanks in advance.