Reputation: 23
We have ghostscript setup on our server to convert a PDF into separate TIFF images when it is uploaded. It's works perfectly most of the time, however sometimes it fails. I have managed to solve this on a per PDF basis by opening the problem PDF and saving it in Acrobat as an 'Optimized PDF' and specifically with JUST these two attributes checked:
'Discard unreferenced named destinations' (in Clean Up)
'Optimize page content' (in Clean Up)
(nothing else has been checked in any section, just these two)
My question is, is there a way to have ghostscript do what I am having to currently do?
The reason I need ghostscript to do this is because it has to be fully automated so users can upload a pdf and it gets converted into images.
If it helps, here are the ghostscript settings we are using:
-dQUIET
-dSAFER
-dBATCH
-dNOPAUSE
-dNOPROMPT
-sDEVICE=tiff24nc
-dUseCIEColor
-dTextAlphaBits=4
-dGraphicsAlphaBits=4
-dEPSCrop
Many thanks,
Pat
Upvotes: 0
Views: 2164
Reputation: 2765
some times ghostscript fails in opening files due to XREF table corruption
try to repair problematic pdf with
pdftk
pdftk file.pdf output fixed.pdf
if pdftk is able to repair pdf file, then a shellscript can be made with an
if...then..else
statement (if pdf file causes ghostscript failing, then it will be automatically repaired by pdftk and then resubmitted to ghostscript)
apart all; you need to learn to READ ERROR OUTPUT, since in error output are almost the 99% of times contained the explanations of error
Upvotes: 2