Skip to main content

DataBarOptions Class

Contains options specific to GS1 DataBar symbology.

Declaration

public class DataBarOptions extends BarcodeOptions

Remarks

Refer to the following help topic for additional information: GS1 DataBar.

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

        DataBarOptions options = DataBarOptionsBuilder.create()
            .withType(DataBarType.EXPANDED_STACKED)
            .withSegmentsInRow(4)
            .withPadding(new Padding(10))
            .withShowText(false)
            .build();

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

        try (FileOutputStream fileStream = new FileOutputStream(
                outputDir.resolve("databar.png").toFile());
                BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
                    barcodeGenerator.export(
                            "010950600013435210ABC123",
                            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
DataBarOptions

DataBarOptions()

Initializes a new instance of the DataBarOptions class.

Declaration

public DataBarOptions()

Methods

getFNC1Substitute() Method

Gets the character that is used as a substitute for the FNC1 separator in GS1 DataBar input data.

Declaration

public String getFNC1Substitute()

Returns

Type Description
String

The character that is used as a substitute for the FNC1 separator.

Remarks

The getFNC1Substitute() method returns the placeholder string that generates the FNC1 character in barcode text. The FNC1 character serves as a field separator. The placeholder string is not encoded as barcode data.

getSegmentsInRow() Method

Gets the number of data segments per row in the EXPANDED_STACKED type of a GS1 DataBar barcode.

Declaration

public int getSegmentsInRow()

Returns

Type Description
int

The number of data segments per row.

getType() Method

Gets the symbol type of the GS1 DataBar barcode family.

Declaration

public DataBarType getType()

Returns

Type Description
DataBarType

The symbol type.

setFNC1Substitute(String value) Method

Specifies the substitute character used to represent the FNC1 separator in GS1 DataBar input data.

Declaration

public void setFNC1Substitute(String value)

Parameters

Name Type Description
value String

The substitute character used to represent the FNC1 separator.

setSegmentsInRow(int value) Method

Sets the number of data segments per row in the EXPANDED_STACKED symbol type.

Declaration

public void setSegmentsInRow(int value)

Parameters

Name Type Description
value int

The number of data segments per row in the EXPANDED_STACKED symbol type.

setType(DataBarType value) Method

Specifies the GS1 DataBar symbol type.

Declaration

public void setType(DataBarType value)

Parameters

Name Type Description
value DataBarType

The GS1 DataBar symbol type.