I have mounted a folder from my server file system as a WebDev resource in order to use the files inside for Perspective app development. The PDF files display perfectly fine in the designer but when I try to access on a client device it just displays the “Failed to Load PDF File” error message. I am using the Perspective PDF Viewer component and have everything working very well on the server-side (with buttons to change pages and a numerical field to specify desired page number to display) but in the app itself (testing on my phone) I get nothing. I feel like there is just something small that I have overlooked but I have tried several steps to resolve it and have come up with no solution. Any help would be greatly appreciated!
Is there any chance your trial has expired for the WebDev module? If your license doesn’t cover WebDev, the Designer will still work, but the session will result in no report being displayed. Also verify the project has been saved; the Designer might have immediate insight into the files, but sessions will not until the changes have been saved.
More information to add… when I check the perspective session log I get the following error: “Could not find project ‘pdf.worker.js’. Verify url is correct and project is published.”
Is there more that needs to be done for the file to be accessible on client devices than just mapping the file WebDev module and pointing the PDF Viewer to the correct source?
Thank you all for help! Unfortunately I cannot just export the project and share it as I am working on proving out a concept for my company.
Could you provide a screenshot of the Report Viewer in the session, and a screenshot of the logging you’re seeing (more data is almost always helpful)? It would also help to see the file within the Project browser panel and the source value being supplied to the Report Viewer. You’re sort of asking why it isn’t working without providing any of the pieces we need to see to diagnose the issue.
The screenshot below is from my Designer session in preview mode. The file is successfully loading from the source (WebDev Mounted Folder). The URL is http://localhost:8088… and as you can see it is functioning perfectly well here.
The screenshot below is from my mobile device and shows the error message indicating the PDF file failed to load. Everything else is working fine. It is just as if something is preventing the file from actually being served to the client from the gateway server.
In your designer, you’re specifying a url for the .pdf of http://localhost:8088. This will not work for any machine which does not contain the Gateway. it looks like you might not need to supply the full url of the file. you should be able to just bind the source of the Report Viewer to the file path and file name within WebDev. If you right-click the resource you want to use and select “Copy Path”, you should be able to paste that into the source of the Report Viewer and it should work.
NEVER refer to any file within your project with localhost.
I tried the methods you recommended and it just made it so that the PDF file would not load in designer on the gateway server, or the client. Per the instructions at https://docs.inductiveautomation.com/display/DOC80/Perspective+-+PDF+Viewer the PDF viewer needs a URL, NOT a file path. The files it views must be served by a web server, in this case I am using the WebDev module to serve these files. Wouldn’t localhost be appropriate since the gateway server has these files on it and I want it to serve them regardless of changes to IP address? I’m not sure if I am correct on this assumption but since the server is serving the client session and the file is available and working on the server using localhost, what would prevent the server from serving that file to the client’s IP address?
OH! I’m terribly sorry, I mixed up the Report Viewer with the PDF Viewer. Yes, you do need a full url, and so you should replace the http://localhost:8088 portion of the source you’re providing with a binding against the Gateway’s IP.
That worked! Thank you so much! I believe what was throwing me off is that when I use the IP address of the gateway explicitly, I can not longer view the PDF on the gateway itself even in preview mode (unless there is a fix for that)! It now works fine on the client devices which is what is needed anyway so I am good to go, although previewing would be nice. I suppose if I want to preview I can always change back to localhost, though.