简体   繁体   中英

HTML page to PDF in Python?

Is there a library available to convert a HTML page (text, images, layout elements etc. ) to a PDF file.

I have an HTML page with figures, text and tables with numbers etc. which I want my clients to be able to download as PDF. How do I do this with Python?

Not too familiar with python, and prince is nice if you are willing to shell out the cash. There is this http://github.com/antialize/wkhtmltopdf that uses webkit. It is a simple command line utility that you can call and it will honor html+css. As far as I know, it is the only free tool to do so well. There is a ruby gem for it http://github.com/jdpace/PDFKit , not that it helps you but might give you some ideas.

那么,有reportlabhtml2pdf模块,但为了获得最佳结果,我可能会尝试外部调用Princehttp://www.princexml.com/doc/6.0/python/ )。

Have you heard of xhtml2pdf/pisa?

It has the ability to work as a python module or as a separate command line utility.

You can use the documentation here to get started: http://www.xhtml2pdf.com/doc/pisa-en.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM