I have a problem with header and footer options when i try a render_to_string_with_wicked_pdf.
def generate_voucher
@order = Order.find(params[:id])
unless @order.blank?
pdf = render_to_string_with_wicked_pdf({:pdf => 'generate_voucher.html.erb',
:layout => 'voucher.html',
开发者_StackOverflow社区 :save_only => true,
:header => { :html => { :template => 'shared/voucher_header.pdf.erb'}}
})
# :layout => 'voucher.html',
# :show_as_html => params[:debug].present?,
# :orientation => 'Landscape',
# :no_background => true)
@order.save_pdf(pdf)
redirect_to :action => "foo", :id => order.id
end
end
If I render without header or footer option works. However when I try to use these options throws this exception:
***************WICKED***************
Rendering template within layouts/voucher
Rendering store/generate_voucher
Rendered shared/_voucher_footer (0.0ms)
Rendering template within layouts/voucher
Rendering shared/voucher_header.pdf.erb
***************WICKED***************
Rendering template within layouts/voucher
Rendering store/generate_voucher
Rendered shared/_voucher_footer (0.0ms)
Rendering template within layouts/voucher
Rendering shared/voucher_header.pdf.erb
I create in shared a partial view called header.pdf.erb and footer.pdf.erb.
Which could be the problem?
Also when i try to use this plugin on unix system the pdf generated throw a error format message.
Thanks in advance
When I had the same problem I discovered that I had the wkhtmltopdf version 0.9.9
. By upgrading it to 0.11.0 rc1
the problem was fixed.
精彩评论