相关疑难解决方法(0)

邪恶的pdf没有渲染页眉/页脚

我正在使用wicked_pdfpdfhtml我的rails项目生成.它正在渲染,template但我无法打印header/footer部分.下面是我的代码,只打印template部分

render pdf: "pdf_name",
               layout: 'application',
               template: 'reports/show',
               formats: [:html],
               margin: { top: 10, bottom: 10, left: 10, right: 10 },
               disable_javascript: true,
               show_as_html: params[:debug],
               header: {
                 html: { template: 'shared/header' },
                 spacing: 10
               },
               footer: {
                 html: { template: 'shared/footer' },
                 spacing: 30,
                 line: true
               }
Run Code Online (Sandbox Code Playgroud)

如果我尝试使用WickedPdf.new.pdf_from_string render_to_string它显示Failed to load PDF document错误甚至简单WickedPdf.new.pdf_from_string('<html><body><h1>Hello There!</h1></body></html>')不起作用.

我试过用render_to_string_with_wicked_pdf, render_with_wicked_pdf但没有成功.我的Rails版本是3.2.19,wicked_pdf宝石版本1.1.0 …

html pdf-generation wkhtmltopdf ruby-on-rails-3 wicked-pdf

5
推荐指数
1
解决办法
1815
查看次数