[Html2PdfConverter] Slow PDF generation (more than 40s)

[Html2PdfConverter] Slow PDF generation (more than 40s)

  
Forge Component
(52)
Published on 30 Oct by Guilherme Pereira
52 votes
Published on 30 Oct by Guilherme Pereira

Hi there,

I'm experiencing really slow PDF generation using the Html2PdfConverter (version 1.1.13).

I already tried to create a web screen with no preparation and only one label "test" on it and it also takes more than 40s to generate the PDF. I have no clue of why this is taking so long, could you guys help me with this?

Thank you.

I've seen this behaviour also in a client... several seconds are spent initialising stuff before the actual rendering of the page.. must be something related to the wkhtmltopdf binary...

Hi Ana,

Can you try to download wkhtmltopdf to your machine and generated the pdf using the command line? How long does it take?

Guilherme

Actually, the problem is more strange than I described:
I have two applications on the same environment (lets call them App1 - developed by other team - and App2 - developed by my team). Both App1 and App2 use the GeneratePDF action, but on App1 the generation is fast and on App2 it is really slow. 

I've tried passing the link App1 uses on App2 and the generation is quick and using the link of App2 on App1 makes the generation slow - which made me think the problem was with my web screen itself. However, I created a blank Web Screen, with no preparation and only one label on it, and the generation still takes more than 40 seconds. I have no idea of what is happening here, do you have any suggestion?


Thanks.

Hi Ana,


Without accessing the apps is hard to tell but it could be for instance some kind o javascript or css (at espace level). If you access the page of app2 on your browser with the developer tools open do you see it has finished quickly (not just the actual rendering but all scripts loaded)?


Cheers,

Guilherme

I've been looking for some JS on App1 that might cause it to be faster, but didn't find anything and we're using very similar CSS.

Yes, the page finishes quickly (Load: 249ms).

Ana

Hi,


Is there anyway you can share both urls privately so i can test from my side?


Cheers,

Guilherme

I think I may have found the solution... 

App1 is using a theme based on Dublin while App2 is using Liverpool. This, for some reason, is the problem. I now have to analyse the CSS to better understand it.


Thanks for your help.

Solution

Probably some resource URL that is not accessible from that server and wkhtmltopdf waits for a timeout before finishing... don't know...

Solution

Hi Ana,


There’s a known incompatibility between silk and some pages pdf generations due to a script that silk has to detect mobike devices. I’m unsure if it is related as in the past the result was a blank page on pdf generation and not slow execution but something may have changed in wkhtmltopdf or even silk itself.


The recommendation was to use a new page in a webflow which is not silk ui based so you may try that as well. Or you could try wkhtmltopdf —disable-javascript option


Cheers,

Guilherme

Hi João,

I think you're right. I had an @import rule in my css, for the fonts. By removing it, the time for generation goes from 44s to 8s. 

 

Thanks a lot guys :)