Greetings to the whole community, in a baxpages app for viewing a PDF, downloaded from one of my sites, I initially used the PDFView class with the following code inserted into a page
It seemed to work perfectly, but when downloading a new PDF, after removing the existing one, it always displayed the first one, if I closed the app and reopened it then it displayed the downloaded one.
So I tried to view it via a WebView as Erel advised me, using the following code.
In this case another problem arises, once viewed and returned to the BaxMainpage via Back, if I try to view it again I resume the page with WebView the PDF cannot be seen but the page numbers of the same are displayed, it is as if a command is missing refresh.
How to solve? I would prefer with WebView, simpler. I apologize for my bad English
Mario
B4X:
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Private Label1 As Label
Private PDFView1 As PDFView
Private hd As HUD
End Sub
Public Sub Initialize As Object
Return Me
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
PDFView1.IsInitialized
Root = Root1
'load the layout to Root
Root.LoadLayout("page2layout")
B4XPages.SetTitle(Me,"My title")
If File.Exists(File.DirDocuments, "namefile.pdf") Then
PDFView1.LoadPDF(File.DirDocuments, "namefile.pdf", "Password")
Else
hd.ToastMessageShow("File non trovato",False)
End If
End Sub
So I tried to view it via a WebView as Erel advised me, using the following code.
B4X:
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Private Label1 As Label
Private hd As HUD
Private WebView1 As WebView
End Sub
Public Sub Initialize As Object
Return Me
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
'load the layout to Root
Root.LoadLayout("page2layout")
B4XPages.SetTitle(Me,"My title")
WebView1.RequestFocus
If File.Exists(File.DirDocuments, "namefile.pdf") Then
WebView1.LoadUrl(xui.FileUri(File.DirDocuments, "namefile.pdf"))
Else
hd.ToastMessageShow("File non trovato",False)
End If
End Sub
How to solve? I would prefer with WebView, simpler. I apologize for my bad English
Mario