我有一些由未知源生成的文件,在PDF瀏覽器(Reader/Foxit)中打開得很好,但iText無法處理它們。對於特定的文件,我得到:如何處理iText「意外顏色空間/ CS0」類型的例外
Exception in thread "main" java.lang.IllegalArgumentException: Unexpected colorspace /CS0
at com.itextpdf.text.pdf.parser.InlineImageUtils.getComponentsPerPixel(InlineImageUtils.java:238)
at com.itextpdf.text.pdf.parser.InlineImageUtils.computeBytesPerRow(InlineImageUtils.java:251)
at com.itextpdf.text.pdf.parser.InlineImageUtils.parseUnfilteredSamples(InlineImageUtils.java:280)
at com.itextpdf.text.pdf.parser.InlineImageUtils.parseInlineImageSamples(InlineImageUtils.java:320)
at com.itextpdf.text.pdf.parser.InlineImageUtils.parseInlineImage(InlineImageUtils.java:153)
at com.itextpdf.text.pdf.parser.PdfContentStreamProcessor.processContent(PdfContentStreamProcessor.java:370)
at com.itextpdf.text.pdf.parser.PdfReaderContentParser.processContent(PdfReaderContentParser.java:79)
有時/ CS0顏色空間更改爲/ CS1到/ CS9(或類似的東西)。
它是一個iText錯誤(我正在使用java 1.7,iText 5.4.1)還是我的pdf文件被破壞?即使PDF文件被破壞,我有什麼辦法可以解決它們? (Adobe Reader似乎這樣做,但不幸的是打開文件並再次保存它不起作用)。
燦你共享這些文件之一? –
對不起,但我不能 - 我正在處理_very_大集pdf,不再記得哪些導致了問題(我解決了這個問題) – matt