My controller:
def show
respond_to do |format|
format.pdf do
render :pdf => "show",:template => "welcome/show.pdf.erb", :header => {:content => ActionController::Base.new().render_to_string({:template => 'welcome/pdf_header.html.erb', :layout => false})}, :footer=> { :right => 'Page [page] of [topage]' },:margin => { :top => 38, :bottom => 35}
end
end
end
I get the PDF along with the page numbers, but I cannot get the image title.
This is the layout:
pdf_header.html.erb
<%= image_tag "gla/image.jpg" ,:width => "90", :height=>"85" %>
<%#= wicked_pdf_image_tag "gla/image.jpg" %>
As soon as I open pdf_header as an HTML file, I get an image, but as soon as I call the PDF, I can’t display the image
In console I get this
Started GET "/welcome/show.pdf" for 127.0.0.1 at 2014-04-17 09:47:05 +0530
Processing by WelcomeController#show as PDF
Rendered welcome/pdf_header.html.erb (0.4ms)
***************WICKED***************
Rendered welcome/show.pdf.erb (0.7ms)
Rendered text template (0.0ms)
Sent data show.pdf (1.8ms)
Completed 200 OK in 782ms (Views: 1.3ms | ActiveRecord: 0.0ms)
The commented material is what I tried and did not succeed.
Is there any other way to display the image directly in the header by specifying the image path instead of passing it through html?
source
share