Open albgen opened 9 months ago
Did another test with size of the QR code to 60 and it printed it correctly but only once. (Previous value was 20).
Another test as well and this time some strange chars
Another one
Most of the times i see "Success, Congratulation! the text are printed!" but actually is not printing nothing.
After several tests, i notice that printing image and/or qrcode it breaks the printer somehow but don't know th reason.
Hi, active ESC * command
Hi, active ESC * command
Hi, can you explain please? I'm not sure
Look the doc :
Method : useEscAsteriskCommand(boolean enable)
Active "ESC *" command for image printing.
param boolean enable : true to use "ESC *", false to use "GS v 0"
return Printer : Fluent interface
thanks, i tried to enable the useEscAsteriskCommand and it seems a lot better but still it has issues. It printed 3 times ok, than 1 not ok, than 2 not ok, than 1 ok...
That's bluetooth problem. Sometime your connection lost data then error appear. Try to increase time.sleep between commands. Try to divide by 8 instead of 16.
public void send(int addWaitingTime) throws EscPosConnectionException {
if(!this.isConnected()) {
throw new EscPosConnectionException("Unable to send data to device.");
}
try {
this.outputStream.write(this.data);
this.outputStream.flush();
int waitingTime = addWaitingTime + this.data.length / 16; <======== HERE
this.data = new byte[0];
if(waitingTime > 0) {
Thread.sleep(waitingTime);
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
throw new EscPosConnectionException(e.getMessage());
}
}
I changed and tried 4 times in a row and worked perfectly with no issues. Great!
Have a question regarding the alignement of the text and of the image. If you notice on the picture below, the image is not centered while the barcode and the QRCode are centered.
Also, on the same image above: centering the text does not seem to work. It seems is considering in all cases a format of the paper smaller. Any idea?
Thanks.
paste me your code.
it is the same written on the demo code. Did not changed anything
@SuppressLint("SimpleDateFormat")
public AsyncEscPosPrinter getAsyncEscPosPrinter(DeviceConnection printerConnection) {
SimpleDateFormat format = new SimpleDateFormat("'on' yyyy-MM-dd 'at' HH:mm:ss");
AsyncEscPosPrinter printer = new AsyncEscPosPrinter(printerConnection, 203, 48f, 32);
// EscPosPrinter printer = new EscPosPrinter(printerConnection, 203, 48f, 32);
return
// printer.useEscAsteriskCommand(true);
printer.addTextToPrint(
"[C]<img>" + PrinterTextParserImg.bitmapToHexadecimalString(printer, this.getApplicationContext().getResources().getDrawableForDensity(R.drawable.logo, DisplayMetrics.DENSITY_MEDIUM)) + "</img>\n" +
"[L]\n" +
"[C]<u><font size='big'>ORDER N°045</font></u>\n" +
"[L]\n" +
"[C]<u type='double'>" + format.format(new Date()) + "</u>\n" +
"[C]\n" +
"[C]================================\n" +
"[L]\n" +
"[L]<b>BEAUTIFUL SHIRT</b>[R]9.99€\n" +
"[L] + Size : S\n" +
"[L]\n" +
"[L]<b>AWESOME HAT</b>[R]24.99€\n" +
"[L] + Size : 57/58\n" +
"[L]\n" +
"[C]--------------------------------\n" +
"[R]TOTAL PRICE :[R]34.98€\n" +
"[R]TAX :[R]4.23€\n" +
"[L]\n" +
"[C]================================\n" +
"[L]\n" +
"[L]<u><font color='bg-black' size='tall'>Customer :</font></u>\n" +
"[L]Raymond DUPONT\n" +
"[L]5 rue des girafes\n" +
"[L]31547 PERPETES\n" +
"[L]Tel : +33801201456\n" +
"\n" +
"[C]<barcode type='ean13' height='10'>831254784551</barcode>\n" +
"[L]\n" +
"[C]<qrcode size='20'>https://dantsu.com/</qrcode>\n"
);
}
AsyncEscPosPrinter printer = new AsyncEscPosPrinter(printerConnection, 203, 100f, 72);
i tried with:
AsyncEscPosPrinter printer = new AsyncEscPosPrinter(printerConnection, 203, 111f, 32);
where 111mm is the width and the result is as follows:
Image is centered Barcode also centered The other elements seems not
hmm ... try this :
AsyncEscPosPrinter printer = new AsyncEscPosPrinter(printerConnection, 203, 111f, 72); // <- 72
"[C]<barcode type='ean13' height='10'>831254784551</barcode>\n" +
"[L]blabla\n" +
"[C]<qrcode size='20'>https://dantsu.com/</qrcode>\n"
result with 72 No QR Code printed and and text align on the right broken. Most probably need to try with less than 72?
ok 69
Seems perfect with 69. The only small issue is the QR Code which is aligned a little bit on the right instead if the center, right?
Test this :
"[L]<barcode type='ean13' height='10'>831254784551</barcode>\n" +
"[L]blabla\n" +
"[C]<qrcode size='20'>https://dantsu.com/</qrcode>\n"
with:
"[L]<barcode type='ean13' height='10'>831254784551</barcode>\n" +
"[L]blabla\n" +
"[C]<qrcode size='20'>https://dantsu.com/</qrcode>\n"
Result:
ok, so it's command of barcode that move qrcode or images to the right... I will look for it.
Hello again,
just made some tests and if i send and ESC @ after the barcode, it is working as expected so QR Code is placed accordingly as the alignement used.
"[C]<barcode type='ean13' height='20'>831254784551</barcode>\n" +
"[L]blabla\n" +
"[L]<qrcode size='40'>https://dantsu.com/</qrcode>\n"
without the ESC @ the result is
btw i think is a problem on all devices and not only on Bixolon because the results are the same even on virtual device like the previous screenshot
hi There,
Really like this project because you can send "natural language" command instead of the ESC/POS :) My goal is to print on Bixolon printers. Currently i tested on SPP-R400 Printer (ESC/POS Command)
Seems though there is a problem with printing QR Codes. The following is what is printed: After this, the printer seems unstable and not usable. I need to switch it off and than back off in order to start to print.
Any idea? How to trobuleshoot?
thanks