Skip to content

Instantly share code, notes, and snippets.

@michaellouieloria
Created September 18, 2014 08:04
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save michaellouieloria/0ff4376475b68e1e78c2 to your computer and use it in GitHub Desktop.
Save michaellouieloria/0ff4376475b68e1e78c2 to your computer and use it in GitHub Desktop.
PDFtk commands to create fdf and fill form
create fdf
pdftk form.pdf generate_fdf output data.fdf
fill form
pdftk form.pdf fill_form data.fdf output form_with_data.pdf
@jagjitsinghsaini
Copy link

jagjitsinghsaini commented Sep 27, 2019

fill_form working excellent but only one pdf not multiple pdf.
how to solve this

@michaellouieloria
Copy link
Author

michaellouieloria commented Sep 27, 2019

you can probably just loop the command

filenames.each do |filename|
  pdftk form.pdf fill_form data.fdf "#{filename}.pdf"
end

@Ortega-Dan
Copy link

Awesome, just add the "flatten" word at the end of the fill-form command to make it not editable.

Like:

# fill form
pdftk form.pdf fill_form data.fdf output form_with_data.pdf flatten

Thanks for sharing.

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