4
votes

Im creating a PDF Document on my Website. All works just fine, but when i try to add a Image into the PDF i get "We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly."

So something fails with Prawn.

This is how i try "image 'logo.png" i tryed so many ways, all found in the internet, nothing seemed to work. One was with the BASEDIR, how do i know where BASEDIR is?

Anyway im using OSX Server 10.6 and id be very thankfull to anwser me those questions

-Where is the Prawn Logfile? -How does one add a Image

Thanks very much, Greetings!

1

1 Answers

3
votes

You'll need to refer to the full path to the file.

We usually refer to our images used in PDFs using the RAILS_ROOT as the starting point. So we use something like:

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

Assuming pdf is a Prawn::Document object.