Skip to content

Instantly share code, notes, and snippets.

@bradediger
Created February 10, 2012 19:24
Show Gist options
  • Save bradediger/1791941 to your computer and use it in GitHub Desktop.
Save bradediger/1791941 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