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

## SYNOPSIS

1. width, height = gcx:barcode("EAN", x, y, module_width, barcode_height, text)
2. width, height = gcx:barcodesize("EAN", x, y, module_width, barcode_height, text)
3. width, height = gfx.barcodesize("EAN", x, y, module_width, barcode_height, text)

## DESCRIPTION

Draws a EAN code at the coordinates x, y.

The EAN is a numeric barcode and is supported in two forms: EAN-13 or EAN-8. The barcode length is automatically detected via the length of the text parameter.

If the text is 7 or 8 digits long, a EAN-8 code is generated. In case of 7 digits, the check-digit is added automatically.

If the text is 12 or 13 digits long, a EAN-13 code is generated. In case of 12 digits, the check-digit is added automatically.

Note that if the check-digit is passed by the application, the barcode will be printed with that check-digit, even if it is wrong.

This function only generates the barcode. There are no human readable digits printed below the code.

The parameter module_width specifies the width of one Module unit. If the barcode is to be printed, the parameter should be at least 2, better 3.

The parameter barcode_height specifies the height of the full barcode in pixels.

## 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.