26 Ocak 2017 Perşembe

PHP Fatal error: Uncaught exception 'ImagickException' with message 'PDFDelegateFailed

Convert PDF to Image (JPEG,JPG,PNG)  with PHP
How do I convert a PDF to image 

Php 6 version causes problem that you are given as you use Imagick Somehow it works well in Php 5
(Php 6 ile bu sourun oluşuyor Ancak Php 5 de çalışıyor  )
  
So I got solution after searching lots of resources and reading 

SOLUTION:
(ÇÖZÜM)

$pathToPdf="/......";                      //pdf dosya dizini

$pathToWhereImageShouldBeStored="/...."          //resmin yükleneceği dosya dizini


//Counting page of pdf(Pdf deki toplam resim sayısını getir)

$pageCount = exec("/usr/bin/identify -format %n ".$pathToPdf);


//converting pdf to imgs (pdf i resimlere dönüştürme)

for($i=0;$i<$pageCount;$i++){
exec("convert ".$pathToPdf."[".$i."] ".$pathToWhereImageShouldBeStored.$i.".png");


NOTE: GhostScript should be installed ! 

Hiç yorum yok:

Yorum Gönder