Aztec Code
- 2 minutes to read
Aztec Code is a matrix code that has the potential to use less space than other matrix barcodes because it does not require a surrounding blank “quiet zone”. Aztec codes are widely used for transport ticketing.
Refer to the following article for more details: Aztec Code.
Add a Bar Code to a Report
To add a barcode to a report, follow these steps:
Drag the XRBarCode item from the DX.24.2: Report Controls tab and drop it onto the report.
Set the
XRBarCode
control’s Symbology property to Aztec Code (an object of the AztecCodeGenerator type).Specify common barcode properties and properties specific to Aztec Code.
Specific Properties
- AztecCodeGenerator.CompactionMode
- Specifies whether text or binary mode should be used to encode the barcode’s data.
- AztecCodeGenerator.Version
- Specifies the Aztec Code version.
- AztecCodeGenerator.ErrorCorrectionLevel
- Specifies the amount of redundancy built into the bar code to compensate for calculation errors.
Runtime Example
The following code snippet generates an Aztec Code barcode and specifies its properties:
using System.Collections.Generic;
using System.Drawing.Printing;
using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraReports.UI;
public XRBarCode CreateAztecCode(string BarCodeText) {
// Create a barcode control.
XRBarCode barCode = new XRBarCode();
// Set the barcode's type to Aztec Code.
barCode.Symbology = new AztecCodeGenerator();
// Adjust the barcode's main properties.
barCode.Text = BarCodeText;
barCode.Width = 300;
barCode.Height = 100;
// Adjust the properties specific to the barcode type.
((AztecCodeGenerator)barCode.Symbology).Version = AztecCodeVersion.Version27x27;
((AztecCodeGenerator)barCode.Symbology).ErrorCorrectionLevel = AztecCodeErrorCorrectionLevel.Level1;
((AztecCodeGenerator)barCode.Symbology).CompactionMode = AztecCodeCompactionMode.Text;
return barCode;
}
The code example below shows how to create a report with an Aztec Code barcode: