Android Question Conflict between PdfDocument and PDFium.

zed

Active Member
Licensed User
Hi all,
In my code, I am creating a pdf document. So far so good.
B4X:
Private Sub imgpdf
    'A4 Size
    Dim w As Int = 595
    Dim h As Int = 842
   
    Dim pdf As PdfDocument
    pdf.Initialize
    pdf.StartPage(w, h)
   
    Dim Bitmap1 As Bitmap
    Bitmap1.Initialize(Main.FileDir, Main.FileName)
    Dim SrcRect As Rect
    SrcRect.Initialize(0, 0, Bitmap1.Width, Bitmap1.Height)
    Dim DestRect As Rect
    'Dim left As Double
    'left = w-Bitmap1.Width
    DestRect.Initialize(0, 0, Bitmap1.Width, h)
    pdf.Canvas.DrawBitmap(Bitmap1, SrcRect, DestRect)
    pdf.FinishPage

    Dim out As OutputStream = File.OpenOutput(Main.FileDir, Main.FileName, False)
    pdf.WriteToStream(out)
    out.Close
    pdf.Close
    Dim in As InputStream = File.OpenInput(Main.FileDir, Main.FileName)
    Wait For (FileHandler1.SaveAs(in, "application/pdf", "YourFile.pdf")) Complete (Success As Boolean)
    If Success Then
        toast.Show("File saved successfully")
    Else
        toast.Show("File not saved")
    End If
End Sub

Then I would like to view the created pdf.
I install the PDFium library and -crack!- PDFDocument no longer works.

error.png


LOG:
pdf.Initialize "(" expected
unknown member : close
unknown member : writetostream
unknown member : finishpage
unknown member : canvas
unknown member : startpage

Where is the problem?
Can anyone help me?
 

zed

Active Member
Licensed User
Here is the complete project.
Would you mind testing.
Thank you so much
 

Attachments

  • Scan2pdf.zip
    505.5 KB · Views: 74
Upvote 0

toby

Well-Known Member
Licensed User
Longtime User
Edit Printing.xml and change <shortname>PdfDocument</shortname> to <shortname>PrintPdfDocument</shortname>
 
Upvote 0
Top