views:

406

answers:

0

I'm trying to convert the first page of a PDF to a JPG. I'm pretty sure I got this to work with certain PDFs, but is it really possible that certain PDFs are made incorrectly and cannot be converted?

I tried running this first:

$ convert 10-03-26.pdf[1] test.jpg

And I got the follow:

Error: /syntaxerror in readxref
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1062/1417(ro)(G)--   --dict:0/20(G)--   --dict:73/200(L)--   --dict:73/200(L)--   --dict:97/127(ro)(G)--   --dict:229/230(ro)(G)--   --dict:14/15(L)--
Current allocation mode is local
ESP Ghostscript 7.07.1: Unrecoverable error, exit code 1
convert: Postscript delegate failed `10-03-26.pdf'.

Running this instead:

$ convert -verbose -colorspace rgb '10-03-26.pdf[1]' test.jpg

I get the following:

Error: /syntaxerror in readxref
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1062/1417(ro)(G)--   --dict:0/20(G)--   --dict:73/200(L)--   --dict:73/200(L)--   --dict:97/127(ro)(G)--   --dict:229/230(ro)(G)--   --dict:14/15(L)--
Current allocation mode is local
ESP Ghostscript 7.07.1: Unrecoverable error, exit code 1
"gs" -q -dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dAlignToPixels=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-g792x1611" "-r72x72" -dFirstPage=2 -dLastPage=2 "-sOutputFile=/tmp/magick-XXU3T44P" "-f/tmp/magick-XXoMKL8Z" "-f/tmp/magic2eec1F"Start of Image
Define Huffman Table 0x00
          0   1   5   1   1   1   1   1
          1   0   0   0   0   0   0   0
Define Huffman Table 0x01
          0   3   1   1   1   1   1   1
          1   1   1   0   0   0   0   0
Define Huffman Table 0x10
          0   2   1   3   3   2   4   3
          5   5   4   4   0   0   1 125
Define Huffman Table 0x11
          0   2   1   2   4   4   3   4
          7   5   4   4   0   1   2 119
End Of Image
convert: Postscript delegate failed `10-03-26.pdf'.

Why would the conversion fail?

Thanks!