Python HTML to PDF with floating divs

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

I tried pisa / xhtml2pdf in python and dompdf in PHP, both cannot do this.

Is there any way?

+4
source share
2 answers

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

A possible way is to use a Layout (rendering) Engine , such as Webkit or Gecko . The displayed HTML page can then be saved in PDF format. An example of a tool using this method is the wkhtmltopdf project.

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

+4
source

Found a blog post that does just that.

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

made it work pretty fast using the more mature pyqt4 module

0
source

Source: https://habr.com/ru/post/1307621/


All Articles