Tilman Hausherr created PDFBOX-2267:
---------------------------------------

             Summary: IOException and partial rendering and colorspace creation 
error
                 Key: PDFBOX-2267
                 URL: https://issues.apache.org/jira/browse/PDFBOX-2267
             Project: PDFBox
          Issue Type: Bug
          Components: Parsing, Rendering
    Affects Versions: 1.8.6, 1.8.7, 2.0.0
            Reporter: Tilman Hausherr
            Assignee: Tilman Hausherr
             Fix For: 1.8.7, 2.0.0


I get this exception with the attached PDF, and the upper arc of the image is 
not rendered:
{code}
java.io.IOException: Unknown colorspace 
type:COSDictionary{(COSName{BlackPoint}:COSArray{[COSFloat{0.0}, COSFloat{0.0}, 
COSFloat{0.0}]}) (COSName{Range}:COSArray{[COSFloat{-128.0}, COSFloat{127.0}, 
COSFloat{-128.0}, COSFloat{127.0}]}) 
(COSName{WhitePoint}:COSArray{[COSFloat{0.964203}, COSFloat{1.0}, 
COSFloat{0.824905}]}) }
        at 
org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:159)
        at 
org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:78)
        at 
org.apache.pdfbox.pdmodel.graphics.color.PDColorSpaceFactory.createColorSpace(PDColorSpaceFactory.java:62)
        at 
org.apache.pdfbox.pdmodel.graphics.color.PDICCBased.getAlternateColorSpaces(PDICCBased.java:291)
        at 
org.apache.pdfbox.pdmodel.graphics.color.PDICCBased.createColorSpace(PDICCBased.java:154)
        at 
org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getJavaColorSpace(PDColorSpace.java:85)
        at 
org.apache.pdfbox.pdmodel.graphics.color.PDDeviceN.createColorSpace(PDDeviceN.java:124)
        at 
org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getJavaColorSpace(PDColorSpace.java:85)
{code}
There are several causes: (1) in PDICCBased.createColorSpace() the variable 
numberOfComponents is -1; (2) the exception is not caught correctly. Both are 
fixed in the 2.0 version but not in the 1.8 version. Because the exception 
isn't caught correctly, the alternate color space is to be used. (3) The 
implementation of getAlternateColorSpaces() (that part existed before it became 
an apache project) thinks that this is an array of colorspaces.This
{code}
[/Lab<</BlackPoint[0.0 0.0 0.0]/Range[-128.0 127.0 -128.0 
127.0]/WhitePoint[0.964203 1.0 0.824905]>>]
{code}
is considered an array of two colorspaces. This is contrary to the spec, which 
mentions "An alternate colour space". I will fix the bug without changing the 
API in 1.8, but will change the API in 2.0, which will be
{code}
public PDColorSpace getAlternateColorSpace() throws IOException
{code}
instead of
{code}
public List<PDColorSpace> getAlternateColorSpaces() throws IOException
{code}




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to