2

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 ?

NorthCat
  • 9,643
  • 16
  • 47
  • 50
Mahesh Shitole
  • 762
  • 1
  • 6
  • 15

2 Answers2

1

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.

Mahesh Shitole
  • 762
  • 1
  • 6
  • 15
  • Can you please share more details on breaking tables into multiple? Did you create multiple pdf and merged or something else? – Hiren Jun 28 '18 at 14:58
0

You can try pdfkit:

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

Also see this question which describes solutions using PyQt.

Community
  • 1
  • 1
NorthCat
  • 9,643
  • 16
  • 47
  • 50