问题
i want to open pdf files that are linked to in a document in a new page in the pdf.js viewer.
i have downloaded the zip file from github:
https://github.com/mozilla/pdf.js
and gone to both of the index.html files in the examples folder.
i get blank pages when opening either of these files.
can anyone please tell me how to implement pdf.js so that i can open pdf documents in a new page in the pdf viewer?
thank you.
回答1:
Try using '?file=url' in query-string with viewer.html.
For example: www.example.com/pdf-js/web/viewer.html?File="URL"
Source: pdf-js on github
And yes, you will most definitely have cross-domain issues if not using any web-server, as mentioned by @Silent.
Cheers.
回答2:
Let me guess that you tried to directly open the examples via chrome. Your url probably starts off with file:///. This is causing a cross origin request error to occur on your browser. To properly view the examples, you need a LAMP stack.
来源:https://stackoverflow.com/questions/14917749/how-to-implement-pdf-js-to-view-pdf-files-in-the-pdf-viewer