# Embedding PDFs within rails page

**URL:** <https://www.ruby-forum.com/t/embedding-pdfs-within-rails-page/104951>\
**Category:** Rails\
**Created:** [May 24, 2007, 8:51am UTC](https://www.ruby-forum.com/t/embedding-pdfs-within-rails-page/104951 "2007-05-24T08:51:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ichikawa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/96bed5/32.png) [@ichikawa](https://www.ruby-forum.com/u/ichikawa)\
**Post date:** [May 24, 2007, 8:51am UTC](https://www.ruby-forum.com/t/embedding-pdfs-within-rails-page/104951/1 "2007-05-24T08:51:22Z")

</div>

guys,  
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" %\>

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

Amin

---

<div class="post-metadata">

**Author:** ![ichikawa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/96bed5/32.png) [@ichikawa](https://www.ruby-forum.com/u/ichikawa)\
**Post date:** [May 24, 2007, 9:58am UTC](https://www.ruby-forum.com/t/embedding-pdfs-within-rails-page/104951/2 "2007-05-24T09:58:24Z")

</div>

Ichikawa A. 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.  
mohit.
