Skip to main content

DataBarOptionsBuilder Class

Builds an DataBarOptions object. Use chained builder methods to configure barcode settings, then call the build() method to create the options object.

Declaration

public class DataBarOptionsBuilder extends BarcodeOptionsBuilder<DataBarOptions,DataBarOptionsBuilder>

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.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.initFields()
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

DataBarOptionsBuilder()

Initializes a new instance of the DataBarOptionsBuilder class.

Declaration

public DataBarOptionsBuilder()

Methods

create() Method

Creates a DataBarOptionsBuilder instance.

Declaration

public static DataBarOptionsBuilder create()

Returns

Type Description
DataBarOptionsBuilder

The current DataBarOptionsBuilder instance for method chaining.

withFNC1Substitute(String substitute) Method

Specifies the character that is used as a substitute for the FNC1 separator in GS1 DataBar input data. Returns a builder instance for method chaining.

Declaration

public DataBarOptionsBuilder withFNC1Substitute(String substitute)

Parameters

Name Type Description
substitute String

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

Returns

Type Description
DataBarOptionsBuilder

The current DataBarOptionsBuilder instance for method chaining.

withSegmentsInRow(int segments) Method

Specifies the number of data segments per row in the EXPANDED_STACKED type of a GS1 DataBar barcode. Returns a builder instance for method chaining.

Declaration

public DataBarOptionsBuilder withSegmentsInRow(int segments)

Parameters

Name Type Description
segments int

The number of data segments per row.

Returns

Type Description
DataBarOptionsBuilder

The current DataBarOptionsBuilder instance for method chaining.

withType(DataBarType type) Method

Specifies the symbol type of the GS1 DataBar family of barcodes and returns a builder instance for method chaining.

Declaration

public DataBarOptionsBuilder withType(DataBarType type)

Parameters

Name Type Description
type DataBarType

The symbol type.

Returns

Type Description
DataBarOptionsBuilder

The current DataBarOptionsBuilder instance for method chaining.