= pdf_filler The pdf_filler Rails plugin makes it easy to update existing PDFs that have form fields defined. Rather then building PDFs in Ruby using something like PDF-Writer, it is much easier to create a PDF in Acrobat, define fields, and update those fields using pdf_filler. An example would be a First/Last name field on a PDF that is possible to update. == Requirements This plugin requires RJB (Ruby Java Bridge), so you will need to set your JAVA_HOME environment variable to point your installation of Java. If your JAVA_HOME environment variable is not setup correctly you will get something like: Building native extensions. This could take a while... ERROR: Error installing pdf_filler-0.1.0.gem: ERROR: Failed to build gem native extension. /opt/local/bin/ruby extconf.rb *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/opt/local/bin/ruby extconf.rb:45: JAVA_HOME is not set. (RuntimeError) Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/rjb-1.1.7 for inspection. Results logged to /opt/local/lib/ruby/gems/1.8/gems/rjb-1.1.7/ext/gem_make.out On my Mac I set JAVA_HOME to be "/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home". == Installing The recommended method to enable pdf_filler in your project is adding the pdf_filler gem to your environment. Add the following code to your Rails configuration in config/environment.rb: Rails::Initializer.run do |config| ... config.gem 'gbdev-pdf_filler', :lib => 'pdf_filler', source => 'http://gems.github.com/' end Run sudo rake gems:install to install the gem. Another alternative is to install pdf_filler as a Rails plugin: script/plugin install git://github.com/gbdev/pdf_filler.git == Usage 1. You will need a PDF that has form fields to fill. 2. A hash of parameters for filling the PDF form. The hash must contain all of the required options: * :data (required) - A hash or array of hashes of fields to fill the pdf template with. Example: [{:field => 'value'}, {:field => 'value'}]. * :template (required) - The full path to the PDF form to fill. * :dir (required) - The directory to write filled form to. * :file_name (optional) The name of the output file to create. If not specified a random file name will be used. 3. Example opts = {:data => {:full_name => 'Wes Hays'}, :template => '/path/to/templates/certificate_template.pdf'), :dir => '/path/to/templates/output/'), :file_name => 'wes_hays.pdf'} PdfFiller(opts) == License This plugin is released under the MIT license. Please contact weshays (http://github.com/weshays) or djohnson (http://github.com/djohnson) for any questions.