Fill out PDF forms programmatically?

Is there a way, with PDF::Writer or somesuch, to fill out PDF fillable
forms programmatically?

An example form might be: http://www.irs.gov/pub/irs-pdf/f1040.pdf

i use pdftk: PDFtk - The PDF Toolkit

you have to create a fdf file with the fieldname/value pair, then use
pdftk to merge it with a pdf.
for more details look at
http://wiki.rubyonrails.org/rails/pages/HowtoGeneratePDFs
at the last section: PDF Form Fill