Skip to main content

CodabarOptions Class

Contains options specific to Codabar symbology.

Declaration

public class CodabarOptions extends BarcodeOptions

Remarks

Refer to the following help topic for additional information: Codabar.

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

        CodabarOptions options = CodabarOptionsBuilder.create()
            .withStartSymbol(CodabarStartStopSymbol.A)
            .withStopSymbol(CodabarStartStopSymbol.D)
            .withWideNarrowRatio(1.5f)
            .withShowText(true)
            .build();

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

        try (FileOutputStream fileStream = new FileOutputStream(
                outputDir.resolve("codabar.png").toFile());
                BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
                    barcodeGenerator.export(
                            "12345-67890",
                            fileStream,
                            DXImageFormat.getPng());
        }
    }
}

Inherited Members

com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
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
JavaObject
BarcodeOptions
CodabarOptions

CodabarOptions()

Initializes a new instance of the CodabarOptions class.

Declaration

public CodabarOptions()

Methods

getStartSymbol() Method

Gets the first symbol used to code barcode structure.

Declaration

public CodabarStartStopSymbol getStartSymbol()

Returns

Type Description
CodabarStartStopSymbol

The first symbol used to code barcode structure.

getStopSymbol() Method

Gets the last symbol used to code barcode structure.

Declaration

public CodabarStartStopSymbol getStopSymbol()

Returns

Type Description
CodabarStartStopSymbol

The last symbol used to code barcode structure.

getWideNarrowRatio() Method

Gets bar density.

Declaration

public float getWideNarrowRatio()

Returns

Type Description
float

Bar density.

setStartSymbol(CodabarStartStopSymbol value) Method

Specifies the start character (A, B, C, or D) that precedes the encoded data.

Declaration

public void setStartSymbol(CodabarStartStopSymbol value)

Parameters

Name Type Description
value CodabarStartStopSymbol

The start character that precedes the encoded data.

setStopSymbol(CodabarStartStopSymbol value) Method

Specifies the stop character (A, B, C, or D) that follows the encoded data.

Declaration

public void setStopSymbol(CodabarStartStopSymbol value)

Parameters

Name Type Description
value CodabarStartStopSymbol

The stop character that follows the encoded data.

setWideNarrowRatio(float value) Method

Specifies the ratio between wide and narrow bars and spaces in the barcode.

Declaration

public void setWideNarrowRatio(float value)

Parameters

Name Type Description
value float

Bar density.