有比HTML更好的版面设计语言用于打印吗? [英] Is there a better layout language than HTML for printing?

查看:79
本文介绍了有比HTML更好的版面设计语言用于打印吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Python和Qt 4.4,我必须打印一些页面.最初,我认为我将HTML与CSS结合使用来生成这些页面.但是HTML有一些局限性.

I'm using Python and Qt 4.4 and I have to print some pages. Initially I thought I'd use HTML with CSS to produce those pages. But HTML has some limitations.

现在的问题是:有什么比HTML更好的东西,但是(或几乎)一样容易使用吗?此外,它应该与GPL兼容.

Now the question is: is there anything that's better than HTML but just (or almost) as easy to use? Additionally, it should be GPL-compatible.

kdgregory&马克G:最明显的限制是我无法指定打印机边距.还有另一个问题:如何添加页码?

kdgregory & Mark G: The most obvious limitation is that I can't specify the printer margins. There is another problem: How do I add page numbers?

Jeremy French:我要打印的一件事是订购的所有产品的清单,这些清单可以散布在几页上.

Jeremy French: One thing I have to print is a list of all the products someone ordered which can spread over a few pages.

推荐答案

八年来,我一直在与Python的打印(或PDF)输出作斗争,到目前为止,我遇到了以下方法(按个人喜好排列) :

I have been fighting with printed (or PDF) output from Python for 8 years now and so far I came across the following approaches (in order of personal preference):

  • 使用通过 pyJasper (由我撰写)或 iReport 来定义布局.您的Python代码将通过HTTP与基于Java的Jasper引擎联系,并使其呈现PDF(pyJasper可以处理).我们每天使用数千页.
  • 使用纯文本输出.你不能再快了.我们每天使用数百页.
  • 使用XSLT-FO.您还必须调用基于Java的渲染引擎,如FOB.可能会导致性能问题,但是可以通过长时间运行Java服务器进程来解决-与Jasper相同的方法.我们每天使用数百页,但是编写XSLT-FO文档使我很头疼.不用于新代码.
  • 生成 LaTeX 源,并使用乳胶软件包将其呈现为PDF.要让LaTeX看起来像一样很难.但是,只要使用提供的LaTeX样式,就可以了.在我的商店中未用于生产中.
  • 使用 ReportLab工具包
  • 生成PDF.有点低水平.更低的级别: FPDF .我们每天使用FPDF-Ruby数百页.花了很多心血来获取我们想要的布局.
  • 直接生成后记.奇怪,但您几乎无法获得更多的速度和控制能力.我们用它来生成每天有数十万Jpegs的联系表.需要摆弄,但很有趣.
  • 使用 troff /groff生成Postscript/PDF.级别很低,但是很适合做简单的大批量事情.因此从未在生产中使用过它.
  • Using JasperReports via pyJasper (written by me) or JasperServer. You can use the WYSIWYG design tool iReport to define your layout. Your Python code will contact the Java based Jasper engine via HTTP and make it render a PDF (pyJasper handles that). We use that for a few thousand pages a day.
  • Use plain text output. You can't get any faster. We use that for a few hundred pages per day.
  • Use XSLT-FO. You also have to call a Java based rendering engine like FOB. Might result in performance issues but can be mitigated by having a long running Java server process - same approach than with Jasper. We use that for a few hundred pages per day but writing XSLT-FO documents made my head hurt. Not used for new code.
  • Generate LaTeX source and use a latex software package to render to PDF. Getting LaTeX to look like you like is quite difficult. But as long as you go with the provided LaTeX styles, you are fine. Not used in production at my shop.
  • PDF generation with the ReportLab Toolkit. Somewhat low level. Even more low level: FPDF. We use FPDF-Ruby for a few hundred pages a day. Took a lot of fiddeling to get the layout we wanted.
  • Directly generate Postscript. Strange but you nearly can't get more in terms of speed and control. We used that to generate contact sheets with a few hundred thousand Jpegs per day. Takes fiddling but is fun.
  • use troff/groff to generate Postscript/PDF. Very low level bute nice to do simple, high volume things. Never used it thus in production.

对于订单,发票等,我强烈建议使用JasperReports.使用可视化编辑器定义布局的功能可节省大量时间.

For orders, invoices and the like I highly recommend JasperReports. The ability to use a visual editor to define the layout is a huge time saver.

这篇关于有比HTML更好的版面设计语言用于打印吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆