I tested PDFHandler shipped with MW 1.23.6 and using it on corrupted PDF files it will fail image creation. The reason is gs
prints out warning messages to stdout and this gets processed by convert
and fails of course.
#!/bin/bash
# get pdf
wget "http://www.dgfm-ev.de/sites/default/files/Geschichte%20S%C3%BCmpiossomo%20korrigiert%20gr%C3%B6%C3%9Fere%20Datei.pdf" --output-document="testfile.pdf"
# process by gs
gs -sDEVICE=jpeg -sOutputFile=testfile.jpg -dFirstPage=1 -dLastPage=1 -r150 -dBATCH -dNOPAUSE -q 'testfile.pdf'
**** Warning: glyf overlaps cmap, truncating. **** Warning: glyf overlaps cmap, truncating. **** Warning: glyf overlaps cmap, truncating. **** Warning: glyf overlaps cmap, truncating. **** Warning: glyf overlaps cmap, truncating.
# try to reroute the downloaded 'testfile.pdf' directly to post processing hence does not work:
gs -sDEVICE=jpeg -sOutputFile=- -dFirstPage=1 -dLastPage=1 -r150 -dBATCH -dNOPAUSE -q 'testfile.pdf' 2>&1 | /usr/bin/convert -depth 8 -resize 800 - testfile-post-processed.jpg
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. convert: no images defined `testfile-post-processed.jpg' @ error/convert.c/ConvertImageCommand/3210
See also http://bugs.ghostscript.com/show_bug.cgi?id=695600#c3.
So there is no other solution than write an intermediary file. So my feature request is to use an intermediary file, and not redirecting the output.
Tanks a lot!