# RQRCode for Delphi

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

- Introduction
- Installation
- Examples
- Properties and methods

## Introduction

RQRCode is a Dephi Component that will allow you to create QRCode barcodes for your Delphi applications. The component can be used with any Delphi version starting with Delphi 4 (also tested with the most recent Delphi XE5) by simply recompiling the source code.

The QRCode following features are supported

- AUTO, BYTE, ALPHA, NUMERIC and KANJI encoding. QR Code symbols can endode the following amount of data (for maximum symbol size - Version 40, error correction level L):
  - numeric data: 7,089 characters
  - alphanumeric data: 4,296 characters
  - 8-bit byte data: 2,953 characters
  - Kanji data: 1,817 characters
- Structured append. This allows files of data to be represented logically and continuously in up to 16 QR Code symbols. These may be scanned in any sequence to enable the original data to be correctly reconstructed.
- Versions 1 to 40. The version is the size of the symbol. Version 1 is a 21x21 matrix and version 40 is a 177x177 matrix.
- Error correction levels L, H, M and Q.
- FNC1 mode. FNC1 mode is used for messages containing data formatted either in accordance with the UCC/EAN Application Identifiers standard or in accordance with a specific industry standard previously agreed with AIM International.
- Extended channel interpretation: This mechanism enables data using character sets other than the default encodable .

## 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 QRCode.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 Aztec code 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 TQRCode 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

> - applicationIndicator. used only if FNC1 mode is SECOND .
> - 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 TQRIntegerArray which is an array of Integer values).
> - eci: extended channel interpretation identifier.
> - correctionLevel: Four levels of error correction recovery are defined in QR Code:
>   - LEVEL_L = 0 ( 7 % )
>   - LEVEL_M = 1 ( 15 % )
>   - LEVEL_Q = 2 ( 25% )
>   - EVEL_H = 3 ( 30% )
> - 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
> - fnc1Mode:
>   - NO = 0 (default)
>   - FIRST = 1. This Mode Indicator identifies symbols encoding data formatted according to the UCC/EAN Application Identifiers standard.
>   - SECOND = 2. This Mode Indicator identifies symbols formatted in accordance with specific industry or application specifications previously agreed with AIM International. It is immediately followed by a one-byte codeword the value of which is that of the Application Indicator assigned to identify the specification concerned by AIM International.
> - 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 40. If the autoconfigurate option is active a larger version will be automatically selected if the amount of data requires it. The symbol size can be 21 * 21 modules to 177 * 177 modules (Versions 1 to 40, increasing in steps of 4 modules per side).
> - 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
> - structuredAppend: set it to true to enable the structured append mode.
> - structuredAppendIndex: index of the barcode within the structured append sequence.
> - structuredAppendTotal: number of symbols (barcodes) in the structured append sequence.