Broken PDF files : inconsistent error message ?
Posted: 2011-03-25T08:17:52-07:00
Hello !
I have searched for an answer to my issue on the forum but no avail, so here goes :
When loading a "broken" / malformed PDF file and trying to convert its first page to an image, I get the following (very common) error message :
Postscript delegate failed `blah.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/638
I'm using MagickWand's MagickReadImage function, but when I simply try the same thing with the commandline, I get the following :
The question is : Would it be possible to return a more specific error message saying that the PDF file is broken/malformed ? I see that convert.exe outputs some text regarding the incorrect data check and so on, while the MagickReadImage fails and subsequent call to MagickGetException returns only the "no such file or directory", which is not true since the file is there !
Is there any other way to detect this maybe? any clues ?
Here is a link to the test file : http://fs.istratov.be/blah.pdf
Thanks !
I have searched for an answer to my issue on the forum but no avail, so here goes :
When loading a "broken" / malformed PDF file and trying to convert its first page to an image, I get the following (very common) error message :
Postscript delegate failed `blah.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/638
I'm using MagickWand's MagickReadImage function, but when I simply try the same thing with the commandline, I get the following :
Code: Select all
D:\>convert blah.pdf[0] test.jpg
warning: ignoring zlib error: incorrect data check
**** Warning: An error occurred while reading an XREF table.
**** The file has been damaged. This may have been caused
**** by a problem while converting or transfering the file.
**** Ghostscript will attempt to recover the data.
Error: /nocurrentpoint in --curveto--
Operand stack:
--nostringval-- --dict:9/18(L)-- 73.55 0 0 72.7 70.8 698.42
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-
- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- fa
lse 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--
--nostringval-- --nostringval-- %array_continue --nostringval-- false
1 %stopped_push --nostringval-- %loop_continue
Dictionary stack:
--dict:1158/1684(ro)(G)-- --dict:1/20(G)-- --dict:74/200(L)-- --dict:74
/200(L)-- --dict:106/127(ro)(G)-- --dict:278/300(ro)(G)-- --dict:24/25(L)-
- --dict:4/6(L)-- --dict:21/40(L)-- --dict:1/1(ro)(G)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 8.64: Unrecoverable error, exit code 1
convert: `%s': %s "C:/Program Files/gs/gs8.64/bin/gswin32c.exe" -q -dQUIET -dPAR
ANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignT
oPixels=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=
4 "-r72x72" -dFirstPage=1 -dLastPage=1 "-sOutputFile=C:/DOCUME~1/ALEXAN~1.IST/LO
CALS~1/Temp/magick-VQ08axuz" "-fC:/DOCUME~1/ALEXAN~1.IST/LOCALS~1/Temp/magick-Gw
aQSEno" "-fC:/DOCUME~1/ALEXAN~1.IST/LOCALS~1/Temp/magick-6Feyqw9T" @ error/pdf.c
/InvokePDFDelegate/197.
convert: Postscript delegate failed `blah.pdf': No such f
ile or directory @ error/pdf.c/ReadPDFImage/638.
convert: missing an image filename `test.jpg' @ error/convert.c/ConvertImageComm
and/2919.
Is there any other way to detect this maybe? any clues ?
Here is a link to the test file : http://fs.istratov.be/blah.pdf
Thanks !