Tuesday, April 6, 2010

Imagemagick reading pdfs under Apache and Windows

Getting "Apache HTTP Server has stopped working" when trying to read a pdf file using the PHP imagick class when running Apache?:

If
<?php
$im = new imagick('file.pdf[0]');
?>

breaks your server. Try installing the latest Ghostscript windows binaries: http://pages.cs.wisc.edu/~ghost/

You should also have gotten an error if you tried to convert the pdf in commandline:
Unrecoverable error: undefinedresource in setcolorspace
Operand stack:
--nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- DefaultGray ColorSpace
START 0 2568152 1228867 1461800 167944 true 1134 5 <9>
END PROCS 6 2568152 1240166 1461800 169328 true 1133 5 <9>
gs_std_e.ps 13 2588248 1246221 1461800 170712 true 1133 5 <12>
gs_il1_e.ps 20 2588248 1248404 1461800 170712 true 1133 5 <15>
END FONTDIR/ENCS 25 2588248 1248582 1461800 170712 true 1133 5 <21>
END DEVS 31 2591744 1255606 1461800 170712 true 1133 5 <21>
END STATD 37 2591744 1262786 1461800 172336 true 1133 5 <45>
END GS_FONTS 44 2631936 1293632 1461800 172336 true 1134 5 <51>
END BASIC COLOR 50 2631936 1300193 1461800 172336 true 1132 5 <54>
END LEVEL 1 COLOR 55 2631936 1301921 1461800 172336 true 1132 5 <57>
END IMAGE 61 2652032 1308551 1461800 172336 true 1132 5 <60>
gs_btokn.ps 67 2652032 1311993 1461800 172336 true 991 4 <63>
gs_dps1.ps 73 2652032 1313338 1461800 172336 true 991 4 <63>
gs_dps2.ps 78 2652032 1315345 1461800 172336 true 991 4 <63>
gs_type1.ps 84 2652032 1316871 1461800 172336 true 991 4 <63>
gs_lev2.ps 93 2672128 1334882 1508160 219096 true 991 4 <63>
BEGIN RESOURCES 96 2672128 1337010 1508160 219096 true 991 5 <64>
END CATEGORY 100 2672128 1338270 1508160 219256 true 991 6 <64>
While reading gs_patrn.ps:
%%[ Error: typecheck; OffendingCommand: get ]%%
START 297633 2756688 1417603 1508160 221464 true 995 6 <67>
END PROCS 297638 2756688 1428886 1508160 222848 true 993 6 <67>
gs_std_e.ps 297645 2776784 1434941 1508160 224232 true 993 6 <70>
gs_il1_e.ps 297649 2776784 1437124 1508160 224232 true 993 6 <73>
END FONTDIR/ENCS 297653 2776784 1437302 1508160 224232 true 993 6 <79>
END DEVS 297657 2780280 1444326 1508160 224232 true 993 6 <79>
END STATD 297662 2800376 1454858 1508160 225856 true 993 6 <103>
END GS_FONTS 297667 2820472 1482354 1508160 225856 true 993 6 <109>
END BASIC COLOR 297672 2820472 1488915 1508160 225856 true 991 6 <112>
END LEVEL 1 COLOR 297677 2840568 1493995 1508160 225856 true 991 6 <115>
END IMAGE 297683 2840568 1497297 1508160 225856 true 991 6 <118>
gs_btokn.ps 297689 2840568 1500739 1508160 225856 true 991 6 <121>
gs_dps1.ps 297694 2840568 1502084 1508160 225856 true 991 6 <121>
gs_dps2.ps 297700 2840568 1504091 1508160 225856 true 991 6 <121>
gs_type1.ps 297705 2840568 1505617 1508160 225856 true 991 6 <121>

No comments:

Post a Comment

Post a Comment