Android Question [SOLVED] Bitmap not show correct in PDF

makis_best

Well-Known Member
Licensed User
Longtime User
Hi

I create a pdf file in my application and I test the output in two different tablets.
The one has Android 10 and the other one has Android 7.
The tablet with Android 10 show the picture correct but the android 7 show the image smaller
Why that happening?

The code I use:
B4X:
            Dim pdf As PdfDocument
            pdf.Initialize
            pdf.StartPage(595, 400)
            Dim Bitmap1 As Bitmap
            Bitmap1.Initialize(File.DirAssets, "Pic1.jpg")
            Dim DestRect As Rect
            DestRect.Initialize(1dip, 1dip, 397dip, 265dip)
            pdf.Canvas.DrawBitmap(Bitmap1, Null, DestRect)
            Activity.Invalidate
            pdf.FinishPage
            Dim out As OutputStream = File.OpenOutput(Starter.SafeFolder, "ADCode.pdf", False)
            pdf.WriteToStream(out)
            out.Close
            pdf.Close

On Pic1 you can see that pdf created with empty space around picture and this is happening with the tablet with Android 7.



But on Pic2 you can see there are no empty space on page and picture fit perfect on page this is happening on the tablet with Android 10.


Any idea why happening?
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…