Package com.google.zxing.pdf417.encoder
Class PDF417
java.lang.Object
com.google.zxing.pdf417.encoder.PDF417
Top-level class for the logic part of the PDF417 implementation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BarcodeMatrix
private static final int[][]
The codeword table from the Annex A of ISO/IEC 15438:2001(E).private boolean
private Compaction
private static final float
private Charset
private static final float
private int
private int
private int
private int
private static final float
private static final int
The start pattern (17 bits)private static final int
The stop pattern (18 bits) -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
calculateNumberOfRows
(int m, int k, int c) Calculates the necessary number of rows as described in annex Q of ISO/IEC 15438:2001(E).private int[]
determineDimensions
(int sourceCodeWords, int errorCorrectionCodeWords) Determine optimal nr of columns and rows for the specified number of codewords.private static void
encodeChar
(int pattern, int len, BarcodeRow logic) private void
encodeLowLevel
(CharSequence fullCodewords, int c, int r, int errorCorrectionLevel, BarcodeMatrix logic) void
generateBarcodeLogic
(String msg, int errorCorrectionLevel) void
generateBarcodeLogic
(String msg, int errorCorrectionLevel, boolean autoECI) private static int
getNumberOfPadCodewords
(int m, int k, int c, int r) Calculates the number of pad codewords as described in 4.9.2 of ISO/IEC 15438:2001(E).void
setCompact
(boolean compact) void
setCompaction
(Compaction compaction) void
setDimensions
(int maxCols, int minCols, int maxRows, int minRows) Sets max/min row/col valuesvoid
setEncoding
(Charset encoding)
-
Field Details
-
START_PATTERN
private static final int START_PATTERNThe start pattern (17 bits)- See Also:
-
STOP_PATTERN
private static final int STOP_PATTERNThe stop pattern (18 bits)- See Also:
-
CODEWORD_TABLE
private static final int[][] CODEWORD_TABLEThe codeword table from the Annex A of ISO/IEC 15438:2001(E). -
PREFERRED_RATIO
private static final float PREFERRED_RATIO- See Also:
-
DEFAULT_MODULE_WIDTH
private static final float DEFAULT_MODULE_WIDTH- See Also:
-
HEIGHT
private static final float HEIGHT- See Also:
-
barcodeMatrix
-
compact
private boolean compact -
compaction
-
encoding
-
minCols
private int minCols -
maxCols
private int maxCols -
maxRows
private int maxRows -
minRows
private int minRows
-
-
Constructor Details
-
PDF417
public PDF417() -
PDF417
public PDF417(boolean compact)
-
-
Method Details
-
getBarcodeMatrix
-
calculateNumberOfRows
private static int calculateNumberOfRows(int m, int k, int c) Calculates the necessary number of rows as described in annex Q of ISO/IEC 15438:2001(E).- Parameters:
m
- the number of source codewords prior to the additional of the Symbol Length Descriptor and any pad codewordsk
- the number of error correction codewordsc
- the number of columns in the symbol in the data region (excluding start, stop and row indicator codewords)- Returns:
- the number of rows in the symbol (r)
-
getNumberOfPadCodewords
private static int getNumberOfPadCodewords(int m, int k, int c, int r) Calculates the number of pad codewords as described in 4.9.2 of ISO/IEC 15438:2001(E).- Parameters:
m
- the number of source codewords prior to the additional of the Symbol Length Descriptor and any pad codewordsk
- the number of error correction codewordsc
- the number of columns in the symbol in the data region (excluding start, stop and row indicator codewords)r
- the number of rows in the symbol- Returns:
- the number of pad codewords
-
encodeChar
-
encodeLowLevel
private void encodeLowLevel(CharSequence fullCodewords, int c, int r, int errorCorrectionLevel, BarcodeMatrix logic) -
generateBarcodeLogic
- Parameters:
msg
- message to encodeerrorCorrectionLevel
- PDF417 error correction level to use- Throws:
WriterException
- if the contents cannot be encoded in this format
-
generateBarcodeLogic
public void generateBarcodeLogic(String msg, int errorCorrectionLevel, boolean autoECI) throws WriterException - Parameters:
msg
- message to encodeerrorCorrectionLevel
- PDF417 error correction level to useautoECI
- automatically insert ECIs if needed- Throws:
WriterException
- if the contents cannot be encoded in this format
-
determineDimensions
private int[] determineDimensions(int sourceCodeWords, int errorCorrectionCodeWords) throws WriterException Determine optimal nr of columns and rows for the specified number of codewords.- Parameters:
sourceCodeWords
- number of code wordserrorCorrectionCodeWords
- number of error correction code words- Returns:
- dimension object containing cols as width and rows as height
- Throws:
WriterException
-
setDimensions
public void setDimensions(int maxCols, int minCols, int maxRows, int minRows) Sets max/min row/col values- Parameters:
maxCols
- maximum allowed columnsminCols
- minimum allowed columnsmaxRows
- maximum allowed rowsminRows
- minimum allowed rows
-
setCompaction
- Parameters:
compaction
- compaction mode to use
-
setCompact
public void setCompact(boolean compact) - Parameters:
compact
- if true, enables compaction
-
setEncoding
- Parameters:
encoding
- sets character encoding to use
-