Back to Devexpress

AztecCodeGenerator Class

corelibraries-devexpress-dot-xtraprinting-dot-barcode-ce753c1e.md

latest4.1 KB
Original Source

AztecCodeGenerator Class

Generates an Aztec Code barcode.

Namespace : DevExpress.XtraPrinting.BarCode

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public class AztecCodeGenerator :
    BarCode2DGenerator
vb
Public Class AztecCodeGenerator
    Inherits BarCode2DGenerator

Remarks

Refer to the following topic for details on this type of barcode: Aztec Code.

You can specify the following properties specific to the Aztec Code barcode type:

AztecCodeGenerator.CompactionModeSpecifies whether text or binary mode should be used to encode the barcode’s data.AztecCodeGenerator.VersionSpecifies the Aztec Code version.AztecCodeGenerator.ErrorCorrectionLevelSpecifies the amount of redundancy built into the bar code to compensate for calculation errors.

The following code snippet generates an Aztec Code barcode and specifies its properties:

View Example: How to add a bar code to a report

csharp
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Windows.Forms;
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;
}
vb
Imports System
Imports System.Collections.Generic
Imports System.Drawing.Printing
Imports System.Windows.Forms
Imports DevExpress.XtraPrinting.BarCode
Imports DevExpress.XtraReports.UI

Public Function CreateAztecCode(ByVal BarCodeText As String) As XRBarCode
    ' Create a barcode control.
    Dim barCode As 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.
    CType(barCode.Symbology, AztecCodeGenerator).Version = AztecCodeVersion.Version27x27
    CType(barCode.Symbology, AztecCodeGenerator).ErrorCorrectionLevel = AztecCodeErrorCorrectionLevel.Level1
    CType(barCode.Symbology, AztecCodeGenerator).CompactionMode = AztecCodeCompactionMode.Text

    Return barCode
End Function

Inheritance

Object DevExpress.Printing.Utils.DocumentStoring.StorableObjectBase BarCodeGeneratorBase BarCode2DGenerator AztecCodeGenerator

See Also

AztecCodeGenerator Members

DevExpress.XtraPrinting.BarCode Namespace