0

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

Terry Burton
  • 2,801
  • 1
  • 29
  • 41
user2681579
  • 1,413
  • 2
  • 23
  • 50

1 Answers1

0

You can pull the repo of that gem down and find this.

class GS1128 < Code128

  def initialize(data, type, ai)
    self.application_identifier = ai
    super(data, type)
  end
  ...
end

So the answer to your question is the 3 arguments you pass are data, type and ai

MilesStanfield
  • 4,571
  • 1
  • 21
  • 32