'pdf.html.erb', :template => 'transactions/show.pdf.erb', :wkhtmltopdf =...">

Wicked_pdf is not a rendering header

render :pdf => "file_name", :layout => 'pdf.html.erb', :template => 'transactions/show.pdf.erb', :wkhtmltopdf => WICKED_PDF_BIN, :show_as_html => true, :layout => 'pdf.html.erb', :header => {:html => { :template => 'shared/header.pdf.erb'}} 

PDF is created perfectly, unfortunately, I do not see the title. I can insert a title into the main layout and it works great. It seems to me that the title bar above is not being processed. The file name header.pdf.erb does not matter. I can point it to a file that does not exist, and it does not cause errors.

This is Mac OS, Rails 3.2.1, ruby ​​1.9

+7
source share
1 answer

You can simply render the template as a string and assign it to the title. Try it:

 header: { content: render_to_string(template: 'header.pdf.haml') } 

This works well for me.

+3
source

All Articles