iOS Question display pdf with canvas

Claude Brun

Active Member
Licensed User
Longtime User
Hi,

I want to display pdf file on my app. I use this code
B4X:
Sub btn_vuerecet_Click
    Dim pdf As PDFDocument
    Dim wRecet As recette
    Dim nf As String
    If SelectedRow = -1 Then
        Msgbox("Vous devez selectionner une recette","Lucullus")
    Else
        wRecet = lisRecet.Get(SelectedRow)
        nf = "luc_" & wRecet.nom & ".pdf"
        nf = nf.Replace(" ", "_")
        pdf.Initialize(File.DirDocuments, nf)
        pnl_pdf.Visible = True
        pnl_btnrecet.UserInteractionEnabled = False
        cvs.Initialize(scrolpdf.Panel)
        cvs.DrawPDF(pdf, 1, cvs.TargetRect)
        cvs.Refresh
    End If
End Sub

the firs time is ok. but if i display a new time, the old pdf is not clear.
how can i clear before display a new pdf.

I find this post
https://www.b4x.com/android/forum/threads/canvas.80959/#post-513018

but i have thi error
Expected: B4IPanelView, object type: _UIScrollViewScrollIndicator

Can you help me

Thank a lot
 

Semen Matusovskiy

Well-Known Member
Licensed User
I draw so.

1) cvs.Initialize (...)
2) cvs.DrawColor (..)
For example, Colors.Transparent or Colors.White.
3) drawing as it is
4) cvs.Refresh and cvs.Release
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
I have no idea what does Release. No error is already good :)

Well, a sample is attached. Tested in IOS 14.5 simulator only. Each click shows next page (in cycle).
 

Attachments

  • s31.zip
    244.3 KB · Views: 213
Upvote 1
Top