Ruby on Rails & Prawn PDF

I am creating a pdf document on my website. Everything works fine, but when I try to add the image to PDF, I get "We're sorry, but something went wrong. We have been notified of this problem and we will review it shortly.

So something does not work with shrimp.

This is how I try to "image" logo.png "I tried so many ways, everything that can be found on the Internet, nothing worked. One of them was with BASEDIR, how do I know where BASEDIR is?

In any case, im, using OSX Server 10.6 and id, is very grateful to me for these questions.

-Where is the shrimp log file? -How to add an image

Thanks a lot, hello!

+4
source share
1 answer

You will need to refer to the full path to the file.

We usually refer to our images used in PDF files, using RAILS_ROOT as a starting point. Therefore, we use something like:

pdf.image "#{RAILS_ROOT}/public/images/logo-header.png" 

Assuming PDF is a Prawn :: Document object.

+3
source

All Articles