Python開發的HTML/CSS轉PDF的轉換器:xhtml2pdf

jopen 10年前發布 | 42K 次閱讀 xhtml2pdf PDF工具包

Xhtml2pdf是一個用把HTML5和CSS 2.1(和一些CSS 3)轉化成PDF,它純粹由Python語言實現。這個工具的最大好處是熟悉HTML和CSS的用戶可以快速生成PDF,不需要學習其他新技術。

在test/simple.py文件中有如何把xhtml2pdf庫整合到Python程序中的例子。

特性:

  • 將 HTML 和 CSS 輸入轉成 PDF 文件
  • 采用純Python開發,因此其平臺獨立
  • 支持文檔細節如:columns, headers, footers, page numbers, custom Postscript and TrueType fonts, etc.
  • 支持框架如 Django, Turbogears, CherryPy, Pylons, WSGI
  • 能夠與Python程序方便集成
  • Also usable as stand alone command line tool for Windows, MacOS X and Linux (binaries not available)

其它相似工具:

  • weasyprint - Also written in Python, BSD License
  • fop - Apache Formatting Objects Processor
  • wkhtmltopdf - Based on WebKit
  • pantomjs - Based on WebKit too, can be controlled using Javascript

官方網站:http://www.xhtml2pdf.com/
github主頁:https://github.com/chrisglass/xhtml2pdf

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!