ICEpdf
  1. ICEpdf
  2. PDF-230

RuntimeException: Invalid code encountered. exception thrown when displaying PDF

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 4.1.1
    • Fix Version/s: 4.1.3
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      All

      Description

      The following exception is thrown when trying to display PDF:

      Nov 23, 2010 11:14:23 AM org.icepdf.core.pobjects.Resources getImage
      FINE: Error getting image by name: I1
      java.lang.RuntimeException: Invalid code encountered.
              at org.icepdf.core.pobjects.filters.CCITTFaxDecoder.decodeNextScanline(CCITTFaxDecoder.java:704)
              at org.icepdf.core.pobjects.filters.CCITTFaxDecoder.decodeT41D(CCITTFaxDecoder.java:822)
              at org.icepdf.core.pobjects.Stream.ccittFaxDecode(Stream.java:1675)
              at org.icepdf.core.pobjects.Stream.getImage(Stream.java:1966)
              at org.icepdf.core.pobjects.Stream.getImage(Stream.java:1854)
              at org.icepdf.core.pobjects.Resources.getImage(Resources.java:261)
              at org.icepdf.core.util.ContentParser.parse(ContentParser.java:477)
              at org.icepdf.core.pobjects.Page.init(Page.java:369)
              at org.icepdf.core.views.swing.PageViewComponentImpl$PageInitilizer.run(PageViewComponentImpl.java:1088)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
              at java.lang.Thread.run(Thread.java:619)

      This is thrown for each image in the pdf. The images are not shown on the page or they are shown in black.
      1. blackPdf.pdf
        2.42 MB
        Arran Mccullough
      2. Case9586-pdf-logs.txt
        24 kB
        Arran Mccullough
      3. PDF-230__work_around_for_Itext_5_03_k_enocoding_issue_.patch
        2 kB
        Patrick Corless

        Activity

        Hide
        Patrick Corless added a comment -

        I was able to reproduce the error message. For some reason IText isn't putting in decode param for the CCITTFax image. By default the k=0 which specifies a T4 1D fax format. However the image streams appears to be encode using k = -1 which T6 encoding.

        I'm going to attach a patch that addresses the issue in that it get the PDF to render. Before the next release I'll take another look as there maybe a image header that we can use to figure out the k value more reliably.

        Show
        Patrick Corless added a comment - I was able to reproduce the error message. For some reason IText isn't putting in decode param for the CCITTFax image. By default the k=0 which specifies a T4 1D fax format. However the image streams appears to be encode using k = -1 which T6 encoding. I'm going to attach a patch that addresses the issue in that it get the PDF to render. Before the next release I'll take another look as there maybe a image header that we can use to figure out the k value more reliably.
        Hide
        Patrick Corless added a comment -

        Patch to get around the missing k value.

        Show
        Patrick Corless added a comment - Patch to get around the missing k value.
        Hide
        Patrick Corless added a comment -

        Closing duplicate of PDF-249.

        Show
        Patrick Corless added a comment - Closing duplicate of PDF-249 .

          People

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

            Dates

            • Created:
              Updated:
              Resolved: