jeudi 24 décembre 2015

Generate gs1 128 barcode in Ruby on Rails

I am using barby gem to generate gs1-128 barcode. I am able to save the barcode in a .png file. Below is the code i am using,

def pti_label_preview   
    gtin_no =  params[:gtin_no]    
    barcode = Barby::GS1128.new(gtin_no,'C','12')   
    full_path = "#{Rails.root}/public/uploads/barcode.svg"
    File.open(full_path, 'w') { |f| f.write barcode.to_svg(:margin => 3, :xdim => 2, :height => 55) }
    render :text => path
  end

I created it by referring this. Barby::GS1128.new(gtin_no,'C','12') is accepting 3 argument, i want to know what are the 3 values i have to send to create barcode.

I have following values gs1_prefix, item no, check sum value, gtin no, lot no etc. What are the 3 values should i pass to GS1128 method

Aucun commentaire:

Enregistrer un commentaire