Dim ImageView2 As ImageView
Dim PDFWriter1 As PDFWriter
Dim PaperSize As PDFPaperSizes
Dim bm As Bitmap
Dim Hi As Int
bm.Initialize(File.DirDefaultExternal & "/SQLite/Fuhrbericht", "baustelleneu.result" & ".jpg")
Hi = bm.Height
If Hi>PaperSize.A4_HEIGHT Then
' out of page
' Resize image as fit to page
Dim R As Float
R=PaperSize.A4_HEIGHT/bm.Height
bm=CreateScaledBitmap(bm,bm.Width*R,bm.Height*R)
End If
ImageView2.SetBackgroundImage(bm)
PDFWriter1.addImage(50,PaperSize.A4_HEIGHT-Hi, bm)
End Sub
Sub CreateScaledBitmap(Original As Bitmap, Width As Int, Height As Int) As Bitmap
Dim r As Reflector
Dim b As Bitmap
Dim filter As Boolean: filter=True
b = r.RunStaticMethod("android.graphics.Bitmap", "createScaledBitmap", _
Array As Object(Original, Width, Height, filter), _
Array As String("android.graphics.Bitmap", "java.lang.int", "java.lang.int", "java.lang.boolean"))
Return b
End Sub