Convert html to image.

The question was asked: 6 years 11 months ago   views: 19

Asking for your help in finding a php library for converting html + css to image, pgn,jpg,gif.

Asked: DigSil DigSil 21-06-2012 в 15:22:55
View here. May be you find something useful. - ReinRaus ReinRaus 21-06-2012 в 15:29:46
15 ways true, not php: - sercxjo sercxjo 21-06-2012 в 22:27:56
@Alexander Fisenko - has access to the shell_exec? - Zowie Zowie 21-06-2012 в 22:37:50
Access shell_exet Have here found an interesting option if you have something like love to see - DigSil DigSil 22-06-2012 в 00:06:15
You need the image of the entire page (i.e., from the top to the bottom) or its part? - Zowie Zowie 22-06-2012 в 00:54:14

Answers   1


Here is an example conversion Html => PDF => PNG / JPEG

$html_content = '<p>Hello World</p>';

$html2pdf = new HTML2PDF('P', 'A4');
$file = $html2pdf->Output('temp.pdf','F');

$im = new imagick('temp.pdf');
$im->setImageFormat( "jpg" );
$img_name = time().'.jpg';

In the beginning, do not forget to connect the library HTML2PDF or mPDF

Answered: Roman Kozin Roman Kozin 28-01-2016 в 10:44:34