0

Can anyone help me with this situation? I'm in need of help printing a QR code using Xamarin.Forms (iOS and Android) (I just need the Android version).

Printer Model: Eurosys POSIMPT9BT02 (Generic Printer / Supports ESC POS Print Method) Language: Xamarin.Forms (C#)

I'm sending this via BluetoothSocket in Xamarin.Forms.

I have an Thermal Printer, and I'm already printing text through the BluetoothSocket, and I can print QRCodes, but only small QRCodes, if I print a QRCode with more than >500 characters it will send a QRCode that is not well formatted and the camera can't read it. Here's the code that I have so far.

var byteslist = new List<byte>();
    
byte[] qrBytes = System.Text.Encoding.ASCII.GetBytes("HERE IS THE TEXT FOR THE QRCODE");
int dataLength = qrBytes.Length + 3;
byte dataPL = (byte)(dataLength % 256);
byte dataPH = (byte)(dataLength / 256);
var bytes = new List<byte>();

bytes.AddRange(new byte[] { 0x1D, 0x28, 0x6b, 0x04, 0x00, 0x31, 0x41, 0x33, 0x00 });
bytes.AddRange(new byte[] { 0x1D, 0x28, 0x6b, 0x03, 0x00, 0x31, 0x43, 0x05 });
bytes.AddRange(new byte[] { 0x1D, 0x28, 0x6b, 0x03, 0x00, 0x31, 0x45, 0x30 }); 
bytes.AddRange(new byte[] { 0x1D, 0x28, 0x6B, dataPL, dataPH, 0x31, 0x50, 0x30 }); 
bytes.AddRange(qrBytes);
bytes.AddRange(new byte[] { 0x1D, 0x28, 0x6b, 0x03, 0x00, 0x31, 0x51, 0x30 });
    
           
await socket.OutputStream.WriteAsync(bytes.ToArray(), 0, bytes.Count);
socket.Close();

**

String example that im using to print this QRCode: A:503745561B:C:D:FTE:NF:20211027G:21 /H:I1:ESN:0O:0*Q:fH3HRTUk2V7rlYr1xdpc8lfrEVZCxTrR7ylpzKRv0KWtyBAmESRzl33Qq0Etb6RQcuHo9boupsp6 S20gtjLCjVg6sA4qEZfQ9uBaDtB4Au2jyQeFdmm5HAo0GPUSILpRy5fcq0jI2FgNVANnpcV4RbvI BkgFGCEQc6xbx1HhiDw=*R:0008

**

This it my current output, which shows a QRCode that is not working correctly:

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • What is a "thermal printer"? Every printer is different - what specific printer are you using and what print language does it support? Are you using a native QR function of the printer, or printing as an image? "more than X characters" - what specifically is X? "not well formated' - what does this mean? Can you include an image that demonstrates? There is a LOT of missing information in your post. – Jason Nov 03 '21 at 10:31
  • Hi, sorry, its my 2nd time posting here and im still learning about this forum, sorry for that. Back to the subject, i added an image, and specified the characters, the printer is a eurosys posimpt9bt02, there is not really a "good" doc about it, i already read, but its kinda hard for me to understand, far as i know, it supports a generic print method like ESC POS for example. I really need help figuring out this QRCode problem.. Can you help me please sir? – Rúben Ribeiro Nov 03 '21 at 10:41
  • I also provided the string example that im using to print this QRCode. – Rúben Ribeiro Nov 03 '21 at 10:46
  • https://stackoverflow.com/questions/23577702/printing-qr-codes-through-an-esc-pos-thermal-printer – Jason Nov 03 '21 at 10:47
  • Im sorry Jason, but i already have tried that and the same issue still happens.. – Rúben Ribeiro Nov 03 '21 at 10:51
  • The second answer on that question contains an extensive discussion about QR formats, error correction and other things that might impact printing. Have you read ALL of it and considered everything suggested? Do you know what QR formats the printer supports? – Jason Nov 03 '21 at 10:57
  • Yes, i tried a lot of examples, including the suggestions on that question, nothing is working. The docs of this print doesn't even talk about any QRCode thing, but the thing that i know is that for small things like "www.google.pt", it prints very good and the phone can actually read it, but when exceedes 500 characters it just doesnt work anymore the qrcode, it prints the example that is in the image. – Rúben Ribeiro Nov 03 '21 at 11:05

0 Answers0