Android Question Bitmaps less bulky for printing purposes ?

Discussion in 'Android Questions' started by MitchBu, Jun 4, 2019.

  1. MitchBu

    MitchBu Active Member Licensed User

    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.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can use this (untested) code to create a mutable bitmap with different configuration:
    Code:
    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
     
    José J. Aguilar likes this.
  3. MitchBu

    MitchBu Active Member Licensed User

    Erel, you are the best !

    It works perfectly, and the printer no longer gets into error :)

    Thank you.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice