Personal tools
You are here: Home 博客群 潘俊勇的Blog 2006 2006-12 htmldoc和PDF生成
Log in


Forgot your password?
Recent Comments
  (oSky) 2007-10-30
 得有银哪! (Zoomq) 2007-10-25
 晕菜 (Anonymous User) 2007-10-21
 和用VC调用有什么不同 (Anonymous User) 2007-10-08
 求助 (yan_fangli) 2007-09-27
 
Document Actions

htmldoc和PDF生成 htmldoc和PDF生成

Submitted by panjy. on 2006-12-07 23:09. 内容管理
htmldoc能够将html转换成PDF文件

htmldoc能够将html转换成PDF文件

htmldoc 包括2个版本,开源版本和商业版本。 ubuntu上是可直接使用 sudo apt-get install htmldoc 安装的。 Windows上的用户如果不想出点血,就得自己去编译了吧...

htmldoc有个很好的web界面,但是我主要是想在服务器上使用, 因此我对其命令行使用更感兴趣。

要将页面filename.html,转换成PDF,执行这个就可以了:

htmldoc --webpage -f output.pdf filename.html

要将file1.html, file2.html组装成一个分页的PDF,可执行这个:

htmldoc --webpage -f output.pdf file1.html file2.html

最酷的在这里了,要把slashdot.org的首页转换成PDF,很轻松:

htmldoc --webpage -f output.pdf http://slashdot.org/

想制作一本带目录的书,很容易:

htmldoc --book -f output.pdf file1.html file2.html

想增加一个漂亮的图片做封皮?这样的:

htmldoc --book -f 12book.pdf 1book.html 2book.html --titlefile bookcover.jpg

说了这么多好,最大的问题却遗漏了,支持中文吗?非常遗憾,还不支持UTF-8/Unicode/Chinese/Japanese。 看到有文章说1.9版本会支持UTF8,1.9也还没正式release. 具体如何,还不得而知。

又想起了 ReportLab , 2.0版本最大的特性就是支持unicode,但是我现在已经忘记上次评测的结果了。

中文PDF生成是心中永远的痛。

对了,前2天研究了下openoffice的转换机制,有个oooconv的产品,在这里:

https://infrae.com/svn/buildout/oooconv-dev/trunk/

但是它只能在Linux上运行,而且安装很麻烦,不过这个方法还是很值得跟踪的。


Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: