[ 
https://issues.apache.org/jira/browse/PDFBOX-3501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15496757#comment-15496757
 ] 

Tilman Hausherr commented on PDFBOX-3501:
-----------------------------------------

The javadoc of getNormalizedComponents warns about this: 
{quote}
An ArrayIndexOutOfBoundsException is thrown if pixel is not large enough to 
hold a pixel value for this ColorModel.
{quote}

In BlendComposite:

numSrcComponents: 4
numDstComponents: 1

the dstColorModel has numComponents = 3, but dstPixel and dstComponents are 
both byte arrays with len 1.

dstColorModel: IndexColorModel: #pixelBits = 1 numComponents = 3 color space = j
ava.awt.color.ICC_ColorSpace@3d8c7aca transparency = 1 transIndex   = -1 has alp
ha = false isAlphaPre = false

srcColorModel: DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=ff000000


The solution I did is temporary, but we no longer get an unchecked exception. 
The result b/w image is not good.

> java.lang.ArrayIndexOutOfBoundsException while converting PDF to TIFF
> ---------------------------------------------------------------------
>
>                 Key: PDFBOX-3501
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3501
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.2, 2.0.3, 2.1.0
>            Reporter: mark
>         Attachments: PdfToTiffConverter.java, error.pdf
>
>
> while using the PdfToTiffConverter i got an ArrayIndexOutOfBoundsException 
> for the attached error.pdf file
> Tested with Version 2.0.0 and 2.0.2
> Stacktrace:
>       java.lang.ArrayIndexOutOfBoundsException: 1
>       At: 
> java.awt.image.ColorModel.getNormalizedComponents(ColorModel.java:1197)
>       At: 
> java.awt.image.ColorModel.getNormalizedComponents(ColorModel.java:1439)
>       At: 
> org.apache.pdfbox.pdmodel.graphics.blend.BlendComposite$BlendCompositeContext.compose(BlendComposite.java:160)
>       At: sun.java2d.loops.Blit$AnyBlit.Blit(Blit.java:179)
>       At: sun.java2d.pipe.DrawImage.renderImageXform(DrawImage.java:546)
>       At: sun.java2d.pipe.DrawImage.transformImage(DrawImage.java:264)
>       At: sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:76)
>       At: sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:1014)
>       At: sun.java2d.pipe.ValidatePipe.copyImage(ValidatePipe.java:186)
>       At: sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3318)
>       At: sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3445)
>       At: 
> org.apache.pdfbox.rendering.PageDrawer.showTransparencyGroup(PageDrawer.java:1154)
>       At: 
> org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:66)
>       At: 
> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:815)
>       At: 
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:472)
>       At: 
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:446)
>       At: 
> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149)
>       At: org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:189)
>       At: 
> org.apache.pdfbox.rendering.PDFRenderer.renderPage(PDFRenderer.java:208)
>       At: 
> org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:139)
>       At: 
> org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:94)
>       At: 
> org.monitoring.system.util.PdfToTiffConverter.convertPdfToTiff(PdfToTiffConverter.java:71)
>       At: 
> org.monitoring.system.util.PdfToTiffConverter.convertPdfToTiff(PdfToTiffConverter.java:44)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to