php - Html to PDF to JPEG -


i way there. unsure how push temporary pdf object imagick generate , return jpeg image. using mpdf's standard output(), pdf rendered screen:

$mpdf=new mpdf(); $mpdf->writehtml($output);  $img = new imagick($mpdf->output()); $img->setresolution(300,300); $img->resampleimage(150,150,imagick::filter_undefined,1); $img->resizeimage(512,700,imagick::filter_lanczos,0); $img->setimageformat('jpeg'); $img->setimageunits(imagick::resolution_pixelsperinch); $img->writeimage ("test.jpeg"); 

under scenario pdf outputed screen instead of jpg image returned/created. proper way pass pdf imagick?

i think need: $mpdf->output('temp/'.$filename.'.pdf','f');

$mpdf->output('temp/'.$filename.'.pdf','f'); $pdf_file = 'temp/'.$filename.'.pdf'; $savepath = 'temp/'.$filename.'.jpg'; $img = new imagick($pdf_file); $img->setimageformat('jpg'); $img->writeimage($savepath); echo "<img src='temp/$filename.jpg' />"; 

http://phpform.net/pdf-to-image.php


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -