Open action #85

wants to merge 2 commits into

2 participants


Adds ability to do a openAction on PDF open, and preliminary javaScript support.


Will cause the document to print when it is opened.


Very cool, but I hesitate to pull in something that won't work on all PDF viewers (e.g. Apple Preview and others don't support embedded JS). I have used OpenAction in the past to automatically print a document when it is opened, but I don't really want to include it in PDFKit itself because, once again, not all PDF viewers support OpenAction. In my case, I just made a separate utility function:

autoprint = (doc) -> = doc.ref
        Type: 'Action',
        S: 'Named',
        N: 'Print'

I'll leave this open for others to comment on, but I think it may be better to keep things like this as separate extension libraries. Let me know what you think.


I can see your point -- However, I'm pretty sure that the pdf reader on my kids (old) ereader doesn't have font support and crashes with large images -- but I wouldn't want you to pull the support because some of the pdf readers don't support it. I tend to think it should be included, but I'm not at all opposed to another add-on helper library.

As for your utility function --- If you have library of these types of "utility" functions -- I know I would love to see them; it would have saved me a lot of time trying to understand and figure out the pdf spec and then the adding/testing of OpenAction & JavaScript support to the library. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment