Improve flex rendering speed
After trying all python libraries to generate a pdf, I've found the best one "Weasyprint". This is the only one library that generates a perfect pdf file for my html and css. But the problem is, it takes too long. I've read other issues regarding performance and came to a conclusion that, may be due to the flexbox the generation is taking too long. I've tried filtering my css but no luck. The time taken is around 15-25 seconds for the below code. Any suggestions to improve time and have no effect on quality are appreciated.
Hello!
You’re right, this document take a lot of time to render. Logs tell that the problem comes from the layout part, I have to check what’s taking so much time.
The rendering is slow because of the nested flex layouts. Flex layout is not really optimized, but it shouldn’t be that slow…
Thank you for your time and reply. Will be waiting. :)
I've found an alternative to flex layout and used it in my code and the PDF generation time has improved a lot.
If someone came across the same problem, here's what I used:
'display: flex' -> 'display: inline-block' 'flex-direction: column' -> 'display: block'
There's a detailed list in here: https://kyusuf.com/post/almost-complete-guide-to-flexbox-without-flexbox/
As I found an alternative solution, I'm closing the issue.
I've found an alternative to flex layout and used it in my code and the PDF generation time has improved a lot.
:+1:
Thanks a lot for your solution!
As I found an alternative solution, I'm closing the issue.
I reopen it and change the title: we have to find why flex layout is slow :smile:.