-- Classes and Modules --
README.rdoc
HexaPDF
HexaPDF::Extras
HexaPDF::Extras::GraphicObject
HexaPDF::Extras::GraphicObject::QRCode
HexaPDF::Extras::GraphicObject::Zint
HexaPDF::Extras::Layout
HexaPDF::Extras::Layout::QRCodeBox
HexaPDF::Extras::Layout::SwissQRBill
HexaPDF::Extras::Layout::SwissQRBill::Error
HexaPDF::Extras::Layout::ZintBox
-- Attributes and Methods --
::configure
::new
#at
#code_size
#configure
#dark_color
#data
#draw
#level
#light_color
#max_code_size
#mode
#size
class HexaPDF::Extras::GraphicObject::QRCode
Generates a QR code and renders it using simple PDF canvas graphics.
It implements the HexaPDF graphic object interface and can therefore easily be used via the :qrcode
name:
canvas .draw (:qrcode , data: 'hello' , size: 100 )
This class relies on rqrcode_core to generate the QR code from the given data. All options of rqrcode_core are supported, have a look at their documentation to see the allowed values.
at [RW]
The position of the bottom-left corner of the QR code.
Default: [0, 0].
Examples:
canvas .draw (:qrcode , data: 'test' , size: 30 )
canvas .draw (:qrcode , data: 'test' , size: 20 , at: [50 , 50 ])
code_size [RW]
The code size of the the QR code (normally called ‘version’).
This is directly passed to rqrcode_core as the size
argument.
Default: nil (i.e. let rqrcode_core decide)
Examples:
canvas .draw (:qrcode , data: 'test' , size: 100 , code_size: 10 )
dark_color [RW]
The color for the dark QR code modules (‘pixels’)
Default: ‘black’.
Examples:
canvas .draw (:qrcode , data: 'test' , size: 100 , dark_color: 'green' )
data [RW]
The data for which the QR code should be generated.
This is directly passed to rqrcode_core as the data
argument.
Default: none
level [RW]
The error correction level of the QR code.
This is directly passed to rqrcode_core as the level
argument.
Default: nil (i.e. let rqrcode_core decide)
Examples:
canvas .draw (:qrcode , data: 'test' , size: 100 , level: :l )
light_color [RW]
The color for the light QR code modules (‘pixels’).
Default: none (i.e. they are not drawn).
Examples:
canvas .draw (:qrcode , data: 'test' , size: 100 , light_color: 'yellow' )
max_code_size [RW]
The maximum code size of the QR code.
This is directly passed to rqrcode_core as the max_size
argument.
Default: nil (i.e. let rqrcode_core decide)
Examples:
canvas .draw (:qrcode , data: 't' * 100 , size: 100 , max_code_size: 10 )
mode [RW]
The mode of the QR code, i.e. which data it holds.
This is directly passed to rqrcode_core as the mode
argument.
Default: nil (i.e. let rqrcode_core decide)
Examples:
canvas .draw (:qrcode , data: 'test' , size: 100 , mode: :kanji )
size [RW]
The size of the whole rendered QR code.
Default: none
Examples:
canvas .draw (:qrcode , data: 'test' , size: 80 , at: [10 , 10 ])
draw (canvas)
Draws the QRCode
object onto the given Canvas, with the bottom-left corner at the position specified by at
and the size specified by size
.