Class PDF417LogicImpl

java.lang.Object
org.krysalis.barcode4j.impl.pdf417.PDF417LogicImpl

public class PDF417LogicImpl extends Object
Top-level class for the logic part of the PDF417 implementation.
Version:
$Id: PDF417LogicImpl.java,v 1.5 2012-05-17 13:57:37 jmaerki Exp $
  • Constructor Details

    • PDF417LogicImpl

      public PDF417LogicImpl()
  • Method Details

    • getNumberOfRows

      public static int getNumberOfRows(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)
    • calculateNumberOfRows

      public 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

      public 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
    • getNumberOfDataCodewords

      public static int getNumberOfDataCodewords(int m, int errorCorrectionLevel, int c)
      Calculates the number of data codewords (equals the Symbol Length Descriptor).
      Parameters:
      m - the number of source codewords prior to the additional of the Symbol Length Descriptor and any pad codewords
      errorCorrectionLevel - the error correction level (value between 0 and 8)
      c - the number of columns in the symbol in the data region (excluding start, stop and row indicator codewords)
      Returns:
      the number of data codewords
    • generateBarcodeLogic

      public static void generateBarcodeLogic(TwoDimBarcodeLogicHandler logic, String msg, PDF417Bean pdf417Bean)
      Generates the barcode logic.
      Parameters:
      logic - the logic handler to receive generated events
      msg - the message to encode
      pdf417Bean - reference to the PDF417 bean for configuration access
    • determineDimensions

      public static Dimension determineDimensions(PDF417Bean pdf417Bean, int sourceCodeWords)
      Determine optimal nr of columns and rows for the specified number of codewords.
      Parameters:
      pdf417Bean - contains configuration settings
      sourceCodeWords - number of code words
      Returns:
      dimension object containing cols as width and rows as height