UPC-E0
- 2 minutes to read
UPC-E0 is a compressed version of the UPC-A barcode designed for small packages and labels with limited printing space. It uses number system 0 and derives its check digit from the corresponding UPC-A value. When scanned, the compressed UPC-E0 data is automatically expanded to its equivalent UPC-A representation.

Refer to the following page for additional information: https://en.wikipedia.org/wiki/Universal_Product_Code
Configure UPC-E0 Settings
Use the UPCE0Options class to configure UPC-E0 barcode settings.
The following code snippet creates a UPC-E0 barcode and customizes its encoding parameters:
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 {
UPCE0Options options = new UPCE0Options();
options.setPadding(new Padding(10));
options.setModuleSize(10);
options.setShowText(true);
options.setWidth(600);
options.setHeight(200);
Path outputDir = Path.of("output");
Files.createDirectories(outputDir);
try (FileOutputStream fileStream = new FileOutputStream(
outputDir.resolve("upc-e0.png").toFile());
BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
barcodeGenerator.export(
"4210000526",
fileStream,
DXImageFormat.getPng());
}
}
}
Fluent API
Use the UPCE0OptionsBuilder class to configure UPC-E0 barcode settings with the Fluent API.
The following code snippet creates a UPC-E0 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 {
UPCE0Options options = UPCE0OptionsBuilder.create()
.withPadding(new Padding(10))
.withModuleSize(10)
.withShowText(true)
.withWidth(600)
.withHeight(200)
.build();
Path outputDir = Path.of("output");
Files.createDirectories(outputDir);
try (FileOutputStream fileStream = new FileOutputStream(
outputDir.resolve("upc-e0.png").toFile());
BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
barcodeGenerator.export(
"4210000526",
fileStream,
DXImageFormat.getPng());
}
}
}