NReco PDF Generator periodically generates blank pages

880 views Asked by At

I'm using NReco PDF generator to create PDFs of some fairly lengthy html tables. Most of the time it works fine, but sometimes it will generate a PDF that's just two blank pages (one blank page where the cover would be, followed by a blank page with the correct header and footer). I don't think anything is wrong with the html itself, since it does successfully generate the full document with the same input other times.

Could this be a timeout issue due to the large number of pages? Per another post I saw, I tried initializing the converter with this optional argument, but it didn't help:

NReco.PdfGenerator.HtmlToPdfConverter pdfConverter = new NReco.PdfGenerator.HtmlToPdfConverter{ CustomWkHtmlPageArgs = " --no-stop-slow-scripts" };

Is there anything else I should adjust, or does anyone know what else could be causing this?

Update: This is primarily happening in Chrome. I have the PDF generating in the browser in a new tab, and I thought it might be a caching issue, so I added a timestamp parameter in the url so it would be unique each time, but that didn't seem to help.

Final Update: adding --javascript-delay 2500 to the CustomWkHtmlPageArgs seems to have fixed the problem, so I think it must have been an issue with the PDF generating before the data was fully loaded.

1

There are 1 answers

0
user3562286 On BEST ANSWER

adding --javascript-delay 2500 to the CustomWkHtmlPageArgs seems to have fixed the problem, so I think it must have been an issue with the PDF generating before the data was fully loaded.