ESCPOS-ThermalPrinter-Android icon indicating copy to clipboard operation
ESCPOS-ThermalPrinter-Android copied to clipboard

Testing on Bixolon

Open albgen opened this issue 1 year ago • 20 comments

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: Bixolon SPP-R400 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

albgen avatar Nov 30 '23 13:11 albgen

Did another test with size of the QR code to 60 and it printed it correctly but only once. (Previous value was 20). image

Another test as well and this time some strange chars bixolo2

Another one bixolon3

Most of the times i see "Success, Congratulation! the text are printed!" but actually is not printing nothing.

albgen avatar Nov 30 '23 14:11 albgen

After several tests, i notice that printing image and/or qrcode it breaks the printer somehow but don't know th reason.

albgen avatar Nov 30 '23 14:11 albgen

Hi, active ESC * command

DantSu avatar Nov 30 '23 18:11 DantSu

Hi, active ESC * command

Hi, can you explain please? I'm not sure

albgen avatar Nov 30 '23 19:11 albgen

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

DantSu avatar Nov 30 '23 21:11 DantSu

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...

bixescon

albgen avatar Dec 01 '23 12:12 albgen

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.

https://github.com/DantSu/ESCPOS-ThermalPrinter-Android/blob/master/escposprinter/src/main/java/com/dantsu/escposprinter/connection/DeviceConnection.java

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());
        }
    }

DantSu avatar Dec 01 '23 13:12 DantSu

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. image

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.

albgen avatar Dec 04 '23 14:12 albgen

paste me your code.

DantSu avatar Dec 04 '23 14:12 DantSu

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"
                );    
    }

albgen avatar Dec 04 '23 14:12 albgen

AsyncEscPosPrinter printer = new AsyncEscPosPrinter(printerConnection, 203, 100f, 72);

DantSu avatar Dec 04 '23 14:12 DantSu

i tried with:

AsyncEscPosPrinter printer = new AsyncEscPosPrinter(printerConnection, 203, 111f, 32); where 111mm is the width and the result is as follows:

image Image is centered Barcode also centered The other elements seems not

albgen avatar Dec 04 '23 15:12 albgen

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"

DantSu avatar Dec 04 '23 15:12 DantSu

result with 72 No QR Code printed and and text align on the right broken. Most probably need to try with less than 72?

image

albgen avatar Dec 04 '23 15:12 albgen

ok 69

DantSu avatar Dec 04 '23 15:12 DantSu

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?

image

albgen avatar Dec 04 '23 15:12 albgen

Test this :

                                "[L]<barcode type='ean13' height='10'>831254784551</barcode>\n" +
                                "[L]blabla\n" +
                                "[C]<qrcode size='20'>https://dantsu.com/</qrcode>\n"

DantSu avatar Dec 04 '23 15:12 DantSu

with:

 "[L]<barcode type='ean13' height='10'>831254784551</barcode>\n" +
  "[L]blabla\n" +
  "[C]<qrcode size='20'>https://dantsu.com/</qrcode>\n"

Result:

image

albgen avatar Dec 04 '23 15:12 albgen

ok, so it's command of barcode that move qrcode or images to the right... I will look for it.

DantSu avatar Dec 04 '23 16:12 DantSu

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"

image

image

without the ESC @ the result is image

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

albgen avatar Dec 13 '23 17:12 albgen