PDF417LogicImpl { public static void generateBarcodeLogic(TwoDimBarcodeLogicHandler logic, String msg, PDF417Bean pdf417Bean) { final ErrorCorrectionLevel errorCorrectionLevel = pdf417Bean.getErrorCorrectionLevel(); final int errorCorrectionCodeWords = PDF417ErrorCorrection.getErrorCorrectionCodewordCount( errorCorrectionLevel); final String highLevel = PDF417HighLevelEncoder.encodeHighLevel(msg, pdf417Bean.getEncoding(), pdf417Bean.isECIEnabled()); final int sourceCodeWords = highLevel.length(); final Dimension dimension = determineDimensions(pdf417Bean, sourceCodeWords); if (dimension == null) { throw new IllegalArgumentException( "Unable to fit message in columns"); } final int rows = dimension.height; final int cols = dimension.width; final int pad = getNumberOfPadCodewords(sourceCodeWords, errorCorrectionCodeWords, cols, rows); final int n = getNumberOfDataCodewords(sourceCodeWords, errorCorrectionLevel, cols); if (n > 929) { throw new IllegalArgumentException( "Encoded message contains to many code words, message to big (" + msg.length() + " bytes)"); } final StringBuilder sb = new StringBuilder(n); sb.append((char)n); sb.append(highLevel); for (int i = 0; i < pad; i++) { sb.append((char)900); } final String dataCodewords = sb.toString(); final String ec = PDF417ErrorCorrection.generateErrorCorrection( dataCodewords, errorCorrectionLevel); final String fullCodewords = dataCodewords + ec; logic.startBarcode(msg, msg); encodeLowLevel(fullCodewords, cols, rows, errorCorrectionLevel, logic); logic.endBarcode(); }  static int getNumberOfRows(int m, int k, int c); static int calculateNumberOfRows(int m, int k, int c); static int getNumberOfPadCodewords(int m, int k, int c, int r); static int getNumberOfDataCodewords(int m, ErrorCorrectionLevel errorCorrectionLevel, int c); static void generateBarcodeLogic(TwoDimBarcodeLogicHandler logic,
            String msg, PDF417Bean pdf417Bean); static Dimension determineDimensions(PDF417Bean pdf417Bean,
            int sourceCodeWords);  }
@Test public void testGenerateBarcodeLogic() { System.out.println("generateBarcodeLogic"); PDF417Bean pdf417Bean = new PDF417Bean(); TwoDimBarcodeLogicHandler logic = new DefaultTwoDimCanvasLogicHandler(pdf417Bean, new Canvas(svg)); String msg = "url(data:;encoding=UTF-8,Barcode4J)"; PDF417LogicImpl.generateBarcodeLogic(logic, msg, pdf417Bean); assertTrue("sth long has been printed...", SVGCanvasProviderTest.getStringFromDoc(svg.getDOM()).length() > 200); }