Android Question PDFDocument 3Mb per file

AHilberink

Active Member
Licensed User
Longtime User
Hi,

I am using:
B4X:
    Dim FileName As String = "Geleide"&Formuliernr.Text
    Dim Out As OutputStream = File.OpenOutput(Provider.SharedFolder,FileName&".jpg", False)
    btnMail.Visible=False
    Dim PanelShot As B4XBitmap = ScrollView2D1.Panel.As(B4XView).SnapShot
    PanelShot.WriteToStream(Out, 50, "JPEG")
    Out.Close

    Dim PDF As PdfDocument
    PDF.Initialize
    PDF.StartPage(595, 842) 'A4 size
    Dim DestRec As Rect
    DestRec.Initialize(0,0,595,842)
    PDF.Canvas.DrawBitmap(PanelShot,Null,DestRec)
    PDF.FinishPage
    Dim Out2 As OutputStream = File.OpenOutput(Provider.SharedFolder,FileName&".pdf", False)
    PDF.WriteToStream(Out2)
    Out2.Close
    PDF.Close

The JPG will be 396kb, the PDF will be 2,9Mb.

Resize the PDF to (297,421) did not decrease filesize. Loading the 50% PanelShot file as Bitmap also did not.

Is there a way to decrease filesize of the PDF document?

Kind regards,
André
 
Top