I need to print a QR code on a Bematech MP-4200 ADV printer using ESC/POS commands. When I print it from my system, the printing works correctly. However, when the client tries to use it, the QR code printing is flawed, even though they are using the same printer model and drivers.
The URL to be printed is something like this (I replaced some numbers with X for company data security), but it only encodes in the QR code up to the 60th character. After that, it appears as text:
http://nfce.set.rn.gov.br/consultarNFCe.aspx?p=242309XXXXX9040001XXXXXXXXXXXXXXXXXXXXXXXXXX|2|1|2|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Incomplete QR code printed with the rest of the text at the top:

However, if I print the URL:
http://nfce.set.rn.gov.br/consultarNFCe.aspx?p=242309XXXXX9040001XXXXXXXXXXXXXXXXXXXXXXXXXX|2|1|14|3.60|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX|2|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
which is longer, it prints correctly.
My code to generate the QR Code:
int qrLen = url.length() + 3;
char ph = (char) (qrLen / 256);
char pl = (char) (qrLen % 256);
String qrCode = "" + (char) 29 + (char) 40 + (char) 107 + (char) 4 + (char) 0 + (char) 49 + (char) 65 + (char) 50 + (char) 0 +
(char) 29 + (char) 40 + (char) 107 + (char) 3 + (char) 0 + (char) 49 + (char) 67 + (char) size +
(char) 29 + (char) 40 + (char) 107 + (char) 3 + (char) 0 + (char) 49 + (char) 69 + (char) 49 +
(char) 29 + (char) 40 + (char) 107 + (char) pl + ph + (char) 49 + (char) 80 + (char) 48 + url +
(char) 29 + (char) 40 + (char) 107 + (char) 3 + (char) 0 + (char) 49 + (char) 81 + (char) 48;
return qrCode;