Page 1 of 1
Can't convert pdf to png :(
Posted: 2015-03-07T21:39:52-07:00
by fotanus
I have the following problem when trying to convert some pdf files. Following the output:
Code: Select all
$ convert NoSilverBullet.pdf a.png
Error: /syntaxerror in -file-
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1910 1 3 %oparray_pop 1909 1 3 %oparray_pop 1893 1 3 %oparray_pop 1787 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push
Dictionary stack:
--dict:1167/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)--
Current allocation mode is local
Current file position is 1
GPL Ghostscript 9.05: Unrecoverable error, exit code 1
convert: Postscript delegate failed `NoSilverBullet.pdf': @ error/pdf.c/ReadPDFImage/663.
convert: missing an image filename `a.png' @ error/convert.c/ConvertImageCommand/3011.
This PDF won't work:
http://www.filedropper.com/nosilverbullet
This other, for example, will:
http://www.googleguide.com/print/adv_op_ref.pdf
I have no clue on what I'm doing wrong.
Re: Can't convert pdf to png :(
Posted: 2015-03-07T21:56:16-07:00
by snibgo
It seems to convert with no problems under IM v6.9.0-0 and Ghostscript 9.15 under Windows 8.1.
I suggest you upgrade GS.
Re: Can't convert pdf to png :(
Posted: 2015-03-08T06:52:52-07:00
by fotanus
I was using a vagrant machine with ubuntu precise64, so I changed to utopic64, which is the last one. Then installed last versions from repo. Here are the versions it gave me, and the output again:
Code: Select all
vagrant@vagrant-ubuntu-utopic-64:~/pubtree$ ghostscript --version
9.14
vagrant@vagrant-ubuntu-utopic-64:~/pubtree$ convert --version
Version: ImageMagick 6.7.7-10 2014-08-21 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
vagrant@vagrant-ubuntu-utopic-64:~/pubtree$ convert NoSilverBullet.pdf a.png
Error: /syntaxerror in -file-
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1934 1 3 %oparray_pop 1933 1 3 %oparray_pop 1917 1 3 %oparray_pop 1803 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push
Dictionary stack:
--dict:1183/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)--
Current allocation mode is local
Current file position is 1
GPL Ghostscript 9.14: Unrecoverable error, exit code 1
convert.im6: Postscript delegate failed `NoSilverBullet.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/677.
convert.im6: no images defined `a.png' @ error/convert.c/ConvertImageCommand/3044.
on ghostscript download page (
http://pkgs.org/download/ghostscript), the last version I can see for ubuntu is 9.14. Maybe there is no 9.15 on ubuntu? Or the odd number means a development version?
Re: Can't convert pdf to png :(
Posted: 2015-03-08T07:57:56-07:00
by snibgo
Perhaps someone on Unix, and GS 9.14, can try ths out. Sorry, I know nothing about GS versions. Ubuntu distros often seem old (at least they are for ImageMagick), so GS's homepage might be more fruitful.
You might also check "-verbose", to see if IM is giving weird arguments to GS. I get:
Code: Select all
convert -verbose NoSilverBullet.pdf nsb.png
[ghostscript library] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitma
p=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=
4 -dGraphicsAlphaBits=4 "-r72x72" "-sOutputFile=C:/Users/Alan/AppData/Local/Tem
p/magick-5860TLgbjeWtuNxT%d" "-fC:/Users/Alan/AppData/Local/Temp/magick-5860BNgn
9eYzHmS6" "-fC:/Users/Alan/AppData/Local/Temp/magick-5860IfCnsxJQKPFR"C:/Users/A
lan/AppData/Local/Temp/magick-5860TLgbjeWtuNxT1 PNG 612x792 612x792+0+0 8-bit sR
GB 64.3KB 0.000u 0:00.000
What version of IM are you on?
Re: Can't convert pdf to png :(
Posted: 2015-03-08T08:19:47-07:00
by fotanus
Hi there,
Thanks for helping me! Don't worry if you can't reproduce my stuff. I'm sure I (or someone) will find out how to solve this, just need more time.
My imagemagick version is older than yours:
Code: Select all
Version: ImageMagick 6.7.7-10 2014-08-21 Q16 http://www.imagemagick.org
but I can see with the verbose that the command is quite similar to yours:
Code: Select all
$ convert -verbose NoSilverBullet.pdf nsb.png
"gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" "-sOutputFile=/tmp/magick-c0lPHvvV-%08d" "-f/tmp/magick-la8Y9r0A" "-f/tmp/magick-L5fqTtvg"
Should this be a problem on ghostscript or it might be image magick and it is worth trying to compile the 6.9?
Re: Can't convert pdf to png :(
Posted: 2015-03-08T08:32:54-07:00
by fotanus
I did it. It happens that for some reason, my PDF had 0 bytes. I should have uploaded a pdf in other folder or something. So I just messed all this up. Terrible sorry
And thanks for the help!
Re: Can't convert pdf to png :(
Posted: 2015-03-08T09:29:34-07:00
by snibgo
fotanus wrote:my PDF had 0 bytes
Tee hee, that's the best laugh I've had all day!
It happens to us all. Glad you are sorted.