user1063287
user1063287

Reputation: 10889

how to implement pdf.js to view pdf files in the pdf viewer?

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.

Upvotes: 0

Views: 9282

Answers (2)

Asad Malik
Asad Malik

Reputation: 794

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.

Upvotes: 1

SILENT
SILENT

Reputation: 4278

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.

Upvotes: 0

Related Questions