Forum: Ruby on Rails Embedding PDFs within rails page

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
80c1860bd22c8e295be401a6c6970396?d=identicon&s=25 Ichikawa Amin (ichikawa)
on 2007-05-24 08:51
     hope, you well.
In my rails page I want to embed a PDF in my page where there are other
dynamic created informations.

I use the following code:
<% path="#{RAILS_ROOT}/manual/test.pdf" %>
<EMBED src="<%= path %>" width="450" height="450"></EMBED>

But it can not open the pdf file.
Why? please take a hand in my code.

34a7615f38496a5dafbb3e6b721c435e?d=identicon&s=25 Mohit Sindhwani (Guest)
on 2007-05-24 09:58
(Received via mailing list)
Ichikawa Amin wrote:
> Why? please take a hand in my code.
> regards.
> Amin
I think for it to be publicly accessible, the file needs to be in the
directory public.  Try copying it to
rails_app_root/public/manual/test.pdf and link to it.  If you require it
to be in a non-public place, you will need to use SendFile to send the
file to the browser.

Hope this helps.
This topic is locked and can not be replied to.