UPC-E1
- 2 minutes to read
UPC-E1 is a compact variation of the UPC-A barcode designed for small-package labeling where space is limited. It uses number system 1 and derives its check digit from the corresponding expanded UPC-A representation.

Refer to the following page for additional information: https://en.wikipedia.org/wiki/Universal_Product_Code
Configure UPC-E1 Settings
Use the UPCE1Options class to configure UPC-E1 barcode settings.
The following code snippet creates a UPC-E1 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 {
UPCE1Options options = new UPCE1Options();
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-e1.png").toFile());
BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
barcodeGenerator.export(
"4210000526",
fileStream,
DXImageFormat.getPng());
}
}
}
Fluent API
Use the UPCE1OptionsBuilder class to configure UPC-E1 barcode settings with the Fluent API.
The following code snippet creates a UPC-E1 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 {
UPCE1Options options = UPCE1OptionsBuilder.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-e1.png").toFile());
BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
barcodeGenerator.export(
"4210000526",
fileStream,
DXImageFormat.getPng());
}
}
}
See Also