public class BarcodePDF417 extends Barcode2D
| Modifier and Type | Class and Description |
|---|---|
protected static class |
BarcodePDF417.Segment
A container that encapsulates all data needed for a segment.
|
protected static class |
BarcodePDF417.SegmentList
An utility class that encapsulates a list of segments.
|
| Modifier and Type | Field and Description |
|---|---|
protected static int |
ABSOLUTE_MAX_TEXT_SIZE |
protected static int |
AL |
protected static int |
ALPHA |
protected static int |
AS |
protected int |
bitPtr |
protected static int |
BYTE_MODE |
protected static int |
BYTE_MODE_6 |
protected static int |
BYTESHIFT |
protected int |
cwPtr |
protected static float |
DEFAUL_MODULE_HEIGHT |
protected static float |
DEFAUL_MODULE_WIDTH |
protected static int |
ISBYTE |
protected static int |
LL |
protected static int |
LOWER |
protected static int |
MACRO_LAST_SEGMENT |
protected static int |
MACRO_SEGMENT_ID |
protected static int |
MAX_DATA_CODEWORDS |
protected static int |
MIXED |
protected static int |
ML |
protected static int |
MOD |
protected static int |
NUMERIC_MODE |
protected static int |
PAL |
static int |
PDF417_AUTO_ERROR_LEVEL
The error level correction is set automatically according
to ISO 15438 recommendations.
|
static int |
PDF417_FIXED_COLUMNS
The size will be at least
codeColumns
with a variable number of codeRows. |
static int |
PDF417_FIXED_RECTANGLE
The size of the barcode will be at least
codeColumns*codeRows. |
static int |
PDF417_FIXED_ROWS
The size will be at least
codeRows
with a variable number of codeColumns. |
static int |
PDF417_FORCE_BINARY
One single binary segment is used
|
static int |
PDF417_INVERT_BITMAP
Inverts the output bits of the raw bitmap that is normally
bit one for black.
|
static int |
PDF417_USE_ASPECT_RATIO
Auto-size is made based on
aspectRatio and yHeight. |
static int |
PDF417_USE_ERROR_LEVEL
The error level correction is set by the user.
|
static int |
PDF417_USE_MACRO
Use Macro PDF417 Encoding
|
static int |
PDF417_USE_RAW_CODEWORDS
No
text interpretation is done and the content of codewords
is used directly. |
protected static int |
PL |
protected static int |
PS |
protected static int |
PUNCTUATION |
protected BarcodePDF417.SegmentList |
segmentList |
protected static int |
SPACE |
protected static int |
START_CODE_SIZE |
protected static int |
START_PATTERN |
protected static int |
STOP_PATTERN |
protected static int |
STOP_SIZE |
protected static int |
TEXT_MODE |
DEFAULT_MODULE_SIZE| Constructor and Description |
|---|
BarcodePDF417()
Creates a new
BarcodePDF417 with the default settings. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assemble()
Assembles the data of the code words.
|
protected void |
basicNumberCompaction(int start,
int length)
Compacts the codewords.
|
protected void |
byteCompaction6(int start)
Compacts the code words
|
protected void |
calculateErrorCorrection(int dest)
Calculates the error correction codewords.
|
protected boolean |
checkSegmentType(BarcodePDF417.Segment segment,
char type)
Checks whether the segment is of a certain type.
|
Image |
createAwtImage(Color foreground,
Color background)
Creates a
java.awt.Image. |
PdfFormXObject |
createFormXObject(Color foreground,
float moduleWidth,
float moduleHeight,
PdfDocument document)
Creates a PdfFormXObject with the barcode with given module width and module height.
|
PdfFormXObject |
createFormXObject(Color foreground,
PdfDocument document)
Creates a PdfFormXObject with the barcode.
|
protected void |
dumpList()
Prints the segments to standard output.
|
float |
getAspectRatio()
Gets the barcode aspect ratio.
|
Rectangle |
getBarcodeSize()
Gets the maximum area that the barcode and the text, if
any, will occupy.
|
int |
getBitColumns()
Gets the number of X pixels of
outBits. |
byte[] |
getCode()
Gets the bytes that form the barcode.
|
int |
getCodeColumns()
Gets the number of barcode data columns.
|
int |
getCodeRows()
Gets the number of Y pixels of
outBits. |
int[] |
getCodewords()
Gets the codeword array.
|
int |
getErrorLevel()
Gets the error level correction used for the barcode.
|
int |
getLenCodewords()
Gets the length of the codewords.
|
protected int |
getMaxSquare()
Calculates the max square that can contain the barcode.
|
int |
getOptions()
Gets the options to generate the barcode.
|
byte[] |
getOutBits()
Gets the raw image bits of the barcode.
|
protected int |
getSegmentLength(BarcodePDF417.Segment segment)
Calculates the length of the given segment
|
protected int |
getTextTypeAndValue(int maxLength,
int idx)
Gets the text type and value.
|
float |
getYHeight()
Gets the Y pixel height relative to X.
|
protected static int |
maxPossibleErrorLevel(int remain)
Calculates the highest error level that can be used for the remaining number of data codewords.
|
protected void |
numberCompaction(int start,
int length)
Compacts the code words.
|
protected void |
outCodeword(int codeword)
Utility method that adds a codeword to the barcode.
|
protected void |
outCodeword17(int codeword)
Adds the code word to the correct code word to the 17th bit.
|
protected void |
outCodeword18(int codeword)
Adds the code word to the correct code word to the 18th bit.
|
protected void |
outPaintCode()
Adds the barcode to the output bits.
|
protected void |
outStartPattern()
Adds the start pattern to the output.
|
protected void |
outStopPattern()
Adds the stop pattern to the output.
|
void |
paintCode()
Paints the barcode.
|
Rectangle |
placeBarcode(PdfCanvas canvas,
Color foreground)
Places the barcode in a
PdfCanvas. |
Rectangle |
placeBarcode(PdfCanvas canvas,
Color foreground,
float moduleWidth,
float moduleHeight)
Places the barcode in a
PdfCanvas. |
void |
setAspectRatio(float aspectRatio)
Sets the barcode aspect ratio.
|
void |
setCode(byte[] code)
Sets the bytes that form the barcode.
|
void |
setCode(String text)
Sets the code that will form the barcode.
|
void |
setCodeColumns(int codeColumns)
Sets the number of barcode data columns.
|
void |
setCodeRows(int codeRows)
Sets the number of barcode rows.
|
void |
setDefaultParameters()
Set the default settings that correspond to
PDF417_USE_ASPECT_RATIO
and PDF417_AUTO_ERROR_LEVEL. |
void |
setErrorLevel(int errorLevel)
Sets the error level correction for the barcode.
|
void |
setLenCodewords(int lenCodewords)
Sets the length of the codewords.
|
void |
setMacroFileId(String id)
Sets the File ID for macro PDF417 encoding
|
void |
setMacroSegmentCount(int cnt)
Sets the segment count for macro PDF417 encoding
|
void |
setMacroSegmentId(int id)
Sets the segment id for macro PDF417 encoding
|
void |
setOptions(int options)
Sets the options to generate the barcode.
|
void |
setYHeight(float yHeight)
Sets the Y pixel height relative to X.
|
protected void |
textCompaction(int start,
int length)
Compacts the codewords.
|
createFormXObjectpublic static final int PDF417_USE_ASPECT_RATIO
aspectRatio and yHeight.public static final int PDF417_FIXED_RECTANGLE
codeColumns*codeRows.public static final int PDF417_FIXED_COLUMNS
codeColumns
with a variable number of codeRows.public static final int PDF417_FIXED_ROWS
codeRows
with a variable number of codeColumns.public static final int PDF417_AUTO_ERROR_LEVEL
public static final int PDF417_USE_ERROR_LEVEL
public static final int PDF417_FORCE_BINARY
public static final int PDF417_USE_RAW_CODEWORDS
text interpretation is done and the content of codewords
is used directly.public static final int PDF417_INVERT_BITMAP
public static final int PDF417_USE_MACRO
protected static final int START_PATTERN
protected static final int STOP_PATTERN
protected static final int START_CODE_SIZE
protected static final int STOP_SIZE
protected static final int MOD
protected static final int ALPHA
protected static final int LOWER
protected static final int MIXED
protected static final int PUNCTUATION
protected static final int ISBYTE
protected static final int BYTESHIFT
protected static final int PL
protected static final int LL
protected static final int AS
protected static final int ML
protected static final int AL
protected static final int PS
protected static final int PAL
protected static final int SPACE
protected static final int TEXT_MODE
protected static final int BYTE_MODE_6
protected static final int BYTE_MODE
protected static final int NUMERIC_MODE
protected static final int ABSOLUTE_MAX_TEXT_SIZE
protected static final int MAX_DATA_CODEWORDS
protected static final int MACRO_SEGMENT_ID
protected static final int MACRO_LAST_SEGMENT
protected static final float DEFAUL_MODULE_WIDTH
protected static final float DEFAUL_MODULE_HEIGHT
protected int bitPtr
protected int cwPtr
protected BarcodePDF417.SegmentList segmentList
public BarcodePDF417()
BarcodePDF417 with the default settings.public void setMacroSegmentId(int id)
id - the id (starting at 0)setMacroSegmentCount(int)public void setMacroSegmentCount(int cnt)
cnt - the number of macro segmentssetMacroSegmentId(int)public void setMacroFileId(String id)
id - the file idpublic void setDefaultParameters()
PDF417_USE_ASPECT_RATIO
and PDF417_AUTO_ERROR_LEVEL.public Rectangle getBarcodeSize()
getBarcodeSize in class Barcode2Dpublic Rectangle placeBarcode(PdfCanvas canvas, Color foreground)
PdfCanvas. The
barcode is always placed at coordinates (0, 0). Use the
translation matrix to move it elsewhere.placeBarcode in class Barcode2Dcanvas - the PdfCanvas where the barcode will be placedforeground - the foreground color. It can be nullpublic Rectangle placeBarcode(PdfCanvas canvas, Color foreground, float moduleWidth, float moduleHeight)
PdfCanvas.public void paintCode()
public PdfFormXObject createFormXObject(Color foreground, PdfDocument document)
createFormXObject in class Barcode2Dforeground - the color of the pixels. It can be nulldocument - The documentpublic PdfFormXObject createFormXObject(Color foreground, float moduleWidth, float moduleHeight, PdfDocument document)
foreground - The color of the pixels. It can be nullmoduleWidth - The width of the pixels.moduleHeight - The height of the pixels.document - The documentpublic Image createAwtImage(Color foreground, Color background)
java.awt.Image.foreground - the color of the barsbackground - the color of the backgroundpublic byte[] getOutBits()
yHeight.public int getBitColumns()
outBits.outBitspublic int getCodeRows()
outBits.
It is also the number of rows in the barcode.outBitspublic void setCodeRows(int codeRows)
codeRows - the number of barcode rowspublic int getCodeColumns()
public void setCodeColumns(int codeColumns)
codeColumns - the number of barcode data columnspublic int[] getCodewords()
PDF417_USE_RAW_CODEWORDS
is set.public int getLenCodewords()
public void setLenCodewords(int lenCodewords)
lenCodewords - the length of the codewordspublic int getErrorLevel()
public void setErrorLevel(int errorLevel)
errorLevel - the error level correction for the barcodepublic byte[] getCode()
public void setCode(byte[] code)
code - the bytes that form the barcodepublic void setCode(String text)
text - the text that will form the barcodepublic int getOptions()
public void setOptions(int options)
PDF417_* constants.options - the options to generate the barcodepublic float getAspectRatio()
public void setAspectRatio(float aspectRatio)
aspectRatio - the barcode aspect ratiopublic float getYHeight()
public void setYHeight(float yHeight)
yHeight - the Y pixel height relative to Xprotected void outCodeword17(int codeword)
codeword - the code wordprotected void outCodeword18(int codeword)
codeword - the code wordprotected void outCodeword(int codeword)
codeword - the codeword to addprotected void outStopPattern()
protected void outStartPattern()
protected void outPaintCode()
protected void calculateErrorCorrection(int dest)
dest - length of the code wordsprotected void textCompaction(int start,
int length)
start - the start positionlength - the lengthprotected void basicNumberCompaction(int start,
int length)
start - the start positionlength - the lengthprotected int getTextTypeAndValue(int maxLength,
int idx)
maxLength - the maximum lengthidx - the indexprotected boolean checkSegmentType(BarcodePDF417.Segment segment, char type)
segment - the segment to checktype - the type to check againstprotected int getSegmentLength(BarcodePDF417.Segment segment)
segment - the segment to checkprotected void numberCompaction(int start,
int length)
start - the start positionlength - the lengthprotected void byteCompaction6(int start)
start - the start positionprotected void assemble()
protected static int maxPossibleErrorLevel(int remain)
remain - the number of data codewordsprotected void dumpList()
protected int getMaxSquare()
Copyright © 1998–2025 Apryse Group NV. All rights reserved.