Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-1482

Java color spaces returned by PDDeviceN do not take tint transformation into account and type mismatch

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.0
    • Fix Version/s: 1.8.0
    • Component/s: PDModel
    • Labels:
      None
    • Environment:
      Mac OSX mountain lion, JDK 1.7

      Description

      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).

        Attachments

        1. PDFBOX-1482.patch
          15 kB
          Olivier Ceulemans

          Activity

            People

            • Assignee:
              lehmi Andreas Lehmkühler
              Reporter:
              ceulemanso Olivier Ceulemans
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: