I love the document viewer, but it's very picky about where the URL comes from. Even if I have a PDF servlet running on the same server where the app with the document viewer is running, it complains that I it's unable to load files because of CORS. I solved that by adding a HTTP header on the servlet for Access-Control-Allow-Origin, it's now complaining that it's not permitted to open the file because ??? I have no idea, because the error messages are so terse. All it says is "not permitted to load." Great! That helps. I think it might be because the servlet's URL is http and the main app's URL is https.
So, I've decided to give up and just load PDF files from the operating system. Can somebody supply some code that will allow me to load PDF files dynamically into the document viewer without using anything on the network? It't too difficult to debug otherwise.
Document viewer issues
Yep this example has 3 tabs.
http://primefaces.org/showcase-ext/sect ... /basic.jsf
You want either the Resource example:
Or the streamed content example:
http://primefaces.org/showcase-ext/sect ... /basic.jsf
You want either the Resource example:
Code: Select all
<pe:documentViewer height="500" library="books" name="hood.pdf"/>
Code: Select all
<pe:documentViewer height="500" value="#{basicDocumentViewerController.content}" download="#{basicDocumentViewerController.downloadFileName}"/>
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
Well, isn't the library="books" name="hood.pdf" actually loading a file from the application (war file) rather than the OS?
I need the ability to load files from the OS by supplying a path since the files will be changing all the time. It would be impossible to imbed all these files within the application.
I need the ability to load files from the OS by supplying a path since the files will be changing all the time. It would be impossible to imbed all these files within the application.
The use the resource example then you can load whatever you want from the OS:
Code: Select all
<pe:documentViewer height="500" value="#{basicDocumentViewerController.content}" download="#{basicDocumentViewerController.downloadFileName}"/>
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
-
- Information
-
Who is online
Users browsing this forum: No registered users and 11 guests