ICEpdf
  1. ICEpdf
  2. PDF-308

Image color at top of page is incorrect

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.2.1
    • Fix Version/s: None
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      -
    • Workaround Exists:
      Yes
    • Workaround Description:
      JDK 1.5 can be used to void the colour space issue.

      Description

      The image at the top of the PDF is showing as blue instead of the correct color yellow. I also see the following exception but unsure whether it is relevant:

      FINE: Could not create instance oof font file 1
      java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at org.icepdf.core.pobjects.fonts.FontFactory.createFontFile(FontFactory.java:166)
      at org.icepdf.core.pobjects.fonts.FontDescriptor.init(FontDescriptor.java:322)
      at org.icepdf.core.pobjects.fonts.nfont.Font.init(Unknown Source)
      at org.icepdf.core.pobjects.Resources.getFont(Resources.java:240)
      at org.icepdf.core.util.ContentParser.consume_Tf(ContentParser.java:2056)
      at org.icepdf.core.util.ContentParser.parseText(ContentParser.java:1175)
              ........
              ........
      Caused by: java.lang.IllegalStateException
      at org.icepdf.core.pobjects.fonts.nfont.NFontType1.readDICT(Unknown Source)

      Screenshots and PDF attached.
      1. 10231.pdf
        124 kB
        Tyler Johnson
      1. PDF-308_screen.jpg
        48 kB

        Issue Links

          Activity

          Tyler Johnson created issue -
          Tyler Johnson made changes -
          Field Original Value New Value
          Attachment PDF-308_screen.jpg [ 13315 ]
          Tyler Johnson made changes -
          Attachment 10231.pdf [ 13316 ]
          Tyler Johnson made changes -
          Salesforce Case [5007000000GwknK]
          Hide
          Tyler Johnson added a comment -

          Note from the customer:

          I believe the issue is related to the fact that the images in the PDF are in the DeviceCMYK colorspace. I converted the document to sRGB, and this fixes the incorrect colors in the IcePDF rendered output, but has the negative side effect of degrading the quality of the images/colors. So although this hints at the problem, I don't think that converting the documents to RGB is a suitable workaround for us.

          Are there any options in the IcePDF API that might allow for working around this issue? I am calling document.getPageImage(...) to render the page, and then using ImageIO.write(image, "png", outStream), to write the image as a png.

          Show
          Tyler Johnson added a comment - Note from the customer: I believe the issue is related to the fact that the images in the PDF are in the DeviceCMYK colorspace. I converted the document to sRGB, and this fixes the incorrect colors in the IcePDF rendered output, but has the negative side effect of degrading the quality of the images/colors. So although this hints at the problem, I don't think that converting the documents to RGB is a suitable workaround for us. Are there any options in the IcePDF API that might allow for working around this issue? I am calling document.getPageImage(...) to render the page, and then using ImageIO.write(image, "png", outStream), to write the image as a png.
          Hide
          Patrick Corless added a comment -

          The font error is related related to an premature assert in the font library. The font renders correctly when adjusted (The 'I' character that starts the first content sentence).

          The other issue is related to PDF-276 which is the JDK 1.5/1.6 changes in how JPEG colours are handled. I spend quite a bit of time looking at the the headers of the image and and seem to find anything to dictate when to treat the image as rgba or bgra. Likely have ot take a closer look at Commons Sanselan library to see if it can help, it would also be good in that it would help remove our com.sun dependencies.

          For the time being the easiest work around is to use JDK 1.5.

          Show
          Patrick Corless added a comment - The font error is related related to an premature assert in the font library. The font renders correctly when adjusted (The 'I' character that starts the first content sentence). The other issue is related to PDF-276 which is the JDK 1.5/1.6 changes in how JPEG colours are handled. I spend quite a bit of time looking at the the headers of the image and and seem to find anything to dictate when to treat the image as rgba or bgra. Likely have ot take a closer look at Commons Sanselan library to see if it can help, it would also be good in that it would help remove our com.sun dependencies. For the time being the easiest work around is to use JDK 1.5.
          Patrick Corless made changes -
          Link This issue depends on PDF-276 [ PDF-276 ]
          Patrick Corless made changes -
          Workaround Description JDK 1.5 can be used to void the colour space issue.
          Workaround Exists [Yes]
          Hide
          Patrick Corless added a comment -

          It looks like the fix for PDF-276 has worked out for most users. Closing.

          Show
          Patrick Corless added a comment - It looks like the fix for PDF-276 has worked out for most users. Closing.
          Patrick Corless made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Patrick Corless made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Patrick Corless
              Reporter:
              Tyler Johnson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: