Barcode Generator for PHP
Barcode Generator for ASP.NET
Aztec Barcode - User Guide

Installation
You must have installed the following program and extension:
  • PHP 5
  • GD2 Extension
You can refer to the INSTALL file provided with the ZIP file.

Creating Barcode
The following code explains you step after step how to create Aztec barcode.
Check the manual to obtain more information on the available methods.
First, you must include required files to draw your barcode
require('class/BCGColor.php');
require('class/BCGDrawing.php');
include('class/BCGaztec.barcode2d.php');

Let's generate some colors
// The arguments are R, G, B for color.
$colorfg = new BCGColor(0,0,0);
$colorbg = new BCGColor(255,255,255);

Now, we have to create the barcode. There is no parameter for the class constructor; you have to call the provided methods to modify the barcode properties (see the manual). To end, you have to call the function parse() in order to analyze the code you want to draw.
$code = new BCGaztec();
$code->setScale(2); // Scale
$code->setErrorLevel(23); // Error correction level
$code->setSize(BCGaztec::AZTEC_SIZE_SMALLEST); // Size
$code->setColor($colorfg, $colorbg); // Colors
$code->setTilde(true); // Activate special characters
$code->parse('HELLO'); // Text

In this part, you have to put the barcode on a drawing image. We use the BCGDrawing class, but you can use any other class which draws an image in a file or displays it on the screen. The first argument is the filename, if this one is empty, the image will appear on the screen. The last argument is the background color.
$drawing = new BCGDrawing('', $colorfg);
$drawing->setBarcode($code);
$drawing->draw();

We now change the header to say to the browser that we will output an image. If you output it to a file, you don't have to put this line. If the image is a jpg, you must modify it.
header('Content-Type: image/png');

To finish, call the finish method with the argument BCGDrawing::IMG_FORMAT_PNG or BCGDrawing::IMG_FORMAT_JPEG to have a png or a jpg file. If you have specified a filename before, the image will be saved into this file, otherwise it will be displayed.
$drawing->finish(BCGDrawing::IMG_FORMAT_PNG);

Reading Barcode
Maybe you are wondering how to read barcode? You need a barcode reader to read them. For 2D barcode readers, the most known is the CCD (no laser, but digital).
This kind of reader can read the barcode you have generated with Barcode Generator if your reader can read the symbology you chose.
But what resolution you need to choose? We advise you to choose the default resolution for the barcode, but you can try to set it smaller but you will have to stay closer the barcode to read it correctly. At the opposite, if your barcode is bigger, you can read from further.

Example
Select Language: Français