开发者

Python HTML to PDF with floating divs

开发者 https://www.devze.com 2022-12-27 22:56 出处:网络
Is there a way to convert XHTML/HTML with CSS to PDF with floating divs? I have tried pisa/开发者_JAVA技巧xhtml2pdf in python and dompdf in PHP both are not able to do so.

Is there a way to convert XHTML/HTML with CSS to PDF with floating divs?

I have tried pisa/开发者_JAVA技巧xhtml2pdf in python and dompdf in PHP both are not able to do so.

Is there any way?


See html-tables-to-pdf-in-php-neither-dompdf-nor-html2ps-pdf-are-working.

A possible path is to use some Layout (Rendering) Engine, such as Webkit or Gecko. The rendered HTML page can then be saved as PDF. An example of a tool that uses this method is the wkhtmltopdf project.

(I know, this is not related to Python or PHP - you can still drive the tool from a script.).


Found a blog post that does this very thing

http://web.archive.org/web/20130525082452/http://notes.alexdong.com/xhtml-to-pdf-using-pyqt4-webkit-and-headless

got it working rather quickly using the more mature pyqt4 module

0

精彩评论

暂无评论...
验证码 换一张
取 消