问题
I'm trying to get our server to convert PDFs to image files. It's a CentOS 5.3 system and the latest version of ghostscript that can be (8.70), has been installed.
When I try to convert a PDF I get the following error repeated for each page, and the result is a load of blank images.
**** ERROR: Unable to process JPXDecode data. Page will be missing data.
So, I found an answer on here that seemed to answer that question:
iText PDF; howto convert jpeg2000 to jpg using Java
Following that I downloaded iText 5.3.4 and jai_imageio-1.1.jar and compiled the supplied script on my local machine. When I run the final conversion command on my PDF I get:
java.lang.NullPointerException
at com.itextpdf.text.pdf.parser.PdfImageObject.decodeImageBytes(PdfImageObject.java:296)
at com.itextpdf.text.pdf.parser.PdfImageObject.<init>(PdfImageObject.java:199)
at com.itextpdf.text.pdf.parser.PdfImageObject.<init>(PdfImageObject.java:158)
at PDFConverter.hasJpeg2000(PDFConverter.java:36)
at PDFConverter.main(PDFConverter.java:15)
Doesn't contain any JPEG2000 images: Nothing to be done...
I'm not sure whether that's definitely saying that the PDF doesn't have any JPEG2000 images, or whether I've done something wrong when I compiled the script. Perhaps I've got the wrong version of iText since no links were provided in the answer to that other question.
So now I either need help to convert my PDFs to remove any JPEG2000 images, or I need help to get our server running ghostscript properly.
来源:https://stackoverflow.com/questions/13728500/ghostscript-on-centos-5-3-unable-to-process-jpxdecode-data