Use PDF.js Offline
Can PDF.js be used without a website on the internet? I am trying to make a simple standalone website that reads pdf using pdf.js, but it won't work without being online.
Can anyone please help?
Yes, you can use it offline. Download the latest version here .
Now extract the zip file and put it on the server (use xampp / wamp / lamp or any other localhost) because worker is not enabled for file: // urls.
To show PDF files go to web / viewer.html from localhost and it should load its default file.
Regarding the question of how to show its use in pdf format, viewer.html?file=relative/path/to/your/pdf
Let's say for example inside the web folder (the one that the viewer.html is in) of your pdf.js you create a directory named pdfFiles
and in that you add the pdf say to it mypdf.pdf
, then use: to viewer.html?file=pdfFiles/mypdf.pdf
display it and it will display his.
Look here for more details on how to dynamically assign PDF file paths to the viewer. If you have any other questions, let me know. I have used pdf.js offline and it works great in almost all browsers I know.