I am working with a bluetooth thermal printer and was able to print normal text and invoice's as well. But i am not able to print barcodes.
I am generating barcode with ZXING library
OutputStream os = mBluetoothSocket.getOutputStream();
String text = mEditText.getText().toString();
MultiFormatWriter multiFormatWriter = new MultiFormatWriter();
BitMatrix bitMatrix = multiFormatWriter.encode(text,BarcodeFormat.CODE_128,200,200);
BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
Bitmap bitmap = barcodeEncoder.createBitmap(bitMatrix);
os.write("Hello".getBytes()); //Prints Hello
How can i print the bitmap using the same logic ?
I have tried some codes like
int size = bitmap.getRowBytes() * bitmap.getHeight();
ByteBuffer byteBuffer = ByteBuffer.allocate(size);
bitmap.copyPixelsToBuffer(byteBuffer);
byte[] byteArray = byteBuffer.array();
os.write(byteArray);
But this gives a blank print and roll keep rolling
I am using Godex-MX30 printer