I have looked around on the internet, but do not seem able to find how to display a PDF in rails (I can only find info on how to create one).
Does anyone know what code/gem I need to display one?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In your controller:
In
config/environment/production.rb:or
The config modification is required because it enables the web server to send the file directly from the disk, which gives a nice performance boost.
Update
If you want to display it instead of downloading it, use the
:dispositionoption ofsend_file:If you want to display it inline, this question will be much more complete that I could ever be.