PDF View Package


#1

For the past month or so I have been working on a contribution to script, and have been starting to think about an idea I might turn into a package to continue learning more about hacking Atom.

One thing that came up today was that Atom can’t view a pdf file (well it can, but its gibberish).

I wanted to see if it seems realistic to make a package with the simple feature that opens pdf files in a viewer instead of its source. Based on a prior post, it seems like the best bet would be to use Mozilla’s pdf.js.

Thoughts/ideas/feedback/suggestions that I can use before I start?


#2

I attempted this for my pandoc extension. There’s a few issues you’d face:

  • node-webkit/chromium doesn’t have a PDF viewer, unlike Chrome
  • Even if there were a viewer, you can’t use <iframe src="my.pdf" /> because of the limitations of the file:// scheme
  • You can use pdf.js – I spiked this and it worked – but you have to read the file from disk and serve it with data-src; this has it’s own limitations too.

Basically, unless you can get pdf.js to work this is going to be tricky without Atom’s node-webkit being compiled with a PDF viewer.

My previous thread


#3

I was gonna give a go at pdf.js. I played around a little bit with it the other day. Probably won’t get a chance to give a whack at it for a a couple days though


#4

I was playing with this over the weekend, and made a simple package for viewing PDF files:

It’s based on PDF.js and currently supports only viewing PDF files (no advanced controls, no text selection, etc). It’s still pretty handy, if I do say so myself :smile:

Contributions welcome! :family:


PDF plugin support