gem install prawn-js
Start by requiring the prawn library, then the prawn-js library. Build your PDF as usual, and use methods like add_docopen_js to register your code fragments.
For further examples and documentation, check out the examples/ directory of this project and the code docs for the Prawn::JS module.
I haven't yet found a situation where I've wanted to embed JS in my documents. Most viewers ignore it and few users demand it.
This extension was more or less thrown together as a proof of concept. I'm happy to review any patches that are submitted, but I not planning to actively develop it. I'm releasing it because the code was getting lonely sitting on my laptop. if there's one thing I hate it's lonely code.
This library is distributed under the terms of the MIT License. See the included file for more detail.
All suggestions and patches welcome, preferably via a git repository I can pull from.
- The source: http://github.com/yob/prawn-js/tree/master
- Prawn source: http://github.com/sandal/prawn/tree/master
- Rubyforge: http://rubyforge.org/projects/prawn