0

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#).

halfer
  • 19,824
  • 17
  • 99
  • 186
Anand
  • 1
  • 2
  • Am I understand correctly that you specify 30-35 URLs as input (with GeneratePdfFromFiles method)? – Vitaliy Fedorchenko Aug 23 '17 at 10:51
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Aug 23 '17 at 11:19
  • Thanks for your suggestion – Anand Jun 22 '18 at 08:58

1 Answers1

0

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 :)

Anand
  • 1
  • 2
  • If you are using angular 2+ then this might help to optimize your code for better performance for pdf- * Avoid method bindings in template, this executes for each event on the view and takes lots of time . It's recommended to bind variable to template instead of method. * We can update angular change detection strategy by adding below lines of code on each pdf specific component. @Component({ // ... changeDetection: ChangeDetectionStrategy.OnPush }) etc – Anand Feb 22 '18 at 12:31