Question

I did some research into the easiest/best way to generate a pdf in my RoR project and decided upon Prawn + Prawnto. I have successfully got Prawnto producing a very basic PDF using the .prawn extension, however I don't know how to display an image as well. Is it possible using a prawnto option?

In the future I would like to generate a random download link for the pdf and include this in an email. I would also like this PDF to be always accessible and not have this link be destroyed.

With this in mind is Prawnto the best option as the documentation seems to have dried up, but it still seems to be highly recommended. Is it still the best option? I am using Rails 3.2.

Any help, advice or guidance on this matter is more than welcome

Thank you.

Was it helpful?

Solution

You can add an image to a pdf generated by prawn using the following code:

image "/path/to/image/file.jpg"

inside your PDF generation routine.

There are ton of options for positioning, scaling and working with images in prawn. Id recommend that you check out the Prawn manual

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top