Skip to content


Barcodes

In my application for work, I need to generate barcodes for a number of things. One of the nice things about the G1 is that I can scan all these QR Codes into my phone without any problem. Makes it very easy to test.

require 'rubygems'
require 'barby'
require 'barby/outputter/prawn_outputter'
 
data = "MECARD:N:David Mitchell;ORG:nStar Global Services, LLC;TEL:(801) 555-2855;URL:http://www.digitalbias.com;EMAIL:a@a.com;ADR:3707 South 604 North, Nephi, UT 81651;NOTE:EMP_ID:12232;;"
 
barcode = Barby::QrCode.new(data)
File.open('contact.pdf', 'w') do |f|
  f << barcode.to_pdf
end
 
data = "mailto:mitchelld@acm.org"
 
barcode = Barby::QrCode.new(data)
File.open('email.pdf', 'w') do |f|
  f << barcode.to_pdf
end
 
data = "BEGIN:VEVENT\nSUMMARY:Super size me\nDTSTART:20090122T151500Z\nDTEND:20090122T161500Z\nEND:VEVENT\n"
 
barcode = Barby::QrCode.new(data)
File.open('event.pdf', 'w') do |f|
  f << barcode.to_pdf
end

Posted in programming.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.