Olivier Ceulemans created PDFBOX-1482:
-----------------------------------------

             Summary: Java color spaces returned by PDDeviceN doesn't take tint 
transformation into account and type mismatch
                 Key: PDFBOX-1482
                 URL: https://issues.apache.org/jira/browse/PDFBOX-1482
             Project: PDFBox
          Issue Type: Bug
          Components: PDModel
    Affects Versions: 1.8.0
         Environment: Mac OSX mountain lion, JDK 1.7
            Reporter: Olivier Ceulemans


A patch to fix this issue is provided. Be sure to review it... this is my first 
contribution.

I tried to solve jira issue PDFBOX-1058 (to contribute a bit) and tried to 
convert the file referenced in this ticket to images using standard utilities 
and I got lots of NullPointerExceptions.

1) These NPE occurs because the java color space returned by the PDDeviceN 
doesn't take the tint transformation function into account. When the toRGB 
method method of the color space (ColorSpaceCMYK for the pdf file linked to 
PDFBOX-1058) is called it returns null because the length of the array is not 
of the expected size. This occurs because the tint transformation function is 
not called. The provided patch fix this.

2) By debugging this, I also got CastException because I called 
get/setColorantName method that were declared to return list of COSBase. In 
reality they returned list of Strings. To avoid these kind of errors in the 
future, I also introduced generics in the COSArrayList data type. This is also 
provided in the patch.

The ticket PDFBOX-1058 is still not fully fixed by the patch. Colors still 
looks horrible on some parts. I'm working on it...
However, by applying the patch there is a clear quality improvement (xerox logo 
on the upper left part of the first page and wave effect in the middle of the 
first page).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to