I have a couple of PDF template files with complex content and several blank regions/areas in them. I need to be able to write text in those blank regions and save the resul
Since Prawn has removed the template feature (it was full of bugs) the easiest way I've found is the following:
Rough Example:
require 'prawn'
require 'pdf/toolkit'
template_filename = 'some/dir/Awesome-Graphics.pdf'
prawn_filename = 'temp.pdf'
output_filename = 'output.pdf'
Prawn::Document.generate(prawn_filename) do
# Generate whatever you want here.
text_box "This is some new text!", :at => [100, 300]
end
PDF::Toolkit.pdftk(prawn_filename, "background", template_filename, "output", output_filename)