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
0
votes
How does it fail? Errors out? Fails to convert? produces garbage? I know older versions of ghostscript could not handle CMYK pdfs.
- Marc B
Which version of gs on which OS?
- Martin Schröder
The server is running ghostscript 8.70 on Linux. @ Marc, the PDF doesn't convert at all, i'm trying to get the error output so I can post it here.
- Patrick Begg
1 Answers
2
votes
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