auctifera-josed / starprnt

Cordova plugin for the Star micronics printers
MIT License
40 stars 39 forks source link

How to make two QrCodes side by side, and make the width size fixed #53

Open king742171 opened 3 years ago

king742171 commented 3 years ago

How to make two QrCodes side by side, and make the width size fixed

I need to customize the printed content

so I try to use print function

here my code

let qrStrLeft = "AB112233441020523999900000144000001540000000001234567ydXZt4LAN1UHN/j1juVcRA==:**********:3:3:0:乾電池:1:105:乾電池:1:105:乾電池:1:105:乾電池:1:105:乾"; let qrStrRight = "**"; let commandsArray = []; commandsArray.push({appendEncoding:Encoding.Big5}); commandsArray.push({append:"test Print\ntest----------test\nelection invoice\nQQ123456789\n"}); commandsArray.push({append:"測試列印\n測試----------測試\n電子發票\nQQ123456789\n"}); commandsArray.push({appendEncoding:Encoding.UTF8}); commandsArray.push({appendBarcode:"Star", BarcodeSymbology:BarcodeSymbology.Code128, BarcodeWidth:BarcodeWidth.Mode3, height:70, hri:true, absolutePosition:40, alignment:AlignmentPosition.Center}); commandsArray.push({appendBarcode:"Star", BarcodeSymbology:BarcodeSymbology.Code128, BarcodeWidth:BarcodeWidth.Mode3, height:70, hri:true, absolutePosition:60, alignment:AlignmentPosition.Center}); commandsArray.push({appendQrCode:qrStrLeft, QrCodeModel:"No2", QrCodeLevel:"Q", cell: 4, alignment:AlignmentPosition.Left}); commandsArray.push({appendQrCode:qrStrRight, QrCodeModel:"No2", QrCodeLevel:"Q", cell: 4, alignment:AlignmentPosition.Right}); commandsArray.push({appendLogo:1, logoSize:"DoubleWidthDoubleHeight"}); commandsArray.push({appendEncoding:Encoding.Big5}); commandsArray.push({ append: " Star Clothing Boutique\n" + " 123 Star Road\n" + " City, State 12345\n" + "\n" + "Date:MM/DD/YYYY Time:HH:MM PM\n" + "--------------------------------------\n" + "SALE\n" + "SKU Description Total\n" + "300678566 PLAIN T-SHIRT 10.99\n" + "300692003 BLACK DENIM 29.99\n" + "300651148 BLUE DENIM 29.99\n" + "300642980 STRIPED DRESS 49.99\n" + "30063847 BLACK BOOTS 35.99\n" + "\n" + "Subtotal 156.95\n" + "Tax 0.00\n" + "--------------------------------------\n" + "Total $156.95\n" + "--------------------------------------\n" + "\n" + "Charge\n" + "156.95\n" + "Visa XXXX-XXXX-XXXX-0123\n" + "Refunds and Exchanges\n" + "Within 30 days with receipt\n" + "And tags attached\n" + "測試列印中文字\n" }); commandsArray.push({appendCutPaper: "FullCutWithFeed"}); // eslint-disable-next-line no-undef starprnt.print(ip, 'StarLine', commandsArray, function (result) { alert("列印成功:"+result) }, function (error) { alert("列印失敗:"+error) })

that have problem, qrStrRight will print a small QrCode, but I need two QrCodes have same width, and one at left, one at right

How to do ? or Can I do that ?