Hi there,
I’m trying to print a bitmap on the receipt, using the iPoyntReceiptPrintingService
. When I build the PrintedReceipt
, I set the footer image as a QRCode. This QRCode comes as Base64 encoded PNG of 186x186px from our backend, then I build it as follows:
private static Bitmap decodeBase64(String input) {
byte[] decodedBytes = Base64.decode(input, 0);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inDither = false;
options.inScaled = false;
return BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.length);
}
Then I scale the bitmap up:
private static Bitmap generateQRCodeBitmap(SaleResponse sale) {
Bitmap baseQrcode = decodeBase64(sale.getInvoice().getBase64Qrcode());
float scale = 2;
Matrix matrix = new Matrix();
matrix.setScale(scale, scale);
return Bitmap.createBitmap(baseQrcode, 0, 0, baseQrcode.getWidth(), baseQrcode.getHeight(), matrix, false);
}
When I try to print, I got this result:
I understand that this can be caused by thermal printing, it would be solved if I scale the bitmap up, probably (this was my initial intention on scaling it). But when I try to set scale
variable to bigger values, it keeps the size in about 25x25mm.
Is there any limit to bitmaps?
Is there some “right” way to do this?
Thanks!