Skip to main content

AztecCodeOptions Class

Contains options specific to Aztec Code symbology.

Declaration

public class AztecCodeOptions extends BarcodeOptions

Remarks

Refer to the following help topic for additional information: Aztec Code.

The following code snippet creates an Aztec Code barcode and customizes its encoding parameters with the Fluent API:

import com.devexpress.drawing.*;
import com.devexpress.docs.barcode.*;
import com.devexpress.system.drawing.*;
import com.devexpress.docs.Padding;

import java.io.*;
import java.nio.file.*;

public class Main {
    public static void main(String[] args) throws Exception {

        AztecCodeOptions options = AztecCodeOptionsBuilder.create()
            .withCompactionMode(AztecCodeCompactionMode.TEXT)
            .withErrorCorrectionLevel(AztecCodeErrorCorrectionLevel.LEVEL_2)
            .withVersion(AztecCodeVersion.AUTO_VERSION)
            .withModuleSize(5)
            .withShowText(false)
            .build();

        Path outputDir = Path.of("output");
        Files.createDirectories(outputDir);

        try (FileOutputStream fileStream = new FileOutputStream(
                outputDir.resolve("aztec.png").toFile());
                BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
            barcodeGenerator.export(
                    "https://www.devexpress.com/try",
                    fileStream,
                    DXImageFormat.getPng());
        }
    }
}

Inherited Members

com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
JavaObject
BarcodeOptions
AztecCodeOptions

AztecCodeOptions()

Initializes a new instance of the AztecCodeOptions class.

Declaration

public AztecCodeOptions()

Methods

getCompactionMode() Method

Gets the mode used by the barcode to encode barcode data.

Declaration

public AztecCodeCompactionMode getCompactionMode()

Returns

Type Description
AztecCodeCompactionMode

Encoding mode.

Remarks

All 8-bit characters can be encoded into the Aztec Code. Refer to the following topic to get more information: ISO/IEC 8859-1.

getErrorCorrectionLevel() Method

Gets how much redundancy is built into the barcode to compensate for calculation errors.

Declaration

public AztecCodeErrorCorrectionLevel getErrorCorrectionLevel()

Returns

Type Description
AztecCodeErrorCorrectionLevel

The error level. Level2 is recommended.

getVersion() Method

Gets the Aztec Code version.

Declaration

public AztecCodeVersion getVersion()

Returns

Type Description
AztecCodeVersion

The Aztec Code version.

setCompactionMode(AztecCodeCompactionMode value) Method

Specifies how the barcode encodes data.

Declaration

public void setCompactionMode(AztecCodeCompactionMode value)

Parameters

Name Type Description
value AztecCodeCompactionMode

Encoding mode.

Remarks

All 8-bit characters can be encoded into the Aztec Code.

Refer to the following topic for additional information: ISO/IEC 8859-1.

setErrorCorrectionLevel(AztecCodeErrorCorrectionLevel value) Method

Specifies the amount of redundancy added to the barcode.

Declaration

public void setErrorCorrectionLevel(AztecCodeErrorCorrectionLevel value)

Parameters

Name Type Description
value AztecCodeErrorCorrectionLevel

The error level. Recommended: Level2

Remarks

Higher error-correction levels improve readability when the barcode is damaged or partially obscured but increase the barcode size.

setVersion(AztecCodeVersion value) Method

Specifies the Aztec Code version and the maximum amount of data that the barcode can store.

Declaration

public void setVersion(AztecCodeVersion value)

Parameters

Name Type Description
value AztecCodeVersion

The Aztec Code version.

Remarks

Use AUTO_VERSION to allow the API to choose the smallest version that fits the encoded data.