I am attempting to create a javascript pdf reader that can work offline in the browser (it uses the browser but not the internet), and am using Mozilla's pdf.js to do it. Pdf.js has a main file of the same name, which uses the internet to inject script from a pdf.worker.js file. One obstacle to creating an offline version of pdf.js is to stop it from using the internet to do this, by either pasting the pdf.worker.js code into the parts of pdf.js code that ask for it, or to convert the pdf.worker.js into a Data URI and use that as the url that pdf.js asks for. Doing the former has not yielded any success, and doing the latter has only worked on Firefox. We want this to work any way we can make it work, so I have pretty much two questions pertaining to making pdf.js offline.
1) If I am going with the method of physically pasting pdf.worker.js code into the spots where pdf.js uses the internet to inject pdf.worker code in, how would I make it work? I tried doing it, and I couldn't get it to work. Are there any things I must pay attention to?
2) I have had more success with converting pdf.worker.js into a Data URI and having pdf.js use that instead of the url it was using to access worker.js. However, this process only works on Firefox. Any idea why? And, do you know of a way I can make this process work with the other browsers?
Any input is welcome. Thanks in advance!
node make singlefile
Worked for me on Windows. Should work on other platforms too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With