[ https://issues.apache.org/jira/browse/PDFBOX-1094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14099652#comment-14099652 ]
Tilman Hausherr edited comment on PDFBOX-1094 at 8/16/14 2:39 PM: ------------------------------------------------------------------ Page 3 of the attached file PDFBOX-1094-094730.pdf has this exception: {code} java.lang.IllegalArgumentException: Width (0) and height (0) must be > 0 at java.awt.image.SampleModel.<init>(SampleModel.java:126) at java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:146) at java.awt.image.PixelInterleavedSampleModel.<init>(PixelInterleavedSampleModel.java:87) at java.awt.image.Raster.createInterleavedRaster(Raster.java:641) at java.awt.image.Raster.createInterleavedRaster(Raster.java:278) at java.awt.image.Raster.createInterleavedRaster(Raster.java:212) at java.awt.image.ComponentColorModel.createCompatibleWritableRaster(ComponentColorModel.java:2825) at org.apache.pdfbox.pdmodel.graphics.pattern.TilingPaint.getImage(TilingPaint.java:146) at org.apache.pdfbox.pdmodel.graphics.pattern.TilingPaint.<init>(TilingPaint.java:65) at org.apache.pdfbox.pdmodel.graphics.color.PDPattern.toPaint(PDPattern.java:123) {code} The reason is that the file has negative XStep and YStep values (which is not illegal), and has floating point values (which is not illegal either, see previous commit). Somehow there's an empty rectangle created in getTransformedRect(), at.createTransformedShape(rect).getBounds2D() does not work properly, my next commit will fix that by using a different method to transform the rectangle. To show what happens, here's a trace that has both the correct and the incorrect result: {code} TilingPaint:111 - rect: java.awt.geom.Rectangle2D$Float[x=9.68399,y=1.0,w=71.60701,h=-71.606] TilingPaint:114 - p1: Point2D.Float[9.68399, 1.0] TilingPaint:115 - p2: Point2D.Float[81.291, -70.606] TilingPaint:118 - p1: Point2D.Float[-3928.4414, 4268.207] TilingPaint:119 - p2: Point2D.Float[-3892.638, 4232.404] TilingPaint:120 - at: AffineTransform[[0.5, 0.0, -3933.283447265625], [0.0, 0.5, 4267.70703125]] TilingPaint:122 - transformed rectangle: java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=0.0,h=0.0] TilingPaint:130 - created rectangle: java.awt.geom.Rectangle2D$Float[x=-3928.4414,y=4232.404,w=35.803467,h=35.803223] {code} "transformed rectangle" is the old method, "created rectangle" is the new method. (The translation in that matrix likely isn't correct, the rendering isn't correct yet (amusingly another product has the same wrong rendering!), that is another thing to search for) was (Author: tilman): Page 3 of the attached file PDFBOX-1094-094730.pdf has this exception: {code} java.lang.IllegalArgumentException: Width (0) and height (0) must be > 0 at java.awt.image.SampleModel.<init>(SampleModel.java:126) at java.awt.image.ComponentSampleModel.<init>(ComponentSampleModel.java:146) at java.awt.image.PixelInterleavedSampleModel.<init>(PixelInterleavedSampleModel.java:87) at java.awt.image.Raster.createInterleavedRaster(Raster.java:641) at java.awt.image.Raster.createInterleavedRaster(Raster.java:278) at java.awt.image.Raster.createInterleavedRaster(Raster.java:212) at java.awt.image.ComponentColorModel.createCompatibleWritableRaster(ComponentColorModel.java:2825) at org.apache.pdfbox.pdmodel.graphics.pattern.TilingPaint.getImage(TilingPaint.java:146) at org.apache.pdfbox.pdmodel.graphics.pattern.TilingPaint.<init>(TilingPaint.java:65) at org.apache.pdfbox.pdmodel.graphics.color.PDPattern.toPaint(PDPattern.java:123) {code} The reason is that the file has negative XStep and YStep values (which is not illegal), and has floating point values (which is not illegal either, see previous commit). Somehow there's an empty rectangle created in getTransformedRect(), at.createTransformedShape(rect).getBounds2D() does not work properly, my next commit will fix that by using a different method to transform the rectangle. > Pattern colorspace support > -------------------------- > > Key: PDFBOX-1094 > URL: https://issues.apache.org/jira/browse/PDFBOX-1094 > Project: PDFBox > Issue Type: Improvement > Components: Rendering > Affects Versions: 1.6.0 > Reporter: Andreas Lehmkühler > Assignee: Andreas Lehmkühler > Priority: Minor > Attachments: ColoredTilingPaint.patch, PATTYP1.pdf, PATTYP2.pdf, > PDF32000_2008_pg737.pdf, PDFBOX-1094-065514-XStep32767.pdf, > PDFBOX-1094-094730.pdf, PDFStreamEngine.patch, PageDrawer.patch, > _pdfbox-1094-tiling_pattern.pdf-1-blurry.png, jagpdf_doc_patterns.pdf, > jagpdf_doc_patterns.pdf-1.png, pdfbox-1094-pdf32000_2008_pg737.pdf-1.png, > pdfbox-1094-pdf32000_2008_pg737.pdf-1.png, > pdfbox-1094-tiling_pattern.pdf-1.png, pdfbox-1094-tiling_pattern.pdf-1.png, > pdfbox-1094-tiling_pattern.pdf-1.png, pdfbox-1861-tracemonkey.pdf-13.png, > pdfbox-1861-tracemonkey.pdf-13.png, tiling_pattern.pdf > > > PDFBox doesn't support PDPattern colorspaces -- This message was sent by Atlassian JIRA (v6.2#6252)