How can I open PDF files inside a Mac node-webkit application?

I'm trying to add support for PDFs in my Mac node-webkit app. I tried using "PDF.js" but it requires the use of a web server so this won't help me.

I've already solved this issue for the PC version of the node-webkit app by installing "Adobe Acrobat Reader" and adding the "nppdf32.dll" file inside the plugins folder of the root directory of the PC application.

Now I'm trying to solve this issue for the Mac version. How can I open PDF files inside my Mac node-webkit application?

If you still want to try PDF.js, this is how I have gotten it working.

After downloading all the files, the main ones that do all the work are viewer.html and viewer.js. You can point to viewer.html from anywhere in your node-webkit app by doing something like:

$(".some-pdf").on("click", function(){
   window.location.href = "path-to-pdfjs/viewer.html";
});

To determine which file it opens, there's a variable in view.js.

var DEFAULT_URL = 'pdfs/something.pdf';

Since you're using node-webkit, it won't have any issues accessing the file system.

I made it a little more dynamic, where the link can point to any specific pdf, by doing the following. In any file, the link adds a hash with the file name:

$(".some-pdf").on("click", function(){
   window.location.href = "path-to-pdfjs/viewer.html#specific.pdf";
});

Then in viewer.js:

var DEFAULT_URL = 'pdfs/' + window.location.hash.replace("#", "");

Then it is a bit reusable through your app, if there are multiple pdf files involved.