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.
Attributes
The data for which the QR code should be generated.
This is directly passed to rqrcode_core as the data
argument.
Default: none
Public Class Methods
Creates a QRCode
object.
Public Instance Methods
Configures the QRCode
object and returns self.
The following arguments are allowed:
- :at
-
The position of the bottom-left corner.
- :size
-
The size of the whole rendered QR code.
- :dark_color
-
The color used for the dark QR code modules ('pixels').
- :light_color
-
The color used for the light QR code modules ('pixels').
- :data
-
The data for the QR code.
- :code_size
-
The code size of the QR code.
- :max_code_size
-
The maximum code size of the QR code.
- :level
-
The error correction level of the QR code
- :mode
-
The mode of the of the QR code.
Any arguments not specified are not modified and retain their old value, see the attribute methods for the inital default values.