MitchBu Well-Known Member Licensed User Longtime User Jun 4, 2019 #1 I am still struggling with printing. PDF printing creates random errors, so I am exploring bitmap printing. But to get to 300 dpi requires a picture 2550x3300 for a letter size printing. As a result, the resulting default bitmap format chokes the printer. Would it be possible to use a less memory hungry format, as described here: https://developer.android.com/reference/android/graphics/Bitmap.Config It would seem RGB_565 could be the solution.
I am still struggling with printing. PDF printing creates random errors, so I am exploring bitmap printing. But to get to 300 dpi requires a picture 2550x3300 for a letter size printing. As a result, the resulting default bitmap format chokes the printer. Would it be possible to use a less memory hungry format, as described here: https://developer.android.com/reference/android/graphics/Bitmap.Config It would seem RGB_565 could be the solution.
Erel B4X founder Staff member Licensed User Longtime User Jun 5, 2019 #2 You can use this (untested) code to create a mutable bitmap with different configuration: Code: Copy Sub Create565Bitmap(Width As Int, Height As Int) As Bitmap Dim jo As JavaObject Return jo.InitializeStatic("android.graphics.Bitmap").RunMethod("createBitmap", Array(Width, Height, "RGB_565")) End Sub Upvote 0
You can use this (untested) code to create a mutable bitmap with different configuration: Code: Copy Sub Create565Bitmap(Width As Int, Height As Int) As Bitmap Dim jo As JavaObject Return jo.InitializeStatic("android.graphics.Bitmap").RunMethod("createBitmap", Array(Width, Height, "RGB_565")) End Sub
MitchBu Well-Known Member Licensed User Longtime User Jun 5, 2019 #3 Erel, you are the best ! It works perfectly, and the printer no longer gets into error Thank you. Upvote 0