Class PDF417

java.lang.Object
com.google.zxing.pdf417.encoder.PDF417

public final class PDF417 extends Object
Top-level class for the logic part of the PDF417 implementation.
  • Field Details

    • START_PATTERN

      private static final int START_PATTERN
      The start pattern (17 bits)
      See Also:
    • STOP_PATTERN

      private static final int STOP_PATTERN
      The stop pattern (18 bits)
      See Also:
    • CODEWORD_TABLE

      private static final int[][] CODEWORD_TABLE
      The 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

      private BarcodeMatrix barcodeMatrix
    • compact

      private boolean compact
    • compaction

      private Compaction compaction
    • encoding

      private Charset 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

      public BarcodeMatrix 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 codewords
      k - the number of error correction codewords
      c - 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 codewords
      k - the number of error correction codewords
      c - 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

      private static void encodeChar(int pattern, int len, BarcodeRow logic)
    • encodeLowLevel

      private void encodeLowLevel(CharSequence fullCodewords, int c, int r, int errorCorrectionLevel, BarcodeMatrix logic)
    • generateBarcodeLogic

      public void generateBarcodeLogic(String msg, int errorCorrectionLevel) throws WriterException
      Parameters:
      msg - message to encode
      errorCorrectionLevel - 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 encode
      errorCorrectionLevel - PDF417 error correction level to use
      autoECI - 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 words
      errorCorrectionCodeWords - 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 columns
      minCols - minimum allowed columns
      maxRows - maximum allowed rows
      minRows - minimum allowed rows
    • setCompaction

      public void setCompaction(Compaction compaction)
      Parameters:
      compaction - compaction mode to use
    • setCompact

      public void setCompact(boolean compact)
      Parameters:
      compact - if true, enables compaction
    • setEncoding

      public void setEncoding(Charset encoding)
      Parameters:
      encoding - sets character encoding to use