Skip to content

QR Code Generator in Imperia#

In this chapter, we will introduce you to the QR code generator in Imperia. This is an advanced feature that requires separate purchase. If you are interested in using QR codes within your Imperia environment, please contact your Imperia sales representative for further information.

Using QR Codes in Templates#

To use QR codes within a template, you need to implement the following instruction:

<?imperia qrcode
    option: value
    option: value   
?>

Below are some example configurations:

<?imperia qrcode
    messagemetakey: some_doc_meta_key
    scale: 2
    margin: 4
    level: L
    type: png
    filename: "Images/qrcode.png"
    inline: 1
?>

Or:

<?imperia qrcode
    message: "Simple &quot;html&quot; encoded message"
    scale: 3
    margin: 5
    level: Q
    preview: 1
    color: #4599AA
    radius: 1
?>

Configuration Options#

message#

The message option is used to enter the data or text to be encoded as a QR code. This message can be plain text or HTML encoded. This option is mandatory and cannot be left empty.

Note: New lines must be HTML escaped.

messagemetakey#

The messagemetakey is an alternative to the message option. With this option, the data to be encoded is taken from the specified document meta field.

Important: The messagemetakey and message options cannot be used together. If messagemetakey is specified, it has a higher priority and is used instead of message.

inline#

The inline option generates a QR code and prints the result image as a Base64 encoded string.

Note: The inline option cannot be used together with the preview option.

preview#

The preview option generates an HTML image tag with a Base64 encoded source. The output format of that image is always .png.

Note: The preview option cannot be used together with the inline option.

color#

The color option specifies the color of the generated QR code. The value should be a hexadecimal color code (e.g. #00FF00).

radius#

Imperia provides the option to use an Oil Paint filter for generated QR codes. This filter makes the QR code look more artistic. The radius option specifies the rounding radius of the filter. Possible values range from 0 (default) to 2.

Tip: Higher values for the radius option may distort the QR code and make it unreadable for QR scanners. Because of this, it is recommended to use lower values and higher error correction levels.

scale#

The scale option specifies the scale of the generated QR code. The values can range between 1 and 255.

margin#

The margin option specifies the margin of the generated QR code. The values can range between 0 and 255.

level#

The level option specifies the error correction precision. The accepted values are L, M, Q, and H (lower to higher precision).

type#

The type option specifies the QR code image export format. The supported formats are:

  • png
  • jpeg
  • ASCII

filename#

The filename option contains a relative path to DOCUMENT_ROOT, where the QR code will be stored.

Note: The file is saved on the file system and is not part of the MAM.