iOS Question view a pdfV

toro1950

Active Member
Licensed User
Greetings to the whole community, I just developed a couple of Android baxpages apps, now I need to convert them for iOS. This app must download a pdf from my site, released by one of my programs, once downloaded it must delete it and then view it. I managed to complete the first two steps, download and removal using the same code for Android
B4X:
Sub Button2_Click
    fl = EditText1.text & ".pdf"
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download("https://www.mysito.it/myfolder/" & fl)
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        If File.Exists(File.DirDocuments, "mypdf.pdf") Then
            File.Delete(File.DirDocuments, "mypdf.pdf")
        End If
        Dim out As OutputStream
         out = File.OpenOutput(File.DirDocuments, "mypdf.pdf",False)
        
        File.Copy2(J.GetInputStream,out)
        out.close
        hd.ToastMessageShow("downloaded file",True)
        remove
    
    Else
        hd.ToastMessageShow("file not found",True)
            End If
    j.Release
               
End Sub


Sub remove
    fl = EditText1.text & ".pdf"
    ftp.Initialize("ftp", "ftp.mysito.it", 21, "addresses", "password")
    Dim sf As Object = ftp.DeleteFile("mysito.it/myfolder/" & fl)
    Wait For (sf) ftp_DeleteCompleted(ServerPath As String, Success As Boolean)
    If Success Then
        hd.ToastMessageShow ("deleted file",True)
    Else
        Label1.Text= LastException.Message
    End If
    'ftp.Close
End Sub

using the same code for Android to view the PDF is not recognised,
I searched the forum and didn't find a valid answer, can anyone help me?
Mario
 

toro1950

Active Member
Licensed User
I tried the class Andrew suggested and it works great, Thanks Andrew. When I have some time I will also try the solution that Erel suggested to me, for the moment I use the class PDFView
 
Upvote 0
Top