2022-09-17

print QrCode with more than 125 characters esc/pos javascrypt

I'm trying to print a qrCode in esc/pos (page mode) using javascript. The printer is Epson TM-T20X

When I put less than 125 characters in the QrCode it works perfectly but more than that makes the printer stuck and eventually (after trying to print a test page a few times) it prints a bunch of weird characters.

the test qrCode string is as follows: aaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbbaaaaaaaaaa

code:

        var inAux = QRcode.length + 3;
        var pL = inAux%256
        var pH = inAux/256
        var size = 3;

        impressao += Char(29)+Char(40)+Char(107)+Char(4)+Char(0)+Char(49)+Char(65)+Char(49)+Char(0); // Select the model (1)
        impressao += Char(29)+Char(40)+Char(107)+Char(3)+Char(0)+Char(49)+Char(67)+Char(size); // Size Module
        impressao += Char(29)+Char(40)+Char(107)+Char(3)+Char(0)+Char(49)+Char(69)+Char(48); // Correction Level (L)
        impressao += Char(29)+Char(40)+Char(107)+Char(pL)+Char(pH)+Char(49)+Char(80)+Char(48); // Store the data in the symbol storage area
        impressao += QRcode;
        impressao += Char(29) + Char(40) + Char(107) + Char(3) + Char(0) + Char(49) + Char(81) + Char(48); // Print the symbol data in the symbol storage area
        impressao += esc + Char(12); // print page mode (ESC FF)```


No comments:

Post a Comment