Skip to main content

Code128CharacterSet Enum

Lists character sets used in Code128 barcode symbology.

Declaration

public enum Code128CharacterSet extends Enum<Code128CharacterSet> implements IIntEnum

Members

Name Description
CHARSET_A

The “A” character encodes barcodes using ASCII characters 00-95.

CHARSET_AUTO

The character set is determined automatically according to the barcode text.

CHARSET_B

The “B” character set encodes barcodes using ASCII characters 32-127.

CHARSET_C

The “C” character encodes barcodes as digit pairs from 00 to 99. Each pair is encoded as a single code element, so the input must consist of digit pairs (for example, 01 23), not individual digits such as 123.

fromValue(int value)

Returns the Code128CharacterSet enumeration constant with the specified integer value.

getName()

Returns the name of the Code128CharacterSet enumeration constant.

getValue()

Returns the integer value associated with the Code128CharacterSet enumeration constant.

toString()

Returns the string representation of the Code128CharacterSet enumeration constant.

valueOf(String name)

Returns the Code128CharacterSet enumeration constant with the specified name.

values()

Returns an array of all Code128CharacterSet enumeration constants.

Remarks

The following code snippet creates a Code 128 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 {

        Code128Options options =  Code128OptionsBuilder.create()
            .withCharset(Code128CharacterSet.CHARSET_B)
            .withAddLeadingZero(true)
            .withFNC1Substitute("<FNC1>")
            .withFNC2Substitute("<FNC2>")
            .withFNC3Substitute("<FNC3>")
            .withShowText(true)
            .build();


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

        try (FileOutputStream fileStream = new FileOutputStream(
                outputDir.resolve("code128.png").toFile());
                BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
                    barcodeGenerator.export(
                            "ORD-4589-US-25A",
                            fileStream,
                            DXImageFormat.getPng());
        }
    }
}

Refer to the following help topic for additional information: Code 128.

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
Code128CharacterSet