Skip to main content

SizeMode Enum

Lists values that indicate the size mode for a barcode image.

Declaration

public enum SizeMode extends Enum<SizeMode> implements IIntEnum

Members

Name Description
AUTO

The barcode image size is determined automatically.

BARCODE_IMAGE

The barcode image size is determined by the image size.

fromValue(int value)

Returns the SizeMode enumeration constant with the specified integer value.

getName()

Returns the name of the SizeMode enumeration constant.

getValue()

Returns the integer value associated with the SizeMode enumeration constant.

toString()

Returns the string representation of the SizeMode enumeration constant.

valueOf(String name)

Returns the SizeMode enumeration constant with the specified name.

values()

Returns an array of all SizeMode enumeration constants.

Remarks

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

package barcodes;

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

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

public class Main {
    public static void main(String[] args) throws Exception {
        // Customize QR Code parameters.
        QRCodeOptions options = QRCodeOptionsBuilder.create()
            .withErrorCorrectionLevel(QRCodeErrorCorrectionLevel.H)
            .withCompactionMode(QRCodeCompactionMode.AUTO)
            .withVersion(QRCodeVersion.VERSION_10)
            .withSizeMode(SizeMode.BARCODE_IMAGE)
            .withWidth(300)
            .withHeight(300)
            .build();

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

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

Note

When using BARCODE_IMAGE, the barcode is rendered as an image. In this mode, the barcode’s width and height are mandatory scaling parameters. They define the size of the resulting barcode image in pixels.

Implements

com.devexpress.java.enums.IIntEnum

Inherited Members

java.lang.Enum.<T>valueOf(java.lang.Class<T>,java.lang.String)
java.lang.Enum.clone()
java.lang.Enum.compareTo(E)
java.lang.Enum.describeConstable()
java.lang.Enum.equals(java.lang.Object)
java.lang.Enum.finalize()
java.lang.Enum.getDeclaringClass()
java.lang.Enum.hashCode()
java.lang.Enum.name()
java.lang.Enum.ordinal()
java.lang.Enum.toString()
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
java.lang.Enum
SizeMode