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 |
getName()
|
Returns the name of the |
getValue()
|
Returns the integer value associated with the |
toString()
|
Returns the string representation of the |
valueOf(String name)
|
Returns the |
values()
|
Returns an array of all |
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.