[英]How to increase the size of QR code image - print that is compatible with ESC/POS commands
我已成功打印 QR 和文本 - 打印出下面給出的圖像
問題- 如何增加 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"
);
您可以通過更改<qrcode>
標簽內的 size 值來增加/減少QR的大小
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.