HexaPDF Extras

HexaPDF Extras

This library contains additional functionality that is not provided by the main HexaPDF library.

To use it, just require 'hexapdf-extras' and it will update the HexaPDF configuration settings to make the various extensions available.

Note that you need to install the dependencies of the features you use yourself as they are not listed in the gem file!

QR code Generator

This extension plugs into the graphic objects and boxes system of HexaPDF and allows one to easily create a fully-scalable QR code:

require 'hexapdf'
require 'hexapdf-extras'

doc = HexaPDF::Document.new
canvas = doc.pages.add.canvas
canvas.draw(:qrcode, at: [100, 100], size: 200, data: "https://hexapdf.gettalong.org")

Underneath the rqrcode_core library is used for actually generating the QR code. This means you need to install that library for this extension to work.

The data argument can be any data that rqrcode_core understands. The other options understood by rqrcode_core are also supported.

See HexaPDF::Extras::GraphicObject::QRCode and HexaPDF::Extras::Layout::QRCodeBox for details.

Note: There was a bug in poppler (already fixed) which leads to invalid rendering in Okular (as of 2022-08-06).