Skip to main content

AztecCodeOptionsBuilder Class

Builds an AztecCodeOptions object. Use chained builder methods to configure barcode settings, then call the build() method to create the options object.

Declaration

public class AztecCodeOptionsBuilder extends BarcodeOptionsBuilder<AztecCodeOptions,AztecCodeOptionsBuilder>

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.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.initFields()
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

AztecCodeOptionsBuilder()

Initializes a new instance of the AztecCodeOptionsBuilder class.

Declaration

public AztecCodeOptionsBuilder()

Methods

create() Method

Creates a AztecCodeOptionsBuilder instance.

Declaration

public static AztecCodeOptionsBuilder create()

Returns

Type Description
AztecCodeOptionsBuilder

Created instance.

withCompactionMode(AztecCodeCompactionMode mode) Method

Specifies the Aztec Code encoding mode and returns the builder instance for method chaining.

Declaration

public AztecCodeOptionsBuilder withCompactionMode(AztecCodeCompactionMode mode)

Parameters

Name Type Description
mode AztecCodeCompactionMode

Encoding mode.

Returns

Type Description
AztecCodeOptionsBuilder

The current AztecCodeOptionsBuilder instance for method chaining.

withErrorCorrectionLevel(AztecCodeErrorCorrectionLevel correctionLevel) Method

Specifies the Aztec Code error correction level that compensates for damaged or incorrectly scanned barcodes. Returns the builder instance for method chaining.

Declaration

public AztecCodeOptionsBuilder withErrorCorrectionLevel(AztecCodeErrorCorrectionLevel correctionLevel)

Parameters

Name Type Description
correctionLevel AztecCodeErrorCorrectionLevel

Error correction level.

Returns

Type Description
AztecCodeOptionsBuilder

The current AztecCodeOptionsBuilder instance for method chaining.

withVersion(AztecCodeVersion version) Method

Specifies the Aztec Code version. Returns the builder instance for method chaining.

Declaration

public AztecCodeOptionsBuilder withVersion(AztecCodeVersion version)

Parameters

Name Type Description
version AztecCodeVersion

Aztec Code version.

Returns

Type Description
AztecCodeOptionsBuilder

The current AztecCodeOptionsBuilder instance for method chaining.