# J4L Micro QRCode for Delphi

Copyright J4L (http://www.java4less.com).

- Introduction
- Installation
- Examples
- Properties and methods

## Introduction

J4L Micro QRCode is a Dephi Component that will allow you to create Micro QRCode barcodes for your Delphi applications. The component has been developed using Delphi 4 and Delphi 7 so it should run in any Delphi version later than 4 by simply recompiling the source code.

The Micro QR Code format (also specified in the International Standard), is a variant of QR Code with a reduced number of overhead modules and a restricted range of sizes. A single finder pattern, is located at the upper left corner of the symbol as illustrated in the following figure.

Micro QR Code symbols have 4 version (version 1 to 4). The sizes of the barcodes are:

- version M1: 11 x 11 modules.

- version M2: 13 x 13 modules.

- version M3: 15 x 15 modules.

- version M4: 17 x 17 modules.

The maximum barcode capacity of Micro QR Code the largest barcode symbol size, (Version 4 error correction level L):

- numeric data (digits 0-9): 35 characters

- aphanumeric data (digits 0 - 9 , upper case letters A -Z and nine other characters: space, $ % * + - . /): 21 characters

- Byte data ( (bytes 0-255): 15 characters

- Kanji data ( hexadecimal values 8140 -9FFC and E040 - EBBF ): 9 characters

Supports 4 error correction levels:

- L ( 7% of the symbol codewords).
- M ( 15% of the symbol codewords).
- Q ( 25% of the symbol codewords). Only in version M4.

## Installation

In order to install from the Delphi source code (registered users only):

1. select main menu -> component -> install component
2. click on "browse" and select MicroQRCode.pas.
3. click "ok"
4. the control will appear in the "Barcodes" tab of the components palette.

## Examples

In order to run the sample application you must execute barcode1D2DDemo.exe.

> In the sample application you can set all properties of the Micro QRCode symbology.

> You can execute the following commands:

> - Refresh: repaint the symbol using the new properties.
> - Print.
> - Save BMP: save the symbol in bmp format.

> The source code for the sample program can be found in the demoSrc subdirectory.

## Properties and methods

The TMicroQRCode component has the following properties and methods:

> ### Methods

> - paintBarcode(canvas): paints the barcode on the provided canvas.

>   You can use the component in order to paint onto an external canvas. For example, in order to create a bitmap file you would use the following code:

>   > var
>   > bmp: TBitmap;
>   > begin
>   > bmp:=TBitmap.create();
>   > bmp.height:=200;
>   > bmp.width:=200;
>   > {use paintBarcode() to paint onto an external Canvas}
>   > barcode.paintBarcode(bmp.Canvas);

>   > bmp.saveToFile('barcode.bmp');
>   > end;

> ### Properties

> - autoConfigurate: set it to true to select a larger barcode version (see preferredVersion) if the amount of data requires it.
> - backColor: back color of the barcode.
> - barColor: color of the bars.
> - code: this is the value to be encoded.
> - setCodeBinary(): value to be encoded (as TMicroQRIntegerArray which is an array of Integer values).
> - correctionLevel: Four levels of error correction recovery are defined in QR Code:
>   - LEVEL_L = 0 ( 7 % )
>   - LEVEL_M = 1 ( 15 % )
>   - LEVEL_Q = 2 ( 25% )
> - encoding: valid encoding algorithms are:
>   - ENC_ALPHA = 0: encodes alphanumeric characters (digits 0 - 9; upper case letters A -Z; nine other characters: space, $ % * + - . / : ); )
>   - ENC_BYTE = 1: encodes binary values ( 8-bit data)
>   - ENC_NUMERIC = 2: encodes numeric values only (digits 0-9)
>   - ENC_KANJI = 3: encodes Kanji characters. Kanji characters in QR Code can have values 8140 -9FFC and E040 - EBBF
>   - ENC_AUTO = 4: automatic seleccion of the encoding algorithm
> - currentX (readonly): real size of the barcode. The value is set after the barcode is painted. Can be use to create an image of the exact size.
> - currentY (readonly): real size of the barcode. Can be use to create an image of the exact size.
> - PreferredVersion: Size (version) of the barcode , it can be any value between 1 and 4. If the autoconfigurate option is active a larger version will be automatically selected if the amount of data requires it.
> - processTilde: process the " ~ " in the string to be encoded
>   ~dNNN represents the ascii character encoded by the 3 digits NNN. For exmaple, ~d065 represents the character 'A'.
> - margin: margin in pixels (default is 30).
> - moduleWidth: size in pixels of the dots in the barcode

## Annex A

Table — Data capacity for Micro QRCode versions

Version | Error Correction Level | Numeric | Alphanumeric | Byte | Kanji
1 |  | 5 | - | - | -
2 | L M | 10 8 | 6 5 | - | -
3 | L M | 23 18 | 14 11 | 9 7 | 6 4
4 | L M Q | 35 30 21 | 21 18 13 | 15 13 9 | 9 8 5

- Alphanumeric mode is not available in Version M1 Micro QR Code symbols.

- Byte mode is not available in Version M1 or M2 Micro QR Code symbols.

- Kanji mode is not available in version M1 or M2 Micro QR Code symbols.