QR Code issues
See original GitHub issueI am very grateful for making the library available, it has been very useful.
But I’m facing some issues while printing QR Code. I’m using version 2.0.5 of the library. Here are the details:
Successful prints using sizes 20 and 27:
[L]<qrcode size='20'>http://www.developpeur-web.dantsu.com/</qrcode>
[L]<qrcode size='27'>http://www.developpeur-web.dantsu.com/</qrcode>
Unsuccessful prints using sizes greater than 27:
Error 1:
[L]<qrcode size='28'>http://www.developpeur-web.dantsu.com/</qrcode>
Library throws exception:
java.lang.ArrayIndexOutOfBoundsException: length=29; index=29 at com.dantsu.escposprinter.EscPosPrinterCommands.QRCodeDataToBytes(EscPosPrinterCommands.java:167) at com.dantsu.escposprinter.textparser.PrinterTextParserQRCode.initConstructor(PrinterTextParserQRCode.java:32) at com.dantsu.escposprinter.textparser.PrinterTextParserQRCode.<init>(PrinterTextParserQRCode.java:40) at com.dantsu.escposprinter.textparser.PrinterTextParserColumn.appendQRCode(PrinterTextParserColumn.java:266) at com.dantsu.escposprinter.textparser.PrinterTextParserColumn.<init>(PrinterTextParserColumn.java:77) at com.dantsu.escposprinter.textparser.PrinterTextParserLine.<init>(PrinterTextParserLine.java:46) at com.dantsu.escposprinter.textparser.PrinterTextParser.parse(PrinterTextParser.java:173) at com.dantsu.escposprinter.EscPosPrinter.printFormattedText(EscPosPrinter.java:95) at com.dantsu.escposprinter.EscPosPrinter.printFormattedText(EscPosPrinter.java:77)
Using the same size but with another content, the QR Code prints normally:
[L]<qrcode size='28'>http://www.google.com/</qrcode>
I think the problem is not only related to the size, but also to the content of QR Code.
Error 2:
[L]<qrcode size='35'>http://www.developpeur-web.dantsu.com/</qrcode>
QR Code starts to be printed, but before completing, some characters are printed instead of the content and the printer continues to feed these characters repeatedly until I switch off manually. See the result:
I made an even bigger QR Code print through another app that doesn’t use the library and it managed to print normally, see the image:
So we can tell that the problem while printing large QR Codes is not related to the printer device.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
Please use v2.0.6 and give me a feedback.
EscPosPrinter printer = new EscPosPrinter(printerConnection, 203, 48f, 32); printer .printFormattedText( “[L]\n” +
“[C]<qrcode size='20'>http://www.developpeur-web.dantsu.com/</qrcode>” );
not aline center.