New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latency issues for large style sheets: Caching style sheets in php/dompdf for successive calls in production env? #3374
Comments
Dompdf doesn't provide any type of functionality to support this. It's also a challenging question. There are actually two parts to the problem:
While it may be possible to support something for the first part, there's no getting around the second. It's likely the second part that's eating up most of the rendering time. Still, if you wanted to try you would do it something like the following:
I have not tested that code and I'm not sure it will work (and expect it would not). If the content you're rendering is fairly static (e.g., a "frame" around some content) then you might consider PDF templating or merging. Not something Dompdf supports but you could use it in conjunction with another library. |
ok.. reading your algorithm, I have a couple of questions:
Is this what you're indicating? Possible approach 1 - applying rendered styles (have I understood this re scoping?) // in function Possible approach 2 - modular appending // in function |
Hi Brian
Quick one: I've noticed when adding style sheets (like bootstrap) to the pdfing process, dompdf goes from a millisecond to create a pdf to a few seconds. Once I've added all my style sheets, it takes around 7 seconds per pdf, which is quite a bit.
Is there some way to cache or load the style sheets in through the composer / vendor / dompdf library? or is there a cache setting that once in production, I can lock down the styles so they are just loaded once and for each successive pdf, it doesn't take 7 seconds to pdf?
Cheers!
The text was updated successfully, but these errors were encountered: