pcasa
pcasa

Reputation: 3730

how to populate PDF webform with attributes

Have several pdf webforms that I would like to auto-populate with information from my model.

Here's a sample pdf http://www.flhsmv.gov/dmv/forms/BTR/Milpak/82040.pdf

Is there a gem or plugin that could help?

Upvotes: 3

Views: 919

Answers (3)

cchantep
cchantep

Reputation: 9168

I don't know Ruby lib that would allow to write extra element on existing PDF.

Some Web service are able to, like Applidok PDF merge, which allow to write user data (e.g. from a Web form) on existing PDF, used as template.

You can read online doc for Ruby integration at http://doc.applidok.com/merge-ruby.html .

Upvotes: 0

Hoa
Hoa

Reputation: 3207

There are a couple of plugins for creating PDF documents in Rails. Please see here.

Upvotes: 0

Arnaud Meuret
Arnaud Meuret

Reputation: 984

If you have a sizable amount of form models or have to process many form submissions, you should use the FDF (Form Data Format) format. It is part of the PDF Standard.

Adobe offers the free FDF Toolkit that will help you generate the FDF files. It does not contain Ruby bindings but there are several ways to do it (by order of convenience, depending on your needs):

  • Wrap the Adobe Linux DLLs (in the FDF Toolkit) using FFI for Ruby
  • Call the library from a C extension using the C Ruby API (introductions here and here)
  • Call the library using ruby-inline
  • Call an external tool based on the sample CGI code
  • Ask a freelance developer to code the Ruby bindings for you (could be free if you ask nicely)

NOTE: The Ruby C API has changed significantly since version 1.9.x

Upvotes: 2

Related Questions