ICEpdf
  1. ICEpdf
  2. PDF-1030

Page rendered as blank - CCITT issue

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.1.2
    • Fix Version/s: 6.3
    • Component/s: Core/Rendering
    • Labels:
      None
    • Environment:
      All

      Description

      When trying to render a provided PDF file it is rendered as a blank white page. No errors in the logs but just the following:

      Sep 29, 2016 7:58:35 AM org.icepdf.core.util.content.NContentParser parse
      FINE: Parsing page content streams: 1
      Sep 29, 2016 7:58:35 AM org.icepdf.core.util.content.NContentParser parse
      Q
      Sep 29, 2016 7:58:35 AM org.icepdf.core.pobjects.filters.CCITTFax deriveBufferedImageFromTIFFBytes
      FINE: Decoding TIFF: TIFF_COMPRESSION_GROUP3_1D

      Another PDF was provided that the customer says shows the same issue but it looks to be rendering fine for me. There are some different logs when rendering that PDF:

      Sep 29, 2016 8:03:14 AM org.icepdf.core.util.content.NContentParser parse
      FINE: Parsing page content streams: 1
      Sep 29, 2016 8:03:14 AM org.icepdf.core.util.content.NContentParser parse
      FINER: Content = q
      578.16 0 0 824.40 0 0 cm
      /Im1 Do
      Q
      Sep 29, 2016 8:03:14 AM org.icepdf.core.pobjects.filters.CCITTFax <clinit>
      FINER: CCITTFaxDecode Image reader: com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader@1a6542
      Sep 29, 2016 8:03:15 AM org.icepdf.core.pobjects.filters.CCITTFax deriveBufferedImageFromTIFFBytes
      FINE: Decoding TIFF: TIFF_COMPRESSION_GROUP3_1D
      Sep 29, 2016 8:03:15 AM org.icepdf.core.pobjects.filters.CCITTFax deriveBufferedImageFromTIFFBytes
      FINER: Decoding TIFF: TIFF_COMPRESSION_GROUP3_1D failed trying alternative
      Sep 29, 2016 8:03:15 AM org.icepdf.core.pobjects.filters.CCITTFax deriveBufferedImageFromTIFFBytes
      FINE: Decoding TIFF: TIFF_COMPRESSION_GROUP3_2D

        Issue Links

          Activity

          Hide
          Patrick Corless added a comment -

          The file forces our CCITTFax filter to fail and as a result we fall back trying to decode the image using all the available ccittfax variations. We'll have to come back to this issue one we move over the 12 monkies imaging code base.

          Show
          Patrick Corless added a comment - The file forces our CCITTFax filter to fail and as a result we fall back trying to decode the image using all the available ccittfax variations. We'll have to come back to this issue one we move over the 12 monkies imaging code base.
          Hide
          Patrick Corless added a comment -

          I spent a half day looking at how we might integrate the library into the render core, we'll at least for CCITTFax processing. One of the strange things about the CCITTFax images that are embedded in PDF documents is that the image stream is generally just the data stream and as a result we have generate the correct TIFF header data and add it to the data stream. Once this is done the tiff data can be read by any one of the CCITTfax implementations.

          We have had good luck with the JAI implementation but we do have a few corner cases it can't handle and given the libraries licensing and closed source nature we are at a bit of dead end. The twelve monkeys library seems to offer similar functionality to JAI but similarly there are still a few corner cases which the library can't load. One additionally issue with twelve monkeys is that is depends on JDK 7 which is a problem for our JDK 5 library. JDK 7 dependency can be mitigated if we make the decoding calls via ImageIO allowing the dynamic loading of the the imaging libraries. On a side note any further work on our imaging library should probably also leverage the ImageIO architecture.

          From my experiments our org.icepdf.core.pobjects.filters.CCITTFax class would be the best place to integrated the ImageIO calls to load the twelve monkeys API for CCITTFax. Further analysis and testing is need for JPEG and TIFF support integration.

          Show
          Patrick Corless added a comment - I spent a half day looking at how we might integrate the library into the render core, we'll at least for CCITTFax processing. One of the strange things about the CCITTFax images that are embedded in PDF documents is that the image stream is generally just the data stream and as a result we have generate the correct TIFF header data and add it to the data stream. Once this is done the tiff data can be read by any one of the CCITTfax implementations. We have had good luck with the JAI implementation but we do have a few corner cases it can't handle and given the libraries licensing and closed source nature we are at a bit of dead end. The twelve monkeys library seems to offer similar functionality to JAI but similarly there are still a few corner cases which the library can't load. One additionally issue with twelve monkeys is that is depends on JDK 7 which is a problem for our JDK 5 library. JDK 7 dependency can be mitigated if we make the decoding calls via ImageIO allowing the dynamic loading of the the imaging libraries. On a side note any further work on our imaging library should probably also leverage the ImageIO architecture. From my experiments our org.icepdf.core.pobjects.filters.CCITTFax class would be the best place to integrated the ImageIO calls to load the twelve monkeys API for CCITTFax. Further analysis and testing is need for JPEG and TIFF support integration.
          Hide
          Patrick Corless added a comment -
           img = ImageIO.read(new MemoryCacheImageInputStream(in));

          or

           
                     TIFFImageReaderSpi SPI = new TIFFImageReaderSpi();
                     TIFFImageReader reader = SPI.createReaderInstance(null);
                     reader.setInput(new MemoryCacheImageInputStream(in));
          
          Show
          Patrick Corless added a comment - img = ImageIO.read( new MemoryCacheImageInputStream(in)); or TIFFImageReaderSpi SPI = new TIFFImageReaderSpi(); TIFFImageReader reader = SPI.createReaderInstance( null ); reader.setInput( new MemoryCacheImageInputStream(in));
          Hide
          Patrick Corless added a comment -

          Marking as fixed

          Show
          Patrick Corless added a comment - Marking as fixed

            People

            • Assignee:
              Patrick Corless
              Reporter:
              Arran Mccullough
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: