Creating on-demand, print-quality PDFs (preferably in Ruby if feasible)

霸气de小男生 提交于 2019-12-08 03:36:39

问题


Main-Question

What's your fast and reliable (as in "stable") solution to create on-demand, newspaper-like (as in "using advanced layout or typesetting") PDFs out of an application on a Linux server?

Therefore: No, HTML2PDF is not the solution I'm looking for. ;-)


Bonus-Question

And if it's not Ruby-based: Is there a way to steer your solution out of a Rails application? Preferably over a webservice or a something-2-Ruby-bridge-kind-of-thing?

Thanks a lot for your suggestions!

Update

There's a similar question and the rtex gem suggested there looks like what I'm looking for. I'll keep this question unanswered to look if there are other suggestions.


回答1:


Typesetting well is hard.

If you can't find a ruby typesetting library, you may want to look at running a background pdflatex. LaTeX source is pretty easy to generate programmatically.

How useful this idea is will depend a bit on how complicated your documents are, and how much you care about the quality of output. If you have simple text only, and only want something a bit better than html, you probably have more options.




回答2:


Prawn is designed for this type of thing, and it's under current development.




回答3:


With php I've had great luck with FPDF. I generate a few thousand high quality reports everyday with it. Never misses a beat and is pretty quick. With php running on a webserver, I imagein it wouldn't be too hard to setup ruby to feed the php page the data required to generate and then ruby pick up the result.

EDIT: It looks like there is a port for Ruby. http://zeropluszero.com/software/fpdf/



来源:https://stackoverflow.com/questions/786670/creating-on-demand-print-quality-pdfs-preferably-in-ruby-if-feasible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!