Prawn-qrcodes is a project mainly written in Ruby, based on the Unlicense license.
Prawn extension to add QR codes in an easy way
Add QR codes to PDF files generated with Prawn.
prawn-qrcodes
is little Prawn extension that allow you to generate
and add QR codes to PDF files. It can generate QR codes from
The easiest way to add QR codes to your Prawn document is to use the
qrcode
function.
require 'prawn/qrcodes'
Prawn::Document.generate("qr-example.pdf") do
msg = "Hello world, this is a QR code"
text msg
qrcode msg
end
You can pass to qrcode
two kinds of options: layout options and QR
options.
The layout options allow you to specify how the QR code should be placed on the PDF page.
require 'prawn/qrcodes'
Prawn::Document.generate("qr-big.pdf") do
msg = "Hello world, this is a QR code"
text msg
qrcode msg, :position => :center,
:fit => [bounds.height, bounds.width]
end
The QR options let you change the way the QR codes are generated.
require 'prawn/qrcodes'
Prawn::Document.generate("qr-big.pdf") do
msg = "Hello world, this is a QR code"
text msg
qrcode msg, :level => :h
end
You can mix these options as you like.
require 'prawn/qrcodes'
Prawn::Document.generate("qr-big.pdf") do
msg = "Hello world, this is a QR code"
text msg
qrcode msg, :level => :h, :position => :center
end
prawn-qrcodes
uses the rqrcode
library for the generation of QR
codes.
prawn-qrcodes
is available on RubyGems.
$ gem install prawn-qrcodes
Once it has been installed, you can include it in your application with:
require 'prawn/qrcodes'
Original author: Gioele Barabucci [email protected]
This is free and unencumbered software released into the public domain.
See the UNLICENSE
file or http://unlicense.org/ for more details.