function pdf2png($PDF,$toPath,$page){ if(!extension_loaded('imagick')){ echo "imagick"; return false; } if(!file_exists($PDF)){ echo "noexists"; return false; } $IM = new imagick(); $IM->setResolution(1000,2000); $IM->setCompressionQuality(100); $IM->readImage($PDF."[".$page."]"); foreach ($IM as $Key => $Var){ $Var->setImageFormat('png'); $Filename = $toPath.time().'_'.$Key.'.png'; if($Var->writeImage($Filename) == true){ $Return[] = $Filename; } } return $Return; } |