Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4221

Numbers of source Raster bands and source color space components do not match

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.0.9
    • None
    • Rendering
    • None
    • Command-Line Tools: PDFToImage
    • Important

    Description

      When trying to convert from PDF to Image the attached example PDF Test_PDFToImage_IllegalArgumentException.pdf, the following exception is thrown:

      Exception in thread "main" java.lang.IllegalArgumentException: Numbers of source Raster bands and source color space components do not match
          at java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:482)
          at com.sun.imageio.plugins.jpeg.JPEGImageReader.acceptPixels(JPEGImageReader.java:1280)
          at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage(Native Method)
          at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1247)
          at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1050)
          at org.apache.pdfbox.filter.DCTFilter.decode(DCTFilter.java:91)
          at org.apache.pdfbox.cos.COSInputStream.create(COSInputStream.java:77)
          at org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:175)
          at org.apache.pdfbox.pdmodel.common.PDStream.createInputStream(PDStream.java:241)
          at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createInputStream(PDImageXObject.java:676)
          at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.from8bit(SampledImageReader.java:352)
          at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.getRGBImage(SampledImageReader.java:212)
          at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:421)
          at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:402)
          at org.apache.pdfbox.rendering.PageDrawer.drawImage(PageDrawer.java:1046)
          at org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:62)
          at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:848)
          at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:503)
          at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:477)
          at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:150)
          at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:246)
          at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:225)
          at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:164)
          at org.apache.pdfbox.tools.PDFToImage.main(PDFToImage.java:247)
          at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:89)

      The issue can be reproduced using the CmdLine Tools:

      java -jar pdfbox-app-2.0.9.jar PDFToImage -dpi 200 -color rgb -imageType png -time Test_PDFToImage_IllegalArgumentException.pdf
      

      Would be really great if you can look to this issue also.
      Thank you very much for your great work.

      Attachments

        1. Test_PDFToImage_IllegalArgumentException.pdf
          246 kB
          Silvan-Eugen Lincan

        Issue Links

          Activity

            People

              Unassigned Unassigned
              selincan-if Silvan-Eugen Lincan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: