public class D2Properties
extends java.lang.Object
Contains specific configuration properties for for 2D barcodes.
This sample shows how to create and save a BarCode image.BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.DATA_MATRIX); generator.getD2().setAspectRatio(1.5f); generator.save("test.png");
Constructor and Description |
---|
D2Properties() |
Modifier and Type | Method and Description |
---|---|
float |
getAspectRatio()
Height/Width ratio of 2D BarCode module.
|
java.nio.charset.Charset |
getCodeTextEncoding()
Gets the encoding of codetext.
|
int |
getColumns()
2D BarCode's columns, if setting is illegal then columns will be calculated automatically.
|
java.lang.String |
getDisplayText()
Gets the text will displayed on the barcode image.
|
int |
getRows()
BarCode's rows, if setting is illegal then rows will be calculated automatically.
|
void |
setAspectRatio(float value)
Height/Width ratio of 2D BarCode module.
|
void |
setCodeTextEncoding(java.nio.charset.Charset value)
Sets the encoding of codetext.
|
void |
setColumns(int value)
2D BarCode's columns, if setting is illegal then columns will be calculated automatically.
|
void |
setDisplayText(java.lang.String value)
Sets the text will displayed on the barcode image.
|
void |
setRows(int value)
BarCode's rows, if setting is illegal then rows will be calculated automatically.
|
java.lang.String |
toString()
Returns a human-readable string representation of this D2Properties
|
public float getAspectRatio()
Height/Width ratio of 2D BarCode module.
See xDimension
.
This sample shows how to create and save a BarCode image.BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.DATA_MATRIX); generator.getD2().setAspectRatio(1.5f); float aspectRatio = generator.getD2().getAspectRatio(); generator.save("test.png");
public void setAspectRatio(float value)
Height/Width ratio of 2D BarCode module.
See xDimension
.
This sample shows how to create and save a BarCode image.BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.DATA_MATRIX); generator.getD2().setAspectRatio(1.5f); generator.save("test.png");
java.lang.IllegalArgumentException
- <p>The <b>AspectRatio</b> parameter value is less than or equal to 0.</p>
java.lang.IllegalArgumentException
- <p>The <b>AspectRatio</b> can't be specified when AutoSizeMode is set to NEAREST.</p>
public int getColumns()
2D BarCode's columns, if setting is illegal then columns will be calculated automatically. applicable SymbologyType: Pdf417, CodablockF, DatabarExpandedStacked.
This sample shows how to create and save a BarCode image.BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.PDF_417); generator.getD2().setColumns(3); generator.getD2().setRows(6); generator.save("test.png");
public void setColumns(int value)
2D BarCode's columns, if setting is illegal then columns will be calculated automatically. applicable SymbologyType: Pdf417, CodablockF, DatabarExpandedStacked.
This sample shows how to create and save a BarCode image.BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.PDF_417); generator.getD2().setColumns(3); generator.getD2().setRows(6); generator.save("test.png");
public int getRows()
BarCode's rows, if setting is illegal then rows will be calculated automatically. Applicable Symbology: Pdf417, DatabarExpandedStacked, CodablockF, DatabarExpandedStacked.
This sample shows how to create and save a BarCode image.BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.PDF_417); generator.getD2().setColumns(3); generator.getD2().setRows(6); generator.save("test.png");
public void setRows(int value)
BarCode's rows, if setting is illegal then rows will be calculated automatically. Applicable Symbology: Pdf417, DatabarExpandedStacked, CodablockF, DatabarExpandedStacked.
This sample shows how to create and save a BarCode image.BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.PDF_417); generator.getD2().setColumns(3); generator.getD2().setRows(6); generator.save("test.png");
public java.lang.String getDisplayText()
Gets the text will displayed on the barcode image. Available only for 2D barcodes. Limited to 1000 chars.
Value: The text to display.This sample shows how to create and save a BarCode image.BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.DATA_MATRIX); generator.setCodeText("ABC \\x00\\x01\\x02 DEF"); generator.getD2().setDisplayText("Print text"); generator.getD2().getDisplayText(); generator.save("test.png");
public void setDisplayText(java.lang.String value)
Sets the text will displayed on the barcode image. Available only for 2D barcodes. Limited to 1000 chars.
Value: The text to display.This sample shows how to create and save a BarCode image.BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.DATA_MATRIX); generator.setCodeText("ABC \\x00\\x01\\x02 DEF"); generator.getD2().setDisplayText("Print text"); generator.save("test.png");
public java.nio.charset.Charset getCodeTextEncoding()
Gets the encoding of codetext.
Value: The encoding for codetext.This sample shows how to create and save a BarCode image.BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.DATA_MATRIX); generator.setCodeText("Example"); generator.getD2().setCodeTextEncoding(Charset.forName("UTF-8")); Charset charset = generator.getD2().getCodeTextEncoding(); generator.save("test.png");
public void setCodeTextEncoding(java.nio.charset.Charset value)
Sets the encoding of codetext.
Value: The encoding for codetext.This sample shows how to create and save a BarCode image.BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.DATA_MATRIX); generator.setCodeText("Example"); generator.getD2().setCodeTextEncoding(Charset.forName("UTF-8")); generator.save("test.png");
public java.lang.String toString()
toString
in class java.lang.Object