I use php and ghostscript to convert pdf to image and show
<?php
if(empty($_GET['page'])) die;
$numPage=$_GET['page'];
header('Content-type:image/jpeg');
system("gs ".
"-dNOPAUSE ".
"-sDEVICE=jpeg ".
"-dFirstPage={$numPage} ".
"-dLastPage={$numPage} ".
"-sOutputFile=%stdout ".
"-dJPEGQ=90 ".
"-r100x100 ".
"-q file.pdf ".
"-c quit");
?>
thanks for your answers
Use
passthruinstead ofsystemAccording to PHP Manual
This function[passthru()] should be used in place of exec() or system() when the output from the Unix command is binary data which needs to be passed directly back to the browser.change
%stdoutto-gs man page:
You can also send output to stdout for piping with the switchthe code below should fix it.