HexaPDF Extras

class HexaPDF::Extras::Layout::QRCodeBox

A QRCodeBox object is used for displaying a QR code.

The size of the QR code is determined by the width and height of the box (to be exact: by the smaller of the two values). The QR code is always placed at the top left corner of the box.

Internally, HexaPDF::Extras::GraphicObject::QRCode is used, so any option except at and size supported there can be used here.

Example:

composer.box(:qrcode, height: 50, data: 'Test', style: {position: :float})
composer.box(:qrcode, width: 20, data: 'Test', dark_color: 'red', style: {position: :float})
composer.box(:qrcode, width: 30, height: 50, data: 'Test', dark_color: 'green',
             style: {position: :float})
composer.box(:qrcode, data: 'Test', dark_color: 'blue')

Attributes

qr_code[R]

The HexaPDF::Extras::GraphicObject::QRCode object that will be drawn.

Public Class Methods

new(dark_color: nil, light_color: nil, data: nil, code_size: nil, max_code_size: nil, level: nil, mode: nil, **kwargs)

Creates a new QRCodeBox object with the given arguments (see HexaPDF::Extras::GraphicObject::QRCode for details).

At least data needs to be specified.

Calls superclass method

Public Instance Methods

fit(available_width, available_height, _frame)

Fits the QRCode into the given area.

Calls superclass method