DataMatrixGS1OptionsBuilder Class
Builds an DataMatrixGS1Options object. Chain builder methods to configure barcode settings, then call the build() method to create the options object.
Declaration
public class DataMatrixGS1OptionsBuilder extends BarcodeOptionsBuilder<DataMatrixGS1Options,DataMatrixGS1OptionsBuilder>
Remarks
Refer to the following help topic for additional information: GS1 Data Matrix.
The following code snippet creates a GS1 Data Matrix 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 {
DataMatrixGS1Options options = DataMatrixGS1OptionsBuilder.create()
.withCompactionMode(DataMatrixCompactionMode.C40)
.withMatrixSize(DataMatrixSize.MATRIX_12X12)
.withModuleSize(5)
.withPadding(new Padding(10))
.withShowText(true)
.withWidth(600)
.build();
Path outputDir = Path.of("output");
Files.createDirectories(outputDir);
try (FileOutputStream fileStream = new FileOutputStream(
outputDir.resolve("datamatrixGS1.png").toFile());
BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
barcodeGenerator.export(
"(01)09521234543213(10)ABC123(17)280101",
fileStream,
DXImageFormat.getPng());
}
}
}
Inherited Members
Inheritance
DataMatrixGS1OptionsBuilder()
Initializes a new instance of the DataMatrixGS1OptionsBuilder class.
Declaration
public DataMatrixGS1OptionsBuilder()
Methods
create() Method
Creates a DataMatrixGS1OptionsBuilder instance.
Declaration
public static DataMatrixGS1OptionsBuilder create()
Returns
| Type | Description |
|---|---|
DataMatrixGS1OptionsBuilder |
The current |
withCompactionMode(DataMatrixCompactionMode mode) Method
Specifies the encoding mode used to generate Data Matrix. Returns a builder instance for method chaining.
Declaration
public DataMatrixGS1OptionsBuilder withCompactionMode(DataMatrixCompactionMode mode)
Parameters
| Name | Type | Description |
|---|---|---|
| mode | DataMatrixCompactionMode | The encoding scheme. |
Returns
| Type | Description |
|---|---|
DataMatrixGS1OptionsBuilder |
The current |
withFNC1Substitute(String substitute) Method
Specifies the character used as a substitute for the GS1 FNC1 separator in Data Matrix GS1 input data. Returns a builder instance for method chaining.
Declaration
public DataMatrixGS1OptionsBuilder withFNC1Substitute(String substitute)
Parameters
| Name | Type | Description |
|---|---|---|
| substitute | String | The character to be replaced. |
Returns
| Type | Description |
|---|---|
DataMatrixGS1OptionsBuilder |
The current |
withHumanReadableText(boolean humanReadableText) Method
Specifies whether GS1 human-readable text is displayed for the Data Matrix barcode. Returns a builder instance for method chaining.
Declaration
public DataMatrixGS1OptionsBuilder withHumanReadableText(boolean humanReadableText)
Parameters
| Name | Type | Description |
|---|---|---|
| humanReadableText | boolean |
|
Returns
| Type | Description |
|---|---|
DataMatrixGS1OptionsBuilder |
The current |
withMatrixSize(DataMatrixSize size) Method
Specifies the barcode matrix size. Returns a builder instance for method chaining.
Declaration
public DataMatrixGS1OptionsBuilder withMatrixSize(DataMatrixSize size)
Parameters
| Name | Type | Description |
|---|---|---|
| size | DataMatrixSize | The barcode matrix size. |
Returns
| Type | Description |
|---|---|
DataMatrixGS1OptionsBuilder |
The current |