Code128Options Class
Contains options specific to Code128 symbology.
Declaration
public class Code128Options extends BarcodeOptions
Remarks
Refer to the following help topic for additional information: Code 128.
The following code snippet creates a Code 128 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 {
Code128Options options = Code128OptionsBuilder.create()
.withCharset(Code128CharacterSet.CHARSET_B)
.withAddLeadingZero(true)
.withFNC1Substitute("<FNC1>")
.withFNC2Substitute("<FNC2>")
.withFNC3Substitute("<FNC3>")
.withShowText(true)
.build();
Path outputDir = Path.of("output");
Files.createDirectories(outputDir);
try (FileOutputStream fileStream = new FileOutputStream(
outputDir.resolve("code128.png").toFile());
BarcodeGenerator barcodeGenerator = new BarcodeGenerator(options)) {
barcodeGenerator.export(
"ORD-4589-US-25A",
fileStream,
DXImageFormat.getPng());
}
}
}
Inherited Members
Inheritance
Code128Options()
Initializes a new instance of the Code128Options class.
Declaration
public Code128Options()
Methods
getAddLeadingZero() Method
Returns whether to prepend a leading zero when encoding numeric data in Code Set C (CHARSET_C).
Declaration
public boolean getAddLeadingZero()
Returns
| Type | Description |
|---|---|
| boolean |
|
getCharset() Method
Gets the barcode charset type.
Declaration
public Code128CharacterSet getCharset()
Returns
| Type | Description |
|---|---|
| Code128CharacterSet | The used charset. |
getFNC1Substitute() Method
A substring/character that serves as the placeholder for the FNC1 functional character.
Declaration
public String getFNC1Substitute()
Returns
| Type | Description |
|---|---|
| String | Symbols to be replaced. |
getFNC2Substitute() Method
A substring/character that serves as the placeholder for the FNC2 functional character.
Declaration
public String getFNC2Substitute()
Returns
| Type | Description |
|---|---|
| String | Symbols to be replaced. |
getFNC3Substitute() Method
A substring/character that serves as the placeholder for the FNC3 functional character.
Declaration
public String getFNC3Substitute()
Returns
| Type | Description |
|---|---|
| String | Symbols to be replaced. |
getFNC4Substitute() Method
A substring/character that serves as the placeholder for the FNC4 functional character.
Declaration
public String getFNC4Substitute()
Returns
| Type | Description |
|---|---|
| String | Symbols to be replaced. |
setAddLeadingZero(boolean value) Method
Specifies whether to prepend a leading for numeric data in Code Set C (CHARSET_C) to ensure proper encoding alignment.
Declaration
public void setAddLeadingZero(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|
setCharset(Code128CharacterSet value) Method
Sets the Code 128 character set (A, B, or C) for encoding.
Declaration
public void setCharset(Code128CharacterSet value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | Code128CharacterSet | Code 128 character set. |
setFNC1Substitute(String value) Method
Specifies a placeholder string for the FNC1 function character.
Declaration
public void setFNC1Substitute(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The placeholder string for the FNC1 function character. |
setFNC2Substitute(String value) Method
Specifies a placeholder string for the FNC2 function character.
Declaration
public void setFNC2Substitute(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The placeholder string for the FNC2 function character. |
setFNC3Substitute(String value) Method
Specifies a placeholder string for the FNC3 function character.
Declaration
public void setFNC3Substitute(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The placeholder string for the FNC3 function character. |
setFNC4Substitute(String value) Method
Specifies a placeholder string for the FNC4 function character.
Declaration
public void setFNC4Substitute(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The placeholder string for the FNC4 function character. |