I created a web app that generates a PDF and displays it on the user’s screen. It has two problems
I added a Download button so the user can retrieve the document and print it. It works fine running in the IDE on my Windows machine, but nothing happens when running on our Linux server. This code is in the Download button action:
Sub Pressed() Handles Pressed
Session.PDFFile = Nil
Session.PDFFile = New WebFile
// PDFPreview is the WebHTMLViewer that displays the PDF. PDFPreview.LoadURL(Session.PDFFile.URL)
PDFPreview.Visible = False
End Sub
Problem 2. After the Download, you cannot generate a new PDF on the screen. The app has not crashed and you can navigate to a different page, but you cannot show a PDF again. This happens with the Windows IDE and the Linux server. The same thing happens with the EE-Web example program in the IDE.
1 do you have all the requiered permisions for the app and the folder where the temp file is created?
2 so… do you have a single FolderItem object to use for all the downloads? Better to use a single one for each download, with a unique name in your disc.
Make sure you have permissions to the temp folder (and may be other folder).
Not sure why you re-assigned the PDFFile twice but here is one that doesn’t do that:
Sub Pressed() Handles Pressed
Session.PDFFile = WebFile.Open(Session.PDFFolderItem) // Setting nil is not needed since only 1 point is held.
Session.PDFFile.MIMEType = "application/pdf"
Session.PDFFile.ForceDownload = False // < set true to download, false to show in browser
Session.PDFFile.Filename = MainPage.ModelNum + ".pdf"
// PDFPreview is the WebHTMLViewer that displays the PDF. PDFPreview.LoadURL(Session.PDFFile.URL)
PDFPreview.Visible = False
End Sub
The code above retains the mimetype since it now is NOT reassigned after setting the mimetype.
The permissions are set to 755. I’ve tried all the suggestions. Wondering if there server is not set up properly to do this. The app is running with a reverse proxy.
The problem was caused because I used the microseconds as the temporary file name as shown in the Eddies-PDF example app then added a different file name in Session.PDFFile.Filename.