HTMLをPDFに変換するコマンドです。Windows、Mac OSX、Linuxに対応しています。
Ubuntu(Debian)の公式リポジトリにパッケージがありますが、機能が制限されているので、配布元の「Static Binary」を使ったほうがいいかもしれません。
$ sudo apt-get install wkhtmltopdf $ wkhtmltopdf --helpそれと、現在の最新版(v0.11.0 rc1)には、セグメンテーション違反で異常終了する不具合があるみたいです。... Reduced Functionality: This version of wkhtmltopdf has been compiled against a version of QT without the wkhtmltopdf patches. Therefore some features are missing, if you need these features please use the static version.Currently the list of features only supported with patch QT includes:* Printing more then one HTML document into a PDF file. * Running without an X11 server. * Adding a document outline to the PDF file. * Adding headers and footers to the PDF file. * Generating a table of contents. * Adding links in the generated PDF file. * Printing using the screen media-type. * Disabling the smart shrink feature of webkit.
$ wkhtmltopdf http://www.yahoo.co.jp/ output.pdf QPixmap: Cannot create a QPixmap when no GUI is being used [1] 18202 segmentation fault ./wkhtmltopdf http://www.yahoo.co.jp/ output.pdf
【追記】
Windows用のGUIフロントエンドを作っている人がいました。
→ Web2Pdf - Convert webpages to pdf ebooks
【参考】
・WebKitを使ったHTML2PDF「wkhtmltopdf」- MOONGIFT
・wkhtmltopdfでPDFを簡単作成 — そこはかとなく書くよん。
・PHP から PDF作成 (wkhtmltopdf) - MEGMiLK の思い出
11:58 pm | コメントする |
1. pollux 2013/02/12 17:17
https://bugzilla.redhat.com/show_bug.cgi?id=909808
http://koji.fedoraproject.org/koji/packageinfo?packageID=15470