do you have Github repo of your code?
How To Print QRCode in Thermal Printer
Hi, 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).
I have an Thermal Printer, and im already printing text through the BluetoothSocket, and i can print QRCodes, but only small QRCodes, if i print a QRCode with more than X characters it will send a QRCode that is not well formated 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(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();
3 answers
Sort by: Most helpful
-
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more