From: <Tyl...@cr...> - 2011-07-06 17:38:28
|
I'm using Barcode4J version 2.1, trying to encode a string in a PDF417 barcode. Some sections of the message are either being encoded or read incorrectly. The following is the test I'm running: File outputFile = new File("out.png"); OutputStream out = null; final int dpi = 150; PDF417Bean bean = new PDF417Bean(); bean.setColumns(10); bean.setErrorCorrectionLevel(5); try { out = new FileOutputStream(outputFile); BitmapCanvasProvider canvas = new BitmapCanvasProvider(out, "image/x-png", dpi, BufferedImage.TYPE_BYTE_BINARY, false, 0); bean.generateBarcode(canvas, "[)>\u001E06\u001D9S1823\u001D20L401\u001E06\u001DP106158-021\u001DQ0\u001D14K267183+10\u001D11K123\u001E\u0004 "); canvas.finish(); } catch(Exception e) { e.printStackTrace(); } finally { if(out != null) { try { out.close(); } catch(Exception e) { e.printStackTrace(); } } } I've uploaded the output image to here: http://i.imgur.com/DNsvT.png Reading the barcode gives: "[)>#06#9S1823#CA#EAB#06#P106158-021#Q0#14K267183+10#BB&BCD## " It should be something like: "[)>#06#9S1823#20L401#06#P106158-012#Q0#14K267183+10#11K123## " Note: my scanner doesn't display control characters, only giving a box, so I've used '#' in place of that. I've also tried a couple of online readers which also give the incorrect value. I'll see if I can whittle this down to a simplified test message later. Thank you, Tyler Koenig |