pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Volker S. (JIRA)" <j...@apache.org>
Subject [jira] [Created] (PDFBOX-4464) PDFRenderer ColorConverterOp Error
Date Thu, 14 Feb 2019 07:07:00 GMT
Volker S. created PDFBOX-4464:
---------------------------------

             Summary: PDFRenderer ColorConverterOp Error
                 Key: PDFBOX-4464
                 URL: https://issues.apache.org/jira/browse/PDFBOX-4464
             Project: PDFBox
          Issue Type: Bug
          Components: Rendering
    Affects Versions: 2.0.13
            Reporter: Volker S.
         Attachments: BrokenPage.pdf

I was trying the PDFRenderer.renderImageWithDPI function which worked well with a lot of documents,
but on the attached document I get this error:

java.lang.IllegalArgumentException: Numbers of source Raster bands and source color space
components do not match
 at java.awt.image.ColorConvertOp.filter(Unknown Source)
 at com.sun.imageio.plugins.jpeg.JPEGImageReader.acceptPixels(Unknown Source)
 at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage(Native Method)
 at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(Unknown Source)
 at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(Unknown Source)
 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:729)
 at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.from8bit(SampledImageReader.java:367)
 at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.getRGBImage(SampledImageReader.java:225)
 at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:443)
 at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:424)
 at org.apache.pdfbox.rendering.PageDrawer.drawImage(PageDrawer.java:1034)
 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:254)
 at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:245)
 at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:179)
 at homedms.HomeDMS.createThumbs(HomeDMS.java:23)
 at homedms.HomeDMS.main(HomeDMS.java:36)

 
{code:java}
public static void createThumbs(String filename) throws InvalidPasswordException, IOException
{
 File filein=new File(filename+".pdf");
 PDDocument doc = PDDocument.load(filein);
 PDFRenderer rend=new PDFRenderer(doc);
 for(int i=0;i<doc.getNumberOfPages();i++) {
  System.out.println(i);
  BufferedImage img=rend.renderImageWithDPI(i,32,ImageType.GRAY);
  File fileout=new File(filename+"_"+i+".png");
  ImageIO.write(img, "PNG", fileout);
 }
 doc.close();
}{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Mime
View raw message