Discusses how to create a picture of text with HTML content in PHP
Like what:
Text message
Line break
Such a piece of HTML code, how to keep his format, create a picture
Share to: more
------Solution--------------------
Possible off-the-shelf approach:
1. Using Java html2image
2. Use TCPDF to generate PDF and then ...
3, the use of PHP screenshot function Imagegrabscreen, Imagegrabwindow
------Solution--------------------
I add a
Https://zh.wikipedia.org/wiki/Webkit
Https://en.wikipedia.org/wiki/Webkit
------Solution--------------------
Example
Define (' Dompdf_pdf_backend ', ' GD ');
Require_once ("dompdf_config.inc.php");
$html =<<< HTML
Text message
Line break
HTML;
$dompdf = new Dompdf ();
$dompdf->load_html ($html);
$dompdf->render ();
$dompdf->stream (");
------Solution--------------------
Dompdf's Download Address
Http://code.google.com/p/dompdf/downloads/list
------Solution--------------------
Different versions of Dompdf will have different performance (I'm dompdf.php,v 1.24 2009-04-29)
It uses DOMDocument to parse HTML
Print_r ($dompdf->_xml);
You can see that parsing is ok