Hi all,
I'm including a PDF "instructions" file as an asset in my application that will be opened by the user when they touch on a button on the app login screen.
The PDF was created with Word 2013, which I resaved from the Windows 10 PDF Viewer to make sure the PDF was in the correct format - incase that was an issue. So the PDF can be opened and viewed from Windows 10, no problem.
I can also open the PDF on the Nexus 7 tablet, finding the file with File Manager.
The code (which I found with a search on the forum) errors with "pdf cannot be opened".
Could someone please check the code out to see what causes the error? I cannot resolve it.
The button code is as follows:
Thanx,
Mark S.
I'm including a PDF "instructions" file as an asset in my application that will be opened by the user when they touch on a button on the app login screen.
The PDF was created with Word 2013, which I resaved from the Windows 10 PDF Viewer to make sure the PDF was in the correct format - incase that was an issue. So the PDF can be opened and viewed from Windows 10, no problem.
I can also open the PDF on the Nexus 7 tablet, finding the file with File Manager.
The code (which I found with a search on the forum) errors with "pdf cannot be opened".
Could someone please check the code out to see what causes the error? I cannot resolve it.
The button code is as follows:
B4X:
Sub btnHelp_Click
Dim I1 As Intent
'a folder created by the app, where the .sqlite db is also stored.
Dim DBFolder As String = "sdcard/data/invscan/db"
Dim PDF_Filename As String = "invscanhelp.pdf"
Dim FullFilename As String = File.Combine(DBFolder, PDF_Filename)
'Log(FullFilename)
'copy Assets PDF file to DBFolder
If File.Exists(File.DirAssets,PDF_Filename) = True Then
If File.Exists(DBFolder,PDF_Filename) = False Then
File.Copy(File.DirAssets,PDF_Filename,DBFolder,PDF_Filename)
End If
End If
If File.Exists(DBFolder,PDF_Filename) = True Then
I1.Initialize(I1.ACTION_VIEW, "file://" & FullFilename)
'I1.Initialize(I1.ACTION_VIEW, File.Combine(DBFolder & "/", PDF_Filename))
I1.SetComponent("android/com.android.internal.app.ResolverActivity")
I1.SetType("application/pdf")
I1.WrapAsIntentChooser("Choose PDF Viewer")
StartActivity(I1)
Else
ToastMessageShow("Unable to find PDF (" & FullFilename & ")",False)
End If
End Sub
Thanx,
Mark S.