| java.lang.Object com.lowagie.text.pdf.BarcodeDatamatrix
BarcodeDatamatrix | public class BarcodeDatamatrix (Code) | | A DataMatrix 2D barcode generator.
|
Inner Class :static class Placement | |
Inner Class :static class ReedSolomon | |
Field Summary | |
final public static int | DM_ASCII ASCII encodation. | final public static int | DM_AUTO The best encodation will be used. | final public static int | DM_B256 Binary encodation. | final public static int | DM_C40 C40 encodation. | final public static int | DM_EDIFACT EDIFACT encodation. | final public static int | DM_ERROR_EXTENSION An error while parsing an extension. | final public static int | DM_ERROR_INVALID_SQUARE The dimensions given for the symbol are illegal. | final public static int | DM_ERROR_TEXT_TOO_BIG The text is too big for the symbology capabilities. | final public static int | DM_EXTENSION Allows extensions to be embedded at the start of the text. | final public static int | DM_NO_ERROR No error. | final public static int | DM_RAW No encodation needed. | final public static int | DM_TEST Doesn't generate the image but returns all the other information. | final public static int | DM_TEXT TEXT encodation. | final public static int | DM_X21 X21 encodation. |
Method Summary | |
public java.awt.Image | createAwtImage(Color foreground, Color background) Creates a java.awt.Image . | public Image | createImage() Gets an Image with the barcode. | public int | generate(String text) Creates a barcode. | public int | generate(byte[] text, int textOffset, int textSize) Creates a barcode.
Parameters: text - the text Parameters: textOffset - the offset to the start of the text Parameters: textSize - the text size the status of the generation. | public int | getHeight() Gets the height of the barcode. | public byte[] | getImage() Gets the generated image. | public int | getOptions() Gets the barcode options. | public int | getWidth() Gets the width of the barcode. | public int | getWs() Gets the whitespace border around the barcode. | public void | setHeight(int height) Sets the height of the barcode. | public void | setOptions(int options) Sets the options for the barcode generation. | public void | setWidth(int width) Sets the width of the barcode. | public void | setWs(int ws) Sets the whitespace border around the barcode. |
DM_ASCII | final public static int DM_ASCII(Code) | | ASCII encodation.
|
DM_AUTO | final public static int DM_AUTO(Code) | | The best encodation will be used.
|
DM_B256 | final public static int DM_B256(Code) | | Binary encodation.
|
DM_C40 | final public static int DM_C40(Code) | | C40 encodation.
|
DM_EDIFACT | final public static int DM_EDIFACT(Code) | | EDIFACT encodation.
|
DM_ERROR_EXTENSION | final public static int DM_ERROR_EXTENSION(Code) | | An error while parsing an extension.
|
DM_ERROR_INVALID_SQUARE | final public static int DM_ERROR_INVALID_SQUARE(Code) | | The dimensions given for the symbol are illegal.
|
DM_ERROR_TEXT_TOO_BIG | final public static int DM_ERROR_TEXT_TOO_BIG(Code) | | The text is too big for the symbology capabilities.
|
DM_EXTENSION | final public static int DM_EXTENSION(Code) | | Allows extensions to be embedded at the start of the text.
|
DM_NO_ERROR | final public static int DM_NO_ERROR(Code) | | No error.
|
DM_RAW | final public static int DM_RAW(Code) | | No encodation needed. The bytes provided are already encoded.
|
DM_TEST | final public static int DM_TEST(Code) | | Doesn't generate the image but returns all the other information.
|
DM_TEXT | final public static int DM_TEXT(Code) | | TEXT encodation.
|
DM_X21 | final public static int DM_X21(Code) | | X21 encodation.
|
BarcodeDatamatrix | public BarcodeDatamatrix()(Code) | | Creates an instance of this class.
|
createAwtImage | public java.awt.Image createAwtImage(Color foreground, Color background)(Code) | | Creates a java.awt.Image . A successful call to the method generate()
before calling this method is required.
Parameters: foreground - the color of the bars Parameters: background - the color of the background the image |
generate | public int generate(String text) throws UnsupportedEncodingException(Code) | | Creates a barcode. The String is interpreted with the ISO-8859-1 encoding
Parameters: text - the text the status of the generation. It can be one of this values:DM_NO_ERROR - no error.
DM_ERROR_TEXT_TOO_BIG - the text is too big for the symbology capabilities.
DM_ERROR_INVALID_SQUARE - the dimensions given for the symbol are illegal.
DM_ERROR_EXTENSION - an error was while parsing an extension. throws: java.io.UnsupportedEncodingException - on error
|
generate | public int generate(byte[] text, int textOffset, int textSize)(Code) | | Creates a barcode.
Parameters: text - the text Parameters: textOffset - the offset to the start of the text Parameters: textSize - the text size the status of the generation. It can be one of this values:DM_NO_ERROR - no error.
DM_ERROR_TEXT_TOO_BIG - the text is too big for the symbology capabilities.
DM_ERROR_INVALID_SQUARE - the dimensions given for the symbol are illegal.
DM_ERROR_EXTENSION - an error was while parsing an extension.
|
getHeight | public int getHeight()(Code) | | Gets the height of the barcode. Will contain the real height used after a successful call
to generate() . This height doesn't include the whitespace border, if any.
the height of the barcode |
getImage | public byte[] getImage()(Code) | | Gets the generated image. The image is represented as a stream of bytes, each byte representing
8 pixels, 0 for white and 1 for black, with the high-order bit of each byte first. Each row
is aligned at byte boundaries. The dimensions of the image are defined by height and width
plus 2 * ws.
the generated image |
getOptions | public int getOptions()(Code) | | Gets the barcode options.
the barcode options |
getWidth | public int getWidth()(Code) | | Gets the width of the barcode. Will contain the real width used after a successful call
to generate() . This width doesn't include the whitespace border, if any.
the width of the barcode |
getWs | public int getWs()(Code) | | Gets the whitespace border around the barcode.
the whitespace border around the barcode |
setHeight | public void setHeight(int height)(Code) | | Sets the height of the barcode. If the height is zero it will be calculated. This height doesn't include the whitespace border, if any.
The allowed dimensions are (height, width):
10, 10
12, 12
8, 18
14, 14
8, 32
16, 16
12, 26
18, 18
20, 20
12, 36
22, 22
16, 36
24, 24
26, 26
16, 48
32, 32
36, 36
40, 40
44, 44
48, 48
52, 52
64, 64
72, 72
80, 80
88, 88
96, 96
104, 104
120, 120
132, 132
144, 144
Parameters: height - the height of the barcode |
setOptions | public void setOptions(int options)(Code) | | Sets the options for the barcode generation. The options can be:
One of:
DM_AUTO - the best encodation will be used
DM_ASCII - ASCII encodation
DM_C40 - C40 encodation
DM_TEXT - TEXT encodation
DM_B256 - binary encodation
DM_X21 - X21 encodation
DM_EDIFACT - EDIFACT encodation
DM_RAW - no encodation. The bytes provided are already encoded and will be added directly to the barcode, using padding if needed. It assumes that the encodation state is left at ASCII after the last byte.
One of:
DM_EXTENSION - allows extensions to be embedded at the start of the text:
exxxxxx - ECI number xxxxxx
m5 - macro 5
m6 - macro 6
f - FNC1
saabbccccc - Structured Append, aa symbol position (1-16), bb total number of symbols (2-16), ccccc file identification (0-64515)
p - Reader programming
. - extension terminator
Example for a structured append, symbol 2 of 6, with FNC1 and ECI 000005. The actual text is "Hello".
s020600075fe000005.Hello
One of:
DM_TEST - doesn't generate the image but returns all the other information.
Parameters: options - the barcode options |
setWidth | public void setWidth(int width)(Code) | | Sets the width of the barcode. If the width is zero it will be calculated. This width doesn't include the whitespace border, if any.
The allowed dimensions are (height, width):
10, 10
12, 12
8, 18
14, 14
8, 32
16, 16
12, 26
18, 18
20, 20
12, 36
22, 22
16, 36
24, 24
26, 26
16, 48
32, 32
36, 36
40, 40
44, 44
48, 48
52, 52
64, 64
72, 72
80, 80
88, 88
96, 96
104, 104
120, 120
132, 132
144, 144
Parameters: width - the width of the barcode |
setWs | public void setWs(int ws)(Code) | | Sets the whitespace border around the barcode.
Parameters: ws - the whitespace border around the barcode |
|
|