简体   繁体   中英

pisa.CreatePDF hangs with huge html file

I am generating pdf using html template with python pisa.CreatePDF API, It works well with small html, but in case of huge html it takes lot of time. Is there any alternative ?

I did few changes in html which results pisa.createPDF works fast for me. I am using html of almost 2 MB , contains single table with almost more than 10,000 rows . So I break them into multiple tables and tried again. Its surprised me, initially with single table it took almost 40 minutes (2590 seconds) to generate PDF and with multiple tables it has taken only 80 Seconds .

You can try pdfkit :

import pdfkit
pdfkit.from_file('test.html', 'out.pdf')

Also see this question which describes solutions using PyQt.

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