question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I 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:

IMG_20200807_120127673

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:

IMG_20200807_120156827

So we can tell that the problem while printing large QR Codes is not related to the printer device.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DantSucommented, Aug 20, 2020

Please use v2.0.6 and give me a feedback.

0reactions
vannakyetcommented, Jan 3, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

9 reasons Why Your QR Code is Not Working - Beaconstac blog
A QR Code campaign might be disabled for a number of reasons like – failed conversion rates, a decrease in engagement, or even...
Read more >
QR codes are a privacy problem - The Washington Post
QR codes come with some security risks as well, according to Allan Liska, a senior threat analyst at cybersecurity firm Recorded Future. Like ......
Read more >
Are QR Codes Safe? Best Practices to Ensure QR Code Security
What are the potential QR code security risks? · Replacing genuine QR codes in public places with malicious codes: · QR code phishing...
Read more >
Risks of Using QR Codes | IEEE Computer Society
Potential QR Code Threats · Malware attacks · Phishing Attacks · Bugs in QR codes · Financial theft.
Read more >
4 Ways Scanning QR Codes Can Expose You to Security ...
Scammers can easily create a QR code, add the logo for the Google or Apple app stores, and paste them wherever. Scanning such...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found