Hi,
I have stored a pdf file as BLOB in the database. How can I
display it inline (:disposition => ‘inline’) by clicking on
a link in a view?
Thanks,
Ram.
Hi,
I have stored a pdf file as BLOB in the database. How can I
display it inline (:disposition => ‘inline’) by clicking on
a link in a view?
Thanks,
Ram.
Just pass the ID of that row where you stored that pdf
<%= url_for(:action => ‘index’, :id => @pdf.id) %>
Ram wrote:
Hi,
I have stored a pdf file as BLOB in the database. How can I
display it inline (:disposition => ‘inline’) by clicking on
a link in a view?Thanks,
Ram.
#controller
def pdf
@doc = MyDocument.find(params[:id])
send_data @doc.pdf,
:disposition => “inline”,
:type => “application/pdf”
end
#view
<%= link_to “PDF”, :action => “pdf”, :id => @doc %>
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs