I am attempting to load a PDF into the Perspective PDF Viewer component using the webdev module. I watched this video first to understand the process:
The path I am linking to is C:\PDF\test.pdf
I right click on the resource test.pdf --> select copy path --> and paste the path into the source of the PDF viewer.
And I get the following error. Any ideas what I am doing wrong?
The actual path you need is longer - try /system/webdev/$yourProjectName/test.pdf
.
No luck.
I am also trying path(s) in the Vision PDF Viewer as well and get the following error in the output console:
12:21:23.023 [AWT-EventQueue-0] WARN r.VisionComponents.PDFViewer - Unable to open URL '/system/webdev/ProjectName/test.pdf'
java.net.MalformedURLException: no protocol: /system/webdev/ProjectName/test.pdf
Not sure if relevant or not.
In Vision you're going to have to use a fully qualified URL, as in http://localhost:8088/system/webdev/$projectName/test.pdf
- you can use system.util.getGatewayAddress
to make it less fragile.
Does the URL work in a web browser? There should be an option on the webdev node to 'Copy Mounted Path' in the right click menu, as well.
The 'mounted path' returns
/system/webdev/ProjectName/test.pdf
Which still fails in the Perspective PDF viewer.
The fully qualified path
http://localhost:8088/system/webdev/ProjectName/test.pdf
Does work in the Vision PDF viewer and also through the web.
So that narrows my problem down to the Perspective PDF Viewer.
Open the view with the PDF viewer in a regular browser session and look at the dev tools - specifically check the console for errors and look at the network logs to see the full request path.
I went to load a view with the PDF viewer in a regular browser and it loaded just fine. I then closed the view in the designer and re opened it and it loaded fine there as well.
So my first problem was definitely not using the full path but also appears my designer view didn't get the memo to preview it for me right away.
1 Like