This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Convert pdf to image

nomikos wrote on 2016-11-14:

We need to conver pdf files to images through imagick/ghostscript. In ubuntu works well.

But in our centos instance (Amazon Linux AMI release 2016.09) it fails.

[ec2-user@ip-10-0-3-130 ~]$ convert doc-535-09e226c35e50173ebc6918615d611edb-invoice.pdf doc1.png
Error: /invalidaccess in --run--
Operand stack:
   --dict:6/15(L)--   fn1   24   --dict:6/6(L)--   --dict:6/6(L)--   JDGJIQ+ArialMT   --dict:11/12(ro)(G)--   --nostringval--   CIDFontObject   --dict:7/7(L)--   --dict:7/7(L)--   2112   --dict:7/7(L)--   --nostringval--   PDFCIDFontName   JDGJIQ+ArialMT
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1862   1   3   %oparray_pop   1861   1   3   %oparray_pop   1845   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   false   1   %stopped_push   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   false   1   %stopped_push   --nostringval--   %loop_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1154/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--   --dict:75/200(L)--   --dict:106/127(ro)(G)--   --dict:286/300(ro)(G)--   --dict:22/25(L)--   --dict:4/6(L)--   --dict:21/40(L)--   --dict:1/1(ro)(G)--   --dict:1/1(ro)(G)--   --dict:1/1(ro)(G)--
Current allocation mode is local
GPL Ghostscript 8.70: Unrecoverable error, exit code 1
convert: Postscript delegate failed `doc-535-09e226c35e50173ebc6918615d611edb-invoice.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/678.
convert: no images defined `doc1.png' @ error/convert.c/ConvertImageCommand/3046.

This only ocurr with pdfcrowd files. For example if we run same command with another pdf file it works:

[ec2-user@ip-10-0-3-130 ~]$ wget
--2016-11-14 14:59:24--
Resolving (
Connecting to (||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17588 (17K) [application/pdf]
Saving to: ?ecocollect-doc-en-1.pdf?

ecocollect-doc-en-1.pdf                                            100%[===============================================================================================================================================================>]  17,18K  --.-KB/s    in 0,1s    

2016-11-14 14:59:25 (135 KB/s) - ?ecocollect-doc-en-1.pdf? saved [17588/17588]

[ec2-user@ip-10-0-3-130 ~]$ convert ecocollect-doc-en-1.pdf ecocollect-doc-en-1.png
[ec2-user@ip-10-0-3-130 ~]$ ll
total 280
-rw-rw-r-- 1 ec2-user ec2-user 68344 Nov 12 18:13 doc-535-09e226c35e50173ebc6918615d611edb-invoice.pdf
-rw-rw-r-- 1 ec2-user ec2-user 92114 Nov 14 12:40 doc-610-5937d27a5247d8ebaf6a39b12c5afd34-boleta.pdf
-rw-r--r-- 1 ec2-user ec2-user 68344 Nov 14 13:57 doc.pdf
-rw-rw-r-- 1 ec2-user ec2-user 17588 Apr  8  2014 ecocollect-doc-en-1.pdf
-rw-rw-r-- 1 ec2-user ec2-user 30969 Nov 14 14:59 ecocollect-doc-en-1.png
[ec2-user@ip-10-0-3-130 ~]$ 

Any adevice? thanks,
support wrote on 2016-11-15:
The error message says that doc-535-09e226c35e50173ebc6918615d611edb-invoice.pdf can't be found. Could you please double check on your end?
convert: Postscript delegate failed `doc-535-09e226c35e50173ebc6918615d611edb-invoice.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/678.
Aaron03 wrote on 2017-02-16:
Thanks for this help