Skip to main content

MicroQRCodeOptions Class

Contains options specific to the Micro QR Code symbology.

Declaration

public class MicroQRCodeOptions extends BarcodeOptions

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.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
MicroQRCodeOptions

MicroQRCodeOptions()

Initializes a new instance of the MicroQRCodeOptions class.

Declaration

public MicroQRCodeOptions()

Methods

getCompactionMode() Method

Returns the compaction mode.

Declaration

public MicroQRCodeCompactionMode getCompactionMode()

Returns

Type Description
MicroQRCodeCompactionMode

An enumeration value that specifies the compaction mode.

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.

getErrorCorrectionLevel() Method

Returns the error correction level.

Declaration

public MicroQRCodeErrorCorrectionLevel getErrorCorrectionLevel()

Returns

Type Description
MicroQRCodeErrorCorrectionLevel

An enumeration value that specifies the error correction level.

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.

getIncludeQuietZone() Method

Returns whether to include a quiet zone (a margin of empty space) around the code.

Declaration

public boolean getIncludeQuietZone()

Returns

Type Description
boolean

true to include a quiet zone; otherwise, false.

getVersion() Method

Gets the Micro QR Code version.

Declaration

public MicroQRCodeVersion getVersion()

Returns

Type Description
MicroQRCodeVersion

An enumeration value that specifies the Micro QR Code version.

Remarks

The following table summarizes the characteristics of each Micro QR Code version:

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.

setCompactionMode(MicroQRCodeCompactionMode value) Method

Specifies how input data is compacted (numeric, alphanumeric, or byte mode depending on version).

Declaration

public void setCompactionMode(MicroQRCodeCompactionMode value)

Parameters

Name Type Description
value MicroQRCodeCompactionMode

The compaction mode.

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.

setErrorCorrectionLevel(MicroQRCodeErrorCorrectionLevel value) Method

Specifies the error correction level.

Declaration

public void setErrorCorrectionLevel(MicroQRCodeErrorCorrectionLevel value)

Parameters

Name Type Description
value MicroQRCodeErrorCorrectionLevel

The error correction level.

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.

setIncludeQuietZone(boolean value) Method

Specifies whether to include a quiet zone (a margin of empty space) around the symbol.

Declaration

public void setIncludeQuietZone(boolean value)

Parameters

Name Type Description
value boolean

true to include a quiet zone; otherwise, false.

setVersion(MicroQRCodeVersion value) Method

Sets the Micro QR Code version.

Declaration

public void setVersion(MicroQRCodeVersion value)

Parameters

Name Type Description
value MicroQRCodeVersion

The Micro QR Code version.

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.