Rails 大虾pdf gem 需要建议
Rails Prawn Pdf gem suggestions needed
我一直在我的应用程序中使用 wkhtmltoppdf 来生成 pdf's.Since 现在我发现它不支持超过 1000 页的文件。我有兴趣尝试 prawn pdf,因为它似乎比其他 gems 更快。
谁能告诉我,反正我们有大虾gem把html转成pdf?
如果不像 pdfkit 和 wkhtmltopdf 做的那样,那么任何调试 prawn 生成的 pdf 样式的方法就像我们有 wkhtmltopdf?
的方法一样
Could anyone tell, anyway we have in prawn gem to convert html to pdf?
Prawn is not a html to pdf generator, they point this at official site http://prawnpdf.org/api-docs/2.0/
"One thing Prawn is not, and will never be, is an HTML to PDF
generator. For those needs, consider looking into FlyingSaucer via
JRuby, or one of the webkit based tools, like Wicked or PDFKit. We do
have basic support for inline styling but it is limited to a very
small subset of functionality and is not suitable for rendering rich
HTML documents."
If not like pdfkit andd wkhtmltopdf do, then any way to debug pdf
generated by prawn for styling like we have way for wkhtmltopdf?
要调试 Prawn 生成的 pdf,我认为最简单的方法是生成一个新的 pdf 或让您的控制器响应您的 pdf:
Prawn::Document.generate("path/to/pdf/example.pdf") do
pdf.text "Hello"
end
管理员回复 pdf:
format.pdf do
pdf = PdfGenerator.new(@invoice)
send_data pdf.render,
filename: "pdf_test",
type: 'application/pdf',
disposition: 'inline'
end
每次进行更改时都会刷新您的页面。
为了测试您生成的 pdf,pdf-inspector gem 很好。
这些教程可能对您有所帮助:
https://grzegorowski.com/using-prawn-gem-for-generating-pdfs-in-rails-5/
https://rubyplus.com/articles/3891-PDFs-with-Prawn-in-Rails-5
我一直在我的应用程序中使用 wkhtmltoppdf 来生成 pdf's.Since 现在我发现它不支持超过 1000 页的文件。我有兴趣尝试 prawn pdf,因为它似乎比其他 gems 更快。 谁能告诉我,反正我们有大虾gem把html转成pdf? 如果不像 pdfkit 和 wkhtmltopdf 做的那样,那么任何调试 prawn 生成的 pdf 样式的方法就像我们有 wkhtmltopdf?
的方法一样Could anyone tell, anyway we have in prawn gem to convert html to pdf?
Prawn is not a html to pdf generator, they point this at official site http://prawnpdf.org/api-docs/2.0/
"One thing Prawn is not, and will never be, is an HTML to PDF generator. For those needs, consider looking into FlyingSaucer via JRuby, or one of the webkit based tools, like Wicked or PDFKit. We do have basic support for inline styling but it is limited to a very small subset of functionality and is not suitable for rendering rich HTML documents."
If not like pdfkit andd wkhtmltopdf do, then any way to debug pdf generated by prawn for styling like we have way for wkhtmltopdf?
要调试 Prawn 生成的 pdf,我认为最简单的方法是生成一个新的 pdf 或让您的控制器响应您的 pdf:
Prawn::Document.generate("path/to/pdf/example.pdf") do
pdf.text "Hello"
end
管理员回复 pdf:
format.pdf do
pdf = PdfGenerator.new(@invoice)
send_data pdf.render,
filename: "pdf_test",
type: 'application/pdf',
disposition: 'inline'
end
每次进行更改时都会刷新您的页面。
为了测试您生成的 pdf,pdf-inspector gem 很好。
这些教程可能对您有所帮助:
https://grzegorowski.com/using-prawn-gem-for-generating-pdfs-in-rails-5/
https://rubyplus.com/articles/3891-PDFs-with-Prawn-in-Rails-5