Search code examples
wkhtmltopdfhtml-to-pdfnreco

Not able to generate more than 20 pages in wkhtmltopdf (approx)


I am trying to generate pdf with 30-35 pages using wkhtmltopdf, but there are blank pages after 20 pages(sometimes 21/22). To confirm this I have tried to generate same page 35 times using a loop (please note there is no error in html file).

I am using NReco.PdfGenerator (C#).


Solution

  • Use JavaScript profiler(chrome ) and optimize your code as much as possible if wkhtmltopdf.exe throws timeout exception. After doing refactoring based on above approach we also added --no-stop-slow-scripts parameter along with 3 minutes timeout to the wkhtmpltopdf exe. And now i can generate more than 80 pages :)