PDFBox
  1. PDFBox
  2. PDFBOX-1128

Wrong color space used for DeviceN operator without color space specified

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6.0
    • Fix Version/s: 1.7.0
    • Component/s: PDModel, Swing GUI
    • Labels:
      None

      Description

      I have a PDF that uses a DeviceN color space, but when using the PDFToImage utility I noticed that some of the text comes out as cyan.

      I tracked the issue down to when the scn or SCN operator is used without setting the color space explicitly (ie using the current color space). I have attached a patch which resolves the issue by reinstating the original (DeviceN) color space after using the alternate color space, otherwise the alternate color space (in this case CMYK) was seen as the current color space and the attribute of 1 for the scn operator, which was meant for the DeviceN color space, is used in the CMYK color space resulting in the cyan.

      I have also attached an example PDF and the result for the PDFToImage conversion.

      1. DeviceN.patch
        3 kB
        Simon Maskell
      2. test4.pdf
        20 kB
        Simon Maskell
      3. test4.pdf-1.png
        13 kB
        Simon Maskell

        Activity

        Hide
        Andreas Lehmkühler added a comment -

        I fixed the issue in revision 1178412, but I didn't use Simons patch, as It was just a workaround. Separation-colorspaces had a similar issue, see PDFBOX-963 for further details.

        Thanks for the pointer and the detailed description, it made it easy for me to fix this issue !

        Show
        Andreas Lehmkühler added a comment - I fixed the issue in revision 1178412, but I didn't use Simons patch, as It was just a workaround. Separation-colorspaces had a similar issue, see PDFBOX-963 for further details. Thanks for the pointer and the detailed description, it made it easy for me to fix this issue !
        Hide
        Simon Maskell added a comment -

        That's great, thanks for the prompt response.

        Show
        Simon Maskell added a comment - That's great, thanks for the prompt response.
        Hide
        Daniel Wilson added a comment -

        I had hoped this would resolve some test failures I've seen recently, but it didn't resolve all of them.

        ARCHIVERGB is showing 2 problems:
        1. The stencil mask is missing completely
        2. Some of the letters are not being filled. I've seen this in other cases that I have not yet received permission to release ... a group of letters will have only the first filled with the fill color.

        Back in August, these items were working better ... so one of us made a mistake somewhere.

        If you prefer me to post a new issue, I certainly can.

        Show
        Daniel Wilson added a comment - I had hoped this would resolve some test failures I've seen recently, but it didn't resolve all of them. ARCHIVERGB is showing 2 problems: 1. The stencil mask is missing completely 2. Some of the letters are not being filled. I've seen this in other cases that I have not yet received permission to release ... a group of letters will have only the first filled with the fill color. Back in August, these items were working better ... so one of us made a mistake somewhere. If you prefer me to post a new issue, I certainly can.
        Hide
        Andreas Lehmkühler added a comment -

        Reopend as it was my bad. I already found the cause, but I've to clean up my code before comitting it.

        Show
        Andreas Lehmkühler added a comment - Reopend as it was my bad. I already found the cause, but I've to clean up my code before comitting it.
        Hide
        Andreas Lehmkühler added a comment -

        I guess I resolved the issue in revision 1182494.

        The stencil mask works better than before. Former PDFBox versions always used black as color for the stencil mask and now following the specs the non stroking color will be used

        There is one TODO left. The stencil mask creation is based on default values ([0,1]) for the DecodeArray. Does anyone have a sample using [1,0] as DecodeArray?

        Show
        Andreas Lehmkühler added a comment - I guess I resolved the issue in revision 1182494. The stencil mask works better than before. Former PDFBox versions always used black as color for the stencil mask and now following the specs the non stroking color will be used There is one TODO left. The stencil mask creation is based on default values ( [0,1] ) for the DecodeArray. Does anyone have a sample using [1,0] as DecodeArray?
        Hide
        Andreas Lehmkühler added a comment -

        I forgot to commit my changes on PDColorState. I made up for it in revision 1182584

        Show
        Andreas Lehmkühler added a comment - I forgot to commit my changes on PDColorState. I made up for it in revision 1182584
        Hide
        Daniel Wilson added a comment -

        The stencil mask looks lots better! Awesome!

        Show
        Daniel Wilson added a comment - The stencil mask looks lots better! Awesome!
        Hide
        Andreas Lehmkühler added a comment -

        @Daniel
        I assume that you don't have a sample for a [1,0] DecodeArray, have you? If not I'll set this issue to resolved. I added a TODO comment, so that we will (hopefully) find the relevant part of the source, if we'll get a suitable sample for that case in the future.

        Show
        Andreas Lehmkühler added a comment - @Daniel I assume that you don't have a sample for a [1,0] DecodeArray, have you? If not I'll set this issue to resolved. I added a TODO comment, so that we will (hopefully) find the relevant part of the source, if we'll get a suitable sample for that case in the future.
        Hide
        Daniel Wilson added a comment -

        Andreas,

        I'm afraid I don't have an example either. Sorry!

        Show
        Daniel Wilson added a comment - Andreas, I'm afraid I don't have an example either. Sorry!
        Hide
        Andreas Lehmkühler added a comment -

        I set this to resolved as the main issue is solved. I added a comment to the source pointing to the unsupported case.

        Show
        Andreas Lehmkühler added a comment - I set this to resolved as the main issue is solved. I added a comment to the source pointing to the unsupported case.

          People

          • Assignee:
            Andreas Lehmkühler
            Reporter:
            Simon Maskell
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development