# RAztec Code for Delphi

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

- Introduction
- Installation
- Example
- Methods and Fields of the component

## Introduction

RAztec code is a Dephi Component that will allow you to create Azte 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.

Aztec Code is a 2D matrix symbology made up of square modules on a square grid, with a square bullseye pattern at their center. Aztec Code symbols can encode large amounts of data with user defined error correction level.

The smallest format can encode 13 numeric , 12 alphabetic characters or 6 bytes of data, while the largest format can encode 3832 numeric ,3067 alphabetic characters or 1914 bytes of data.

available formats are:

Rows / columns (number of modules/squares) | Capacity (digits) | Capacity (text) | Capacity (binary data)
CONFIGURATION_15X15_COMPACT | 13 | 12 | 6
CONFIGURATION_19X19 | 18 | 15 | 8
CONFIGURATION_19X19_COMPACT | 40 | 33 | 19
CONFIGURATION_23X23 | 49 | 40 | 24
CONFIGURATION_23X23_COMPACT | 70 | 57 | 33
CONFIGURATION_27X27 | 84 | 68 | 40
CONFIGURATION_27X27_COMPACT | 110 | 89 | 53
CONFIGURATION_31X31 | 128 | 104 | 62
CONFIGURATION_37X37 | 178 | 144 | 87
CONFIGURATION_41X41 | 232 | 187 | 114
CONFIGURATION_45X45 | 294 | 236 | 145
CONFIGURATION_49X49 | 362 | 291 | 179
CONFIGURATION_53X53 | 433 | 348 | 214
CONFIGURATION_57X57 | 516 | 414 | 256
CONFIGURATION_61X61 | 601 | 482 | 298
CONFIGURATION_67X67 | 691 | 554 | 343
CONFIGURATION_71X71 | 793 | 636 | 394
CONFIGURATION_75X75 | 896 | 896 | 446
CONFIGURATION_79X79 | 1008 | 808 | 502
CONFIGURATION_83X83 | 1123 | 900 | 559
CONFIGURATION_87X87 | 1246 | 998 | 621
CONFIGURATION_91X91 | 1378 | 1104 | 687
CONFIGURATION_95X95 | 1511 | 1210 | 753
CONFIGURATION_101X101 | 1653 | 1324 | 824
CONFIGURATION_105X105 | 1801 | 1442 | 898
CONFIGURATION_109X109 | 1956 | 1566 | 976
CONFIGURATION_113X113 | 2216 | 1694 | 1056
CONFIGURATION_117X117 | 2281 | 1826 | 1138
CONFIGURATION_121X121 | 2452 | 1963 | 1224
CONFIGURATION_125X125 | 2632 | 2107 | 1314
CONFIGURATION_131X131 | 2818 | 2256 | 1407
CONFIGURATION_135X135 | 3007 | 2407 | 1501
CONFIGURATION_139X139 | 3205 | 2565 | 1600
CONFIGURATION_143X143 | 3409 | 2728 | 1702
CONFIGURATION_147X147 | 3616 | 2894 | 1806
CONFIGURATION_151X151 | 3832 | 3067 | 1914

Compact formats can be used to encode short messages in a more efficient manner than full range formats. Note that reader/decoder can autodiscrimanate between both formats.

There are also a set of 256 special formats called "Aztec runes" which can be used for encoding values 0 to 255 for special applications.

RAztecCode supports:

- All Aztec code formats (compact and full range).
- Normal and binary encoding.
- Structured append. This allows you to encode large messages by means of a secuence of symbols.
- Extended Channel Interpretation.
- Reader initialization bit.
- Aztec Runes.

## 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 AztecCode.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 aztecDemo.exe or 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.

## Properties and methods

##

The TAztecCode component can be placed on any form or container. This is the easiest way to use it , however you can also create an instance of the component by program and then paint the barcode on any canvas object using the paintBarcode() method.

The TAztecCode 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: if true the preferredConfiguration can be ignored if the data does not fit.
> - backColor: background color.
> - barColor: foreground color (color of the bars).
> - code: string to be encoded.
> - configurationType: use this property to define which formats can be used: CONFIGURATION_ANY (any), CONFIGURATION_COMPACT (only compact formats) or CONFIGURATION_FULL (only full range formats).
> - correctionLevel: percentage of errors which can be recovered (default is 23, 23%)
> - currentX (read only): final position of the cursor. Use this properry to find out the size of the image in pixels.
> - currentY (read only): final position of the cursor. Use this properry to find out the size of the image in pixels.
> - encoding: encoding mode (default is NORMAL). Value values are:
>   - NORMAL: can encode any character but it is not very efficient encoding binary values (values above 128).
>   - BINARY: use this mode only if your data contains many bytes/characters above 128.
> - margin: left and top margin in pixels (default is 30).
> - moduleSize: number of pixels which make a module (square) in the barcode (default is 4).
> - preferredConfiguration: preferred format. Another format will be automatically selected if AutoConfigurate=true and the amount of data and the selected error correction level does not fit in the preferred format. Valid values are CONFIGURATION_15X15_COMPACT, CONFIGURATION_19X19 .... and so on (see table).
> - processTilde: if true (default) the tilde character (~) will be processed like this:
>   - ~~: will be replaced with ~
>   - ~dxxx: will be replaced by the character whose ascii code is xxx. For example ~d065 will be replaced with A.
>   - ~F: will be replaced with the FNC1 flag (allowed as first codeword only).
>   - ~Exxxxxx: will be replaced with the Extended Interpretation Channel flag xxxxxx. For example to activate Extended Interpretation Channel 1, use ~E000001.
> - rebuild: set this property to true if you need to rebuild the barcode.
> - readerInitialization: if true the reader initialization flag will be set.
> - rune: set a value between 0 and 255 to create a Aztec code rune (default is -1, disabled)
> - topMargin: top margin in pixels (default is 10).

> Structured Append properties

> - structuredAppend: if true, the structured append mode is enabled (default is false).
> - StructuredAppendCounter: number of symbols which make the sequence.
> - StructuredAppendIndex: position of current symbol within the secuence (starting at 0).
> - FileID: file identifier for structured append (recommended to use uppercase characters only).