doutou3725 2015-09-23 15:32
浏览 212

即使安装了Imagic软件包和ghostscript,Imagick也无法正常工作

I want to create image of the first page of an PDF file. So for that I followed the instruction from this link- Install Imagick for PHP and Apache on Windows

All steps I have completed successfully as shown above link. Then I wrote my php code which is as follow-

<?php 

   try{

     $im = new Imagick();
     $im->setResolution(300,300);
     $im->readImage('mypdf.pdf[0]');
     $im->scaleImage(1000,0);
     $im->setImageFormat('jpg');
    //$im->setImageCompression(imagick::COMPRESSION_JPG); 
     $im->setCompressionQuality(100);
     $im = $im->flattenImages();
    $im->writeImage('test.jpg');
  }

  catch(Exception $e) {
     echo 'Message: ' .$e->getMessage();
   }
?> 

and I got following error --

Message: PDFDelegateFailed `[ghostscript library 9.16] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r300x300" -dFirstPage=1 -dLastPage=1 "-sOutputFile=C:/Windows/TEMP/magick-4220l9dSVismOfxn%d" "-fC:/Windows/TEMP/magick-4220xKPtbptSyL7t" "-fC:/Windows/TEMP/magick-4220niNseKCMcRtD"': Error: /undefinedfilename in (C:/Windows/TEMP/magick-4220xKPtbptSyL7t) Operand stack: Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push Dictionary stack: --dict:1200/1684(ro)(G)-- --dict:0/20(G)-- --dict:78/200(L)-- Current allocation mode is local Last OS error: No such file or directory GPL Ghostscript 9.16: Unrecoverable error, exit code 1 @ error/pdf.c/InvokePDFDelegate/271

Now I cant understand what is going wrong there. How it will be fixed so I am stuck at this stage. So please anyone can help me to sought out this problem.

UPDATE-- I googled about this problem and found one link- Why converting this PDF file fails when using ImageMagick/Ghostscript?

But I could not understand its answer. I am not sure what to do after reading it.

Thanks in advance.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据