Home Contents | # QR-Code | Graphics | Core4 Lua Commands

## SYNOPSIS

1. width, height = gcx:barcode("QR", x, y, module_width, module_height, text [, param])
2. width, height = gcx:barcodesize("QR", x, y, module_width, module_height, text [, param])

## DESCRIPTION

Draws a Quick Response Code at the coordinates x, y. This is a square 2D matrix code.

QR code supports numeric, ASCII and full binary. It has four different error-correction levels. In the highest level, it is still decodable with up to 30% of the barcode destroyed. The barcode supports 40 different sizes, with the largest being able to hold 2953 bytes of data.

The optional param parameter table can be used to control the barcode generation. The table can have the fields:

ecc | Force the error correction level. Values are "auto", "L", "M", "Q" or "H". It also accepts the numbers 0 for auto and 1..4 for levels L, M, Q and H.
version | Select the barcode size from 1..40.

If no extra parameters are given, the ecc defaults to M and the size is automatically chosen to the smallest value that can hold the given data.

The parameters module_width and module_height specify the size of one dot. These values must be chosen so the dots appear square on the output. For 200 dpi printers, a value of at least 3 is recommended.

## RETURN VALUE

On success, returns the width and height of the resulting barcode in pixels. If the barcode cannot be drawn due to invalid parameters, returns nil, nil.