Any way to export some html/css to an image?
Basically I have an <ul>
list with a few <li>
items styled with CSS that may change proprieties ( jquery click adds a class with different background).
I'm using TCPDF library to generate PDFs and need to add that <ul>
to the PDF but TCPDF doesn't yet support advanced CSS st开发者_如何学JAVAyling.
So is there a way to generate an image, a snapshot of that <ul>
? Then I'd only need to include it in the PDF.
Thanks!
(I didn't read your question particularly well before)
Why not just switch to a better PDF generator?
If you can run custom software on your server, I heavily recommend wkhtmltopdf.
Otherwise, use dompdf.
You could stick with TCPDF and use wkhtmltoimage to make a screenshot of your ul
. But, that seems a bit crazy. To run wkhtmltoimage, you need to be able to run custom software, and if you can do that, you might as well just switch to wkhtmltopdf. If you can't run custom software - it's not really possible to render HTML/CSS with pure PHP, so you'll have to come up with something else.
精彩评论