Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save sahidursuman/a977c18f5b9d0e5ce96bea8b07e09583 to your computer and use it in GitHub Desktop.

Select an option

Save sahidursuman/a977c18f5b9d0e5ce96bea8b07e09583 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'prawn'
require 'barby'
require 'barby/barcode/qr_code'
require 'barby/outputter/prawn_outputter'
Prawn::Document.generate("barcode.pdf") do |pdf|
pdf.bounding_box([0, pdf.cursor], :width => 100, :height => 100) do
Barby::QrCode.new("hello", :level => :h).annotate_pdf(pdf)
end
pdf.move_down 200
pdf.bounding_box([0, pdf.cursor], :width => 100, :height => 100) do
Barby::QrCode.new("hello\t", :level => :h).annotate_pdf(pdf)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment