如何增加QR码图像的大小-兼容ESC/POS命令的打印

How to increase the size of QR code image - print that is compatible with ESC/POS commands

我已成功打印 QR 和文本 - 打印出下面给出的图像

问题 - 如何增大二维码图片大小

第一个二维码是我的输出!! 需要像第二个QR一样增加

我的代码:

 byte[] INIT = {27, 64};
 byte[] FEED_LINE = {10};
 byte[] SELECT_FONT_A = {27, 33, 0};
 byte[] ALLINEA_CT = {0x1B, 0x61, 0x01};
 byte[] ALLINEA_SELECT = {0x1b, 0x3d, 0x01};
 byte[] FONT_1X = {0x1D, 0x21, 0x00};
 byte[] SET_BAR_CODE_HEIGHT = {29, 104, 100};

                    OutputStream oStream = sock.getOutputStream();
                    oStream.write(INIT);
                    oStream.write(ALLINEA_CT);
                    oStream.write(SET_BAR_CODE_HEIGHT);
                    oStream.write(ALLINEA_CT); 
                    oStream.write(ALLINEA_SELECT);
                    oStream.write(command); //command is byte[] command (QR code)
                    oStream.write(FEED_LINE);

                    oStream.write(ALLINEA_CT); //text to center
                    oStream.write(SELECT_FONT_A);
                    oStream.write(FONT_1X);
                    oStream.write("TABLE : ".getBytes());
                    oStream.write(strTable.getBytes());
                    oStream.write(FEED_LINE);

                    oStream.write(new byte[]{0x1D, 0x56, 0x41, 0x10});
                    oStream.flush();
                    oStream.close();
               

请告诉我如何增加 QR 的大小。

无法通过上述方式将尺寸增加超过 255px。

终于解决了这个库的大小问题

implementation 'com.github.DantSu:ESCPOS-ThermalPrinter-Android:3.0.0'

代码

EscPosPrinter printer = new EscPosPrinter(deviceConnection, 203, 48f, 32);
                    printer
                            .printFormattedText(
                                    "[C]<qrcode size='50'>"+strQr+"</qrcode>\n" +
                                            "[C]\n" +
                                            "[C]<font size='tall'>Table No : "+strTable+"</font>\n"
                            );

您可以 increase/decrease QRsize 通过更改值<qrcode> 标签内的大小