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

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.0.10
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Issue when converting PDF to image

      To respect privacy of the owner and my company policy I'm not allowed to send the PDF in public. If you need the document please give me an email address on which I can send the document.

      Error :

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

      Code :

      List<BufferedImage> lo_result = new ArrayList<>();
      PDFRenderer lo_renderer = new PDFRenderer(lo_document);
      for (int i = 0; i < lo_document.getNumberOfPages(); ++i)
             lo_result.add(lo_renderer.renderImageWithDPI(i, 300, ImageType.RGB));

      Stacktrace :

      [7/3/18 8:06:46:662 CEST] 00000170 SystemErr     R java.lang.IllegalArgumentException: Numbers of source Raster bands and source color space components do not match
      [7/3/18 8:06:46:663 CEST] 00000170 SystemErr     R     at java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:493)
      [7/3/18 8:06:46:663 CEST] 00000170 SystemErr     R     at com.sun.imageio.plugins.jpeg.JPEGImageReader.acceptPixels(JPEGImageReader.java:1292)
      [7/3/18 8:06:46:663 CEST] 00000170 SystemErr     R     at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage(Native Method)
      [7/3/18 8:06:46:663 CEST] 00000170 SystemErr     R     at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1259)
      [7/3/18 8:06:46:663 CEST] 00000170 SystemErr     R     at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1062)
      [7/3/18 8:06:46:663 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.filter.DCTFilter.decode(DCTFilter.java:91)
      [7/3/18 8:06:46:664 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.cos.COSInputStream.create(COSInputStream.java:77)
      [7/3/18 8:06:46:664 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:175)
      [7/3/18 8:06:46:664 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.pdmodel.common.PDStream.createInputStream(PDStream.java:241)
      [7/3/18 8:06:46:664 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createInputStream(PDImageXObject.java:701)
      [7/3/18 8:06:46:664 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.from8bit(SampledImageReader.java:367)java.lang.IllegalArgumentException: Numbers of source Raster bands and source color space components do not match
      [7/3/18 8:06:46:664 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.getRGBImage(SampledImageReader.java:225)
      [7/3/18 8:06:46:664 CEST] 00000170 SystemErr     R
      [7/3/18 8:06:46:664 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:443)
      [7/3/18 8:06:46:664 CEST] 00000171 SystemErr     R     at java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:493)    at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:424)
      [7/3/18 8:06:46:664 CEST] 00000171 SystemErr     R     at com.sun.imageio.plugins.jpeg.JPEGImageReader.acceptPixels(JPEGImageReader.java:1292)
      [7/3/18 8:06:46:665 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.rendering.PageDrawer.drawImage(PageDrawer.java:1046)
      [7/3/18 8:06:46:665 CEST] 00000171 SystemErr     R     at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage(Native Method)
      [7/3/18 8:06:46:665 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:62)
      [7/3/18 8:06:46:665 CEST] 00000171 SystemErr     R     at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1259)
      [7/3/18 8:06:46:665 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:848)
      [7/3/18 8:06:46:665 CEST] 00000171 SystemErr     R     at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1062)
      [7/3/18 8:06:46:665 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:503)
      [7/3/18 8:06:46:665 CEST] 00000171 SystemErr     R     at org.apache.pdfbox.filter.DCTFilter.decode(DCTFilter.java:91)
      [7/3/18 8:06:46:665 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:477)
      [7/3/18 8:06:46:665 CEST] 00000171 SystemErr     R     at org.apache.pdfbox.cos.COSInputStream.create(COSInputStream.java:77)
      [7/3/18 8:06:46:665 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:150)
      [7/3/18 8:06:46:665 CEST] 00000171 SystemErr     R     at org.apache.pdfbox.cos.COSStream.createInputStream(COSStream.java:175)
      [7/3/18 8:06:46:665 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:246)
      [7/3/18 8:06:46:666 CEST] 00000171 SystemErr     R     at org.apache.pdfbox.pdmodel.common.PDStream.createInputStream(PDStream.java:241)
      [7/3/18 8:06:46:666 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:225)
      [7/3/18 8:06:46:666 CEST] 00000171 SystemErr     R     at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createInputStream(PDImageXObject.java:701)
      [7/3/18 8:06:46:666 CEST] 00000170 SystemErr     R     at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:164)
      [7/3/18 8:06:46:666 CEST] 00000171 SystemErr     R     at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.from8bit(SampledImageReader.java:367)
      [7/3/18 8:06:46:666 CEST] 00000170 SystemErr     R     at be.ulg.segi.penelope.mypen.view.action.divers.files.FileManagementTools.toImages(FileManagementTools.java:125)
      [7/3/18 8:06:46:666 CEST] 00000171 SystemErr     R     at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.getRGBImage(SampledImageReader.java:225)

      Tried with ImageType.ARGB but did not help. Not setting the third parameter did not help neither.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                blacklord049 Vincent
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: