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
Inheritance
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 |
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 |
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 |
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 |