Skip to main content

MicroQRCodeOptionsBuilder Class

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

Declaration

public class MicroQRCodeOptionsBuilder extends BarcodeOptionsBuilder<MicroQRCodeOptions,MicroQRCodeOptionsBuilder>

Remarks

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

The following code snippet creates a Micro QR 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 {

        MicroQRCodeOptions options = MicroQRCodeOptionsBuilder.create()
            .withCompactionMode(MicroQRCodeCompactionMode.BYTE)
            .withErrorCorrectionLevel(MicroQRCodeErrorCorrectionLevel.AUTO)
            .withPadding(new Padding(10))
            .withShowText(false)
            .build();

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

        try (FileOutputStream fileStream = new FileOutputStream(
                outputDir.resolve("microQRcode.png").toFile());
                BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
                    barcodeGenerator.export(
                            "DXv26.1",
                            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

MicroQRCodeOptionsBuilder()

Initializes a new instance of the MicroQRCodeOptionsBuilder class.

Declaration

public MicroQRCodeOptionsBuilder()

Methods

create() Method

Creates a new MicroQRCodeOptionsBuilder instance.

Declaration

public static MicroQRCodeOptionsBuilder create()

Returns

Type Description
MicroQRCodeOptionsBuilder

The current MicroQRCodeOptionsBuilder instance for method chaining.

withCompactionMode(MicroQRCodeCompactionMode mode) Method

Specifies the encoding mode used to generate Micro QRCode. Returns a builder instance for method chaining.

Declaration

public MicroQRCodeOptionsBuilder withCompactionMode(MicroQRCodeCompactionMode mode)

Parameters

Name Type Description
mode MicroQRCodeCompactionMode

Indicates encoding mode.

Returns

Type Description
MicroQRCodeOptionsBuilder

The current MicroQRCodeOptionsBuilder instance for method chaining.

Remarks

If the encoded text contains characters that are not supported by the numeric or alphanumeric compaction mode, switch to byte mode. In byte mode, the Barcode Generation API interprets the input as a sequence of bytes and encodes the byte values directly.

withErrorCorrectionLevel(MicroQRCodeErrorCorrectionLevel errorCorrectionLevel) Method

Specifies the error correction level. Returns the builder instance for method chaining.

Declaration

public MicroQRCodeOptionsBuilder withErrorCorrectionLevel(MicroQRCodeErrorCorrectionLevel errorCorrectionLevel)

Parameters

Name Type Description
errorCorrectionLevel MicroQRCodeErrorCorrectionLevel

Indicates the error correction level.

Returns

Type Description
MicroQRCodeOptionsBuilder

The current MicroQRCodeOptionsBuilder instance for method chaining.

Remarks

Micro QR Codes use Reed-Solomon error correction to recover lost or corrupted data. Error correction adds redundant information to the encoded data. Higher error correction levels add more redundant information. The barcode remains readable even if part of the code is damaged or obscured.

withIncludeQuietZone(boolean includeQuietZone) Method

Specifies whether to include a quiet zone (blank space surrounding the code) around the Micro QR Code. Returns the builder instance for method chaining.

Declaration

public MicroQRCodeOptionsBuilder withIncludeQuietZone(boolean includeQuietZone)

Parameters

Name Type Description
includeQuietZone boolean

true to include a quiet zone; otherwise, false.

Returns

Type Description
MicroQRCodeOptionsBuilder

The current MicroQRCodeOptionsBuilder instance for method chaining.

withVersion(MicroQRCodeVersion version) Method

Specifies the code version and returns the builder instance for method chaining.

Declaration

public MicroQRCodeOptionsBuilder withVersion(MicroQRCodeVersion version)

Parameters

Name Type Description
version MicroQRCodeVersion

Indicates the Micro QR Code version.

Returns

Type Description
MicroQRCodeOptionsBuilder

The current MicroQRCodeOptionsBuilder instance for method chaining.

Remarks

The following table summarizes characteristics of various Micro QR Code versions:

Version Size (Modules) Numeric Capacity Alphanumeric Capacity Binary Capacity (Bytes) Error Correction Levels Use Case
M1 11×11 5 characters N/A N/A Detection only (D) Ideal for minimal numeric data in space-constrained environments.
M2 13×13 10 characters 6 characters 4 bytes Level L (7%) Small data capacity with basic error correction in tight spaces.
M3 15×15 23 characters 14 characters 9 bytes Level L (7%), Level M (15%) Moderate data capacity with more flexible error correction and space requirements.
M4 17×17 35 characters 21 characters 15 bytes Level L (7%), Level M (15%), Level Q (25%) Higher data capacity, flexible error correction, and compact size.