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 使用C#,asp.net读取Excel文件并保存到Oracle数据库
    • ¥15 C# datagridview 单元格显示进度及值
    • ¥15 thinkphp6配合social login单点登录问题
    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 虚心请教几个问题,小生先有礼了
    • ¥30 截图中的mathematics程序转换成matlab