Reputation: 81
In a C# application, I am using the NReco.ImageGenerator library which encapsulates the wkhtmltopdf library to convert html to images. While on my reasonably powerful pc (i7, 8gb ram, non-ssd, Windows 7 64bit), the speed is good (1 second max per picture?), on other pcs the whole operation can take from 20 to 40 seconds for 1 picture.
One of those pcs is another developer pc, just like mine with slightly better cpu. Running it through the Visual Studio debugger, the whole delay is caused on the following lines:
var htmlToImageConv = new NReco.ImageGenerator.HtmlToImageConverter();
var jpegBytes = htmlToImageConv.GenerateImage(html, ImageFormat.Png);
Any idea what might be slowing it down or what can I do it debug it/improve the speed?
Upvotes: 0
Views: 1526
Reputation: 2714
When using wkhtmltopdf to convert HTML to a PDF or an image note that external resources on other servers will be downloaded for rendering. The downloading of these resources (e.g. images, fonts, css, javascript) will have an impact on the time it takes to do the conversion.
Upvotes: 2