0

I need a user to be able edit a pdf template in rails such that a user can customise logo, email signatures, price etc.

I thought prawn looked like a good option but I read that it should now only be used to generate a pdf from scratch.

Any help, suggestions, pointers to tutorials would be really helpful.

Thank you.

2 Answers2

0

The pdf-forms gem can fill out existing pdf files. This has worked well for me for inserting text into a template PDF.

pdftk supports adding images to an existing pdf via multistamp, which is effectively merging two pdfs together (on top of each other). To add an image to an existing pdf, you could use something like prawn to create a pdf with your image, then use pdftk with multistamp to merge that with your filled out pdf:

pdftk filled_out.pdf multistamp logo.pdf output out.pdf

pdf-forms is a thin wrapper on top of pdftk, so it should allow you to pass the multistamp params required. If not, you can add that functionality or shell out to pdftk directly.

Adobe Acrobat Pro is useful for defining your template fields visually in an existing pdf.

Alan Heywood
  • 154
  • 2
  • 10
  • thank you Alan, I appreciate your time on this....looks like I have some work ahead of me...bit new to this and my hope of it being straightforward was a bit naive!...will report back on my progress – WoollyMammoth Apr 08 '15 at 08:44
  • Be aware that pdftk is not supported on newer versions of Linux, such as CentOS/RHEL 7. – Vadim May 20 '16 at 17:16
-1

I am not sure but try your luck with Wicked pdf.

Deepak Mahakale
  • 22,834
  • 10
  • 68
  • 88