Embedding PDFs within rails page

Ichikawa Amin wrote:

     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.


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.