ICEpdf
  1. ICEpdf
  2. PDF-639

Edited annotation contents streams can not be restored after garbage collection

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.3
    • Fix Version/s: 5.0.4
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      any

      Description

      Imagine a PDF with one annotations on the first page. A user edits this annotation in some way and goes on to other pages. When the user returns to the first page the annotation is no longer visible, only the bounding box can be scene.

        

        Activity

        Hide
        Patrick Corless added a comment -

        Took a bit of time to figure out what was going on here but I've got a handle on it now. When the annotation is edited the Form object that hold the appearance content stream is created and put in the Statemanager. The Form object's raw data is set at this point, normally this stream is saved to disk on save and is compressed using zip compression.

        But in the user case above the annotation is garbage collected and when the first page is reloaded the annotation in question's appearance stream Form object is reinitialized. The problem here is that the underlying stream Object assumes the raw data is compressed where in fact it is not. The content parser then returns -1 on the first read and no shapes are parsed thus no shapes are painted.

        The stream class already has a isCompressed flag which can be used during the decode process to determine if the stream needs to be uncompressed or not. So in the usage case above we won't try to uncompress a data stream that is already uncompressed and thus the shapes no get parsed.

        Show
        Patrick Corless added a comment - Took a bit of time to figure out what was going on here but I've got a handle on it now. When the annotation is edited the Form object that hold the appearance content stream is created and put in the Statemanager. The Form object's raw data is set at this point, normally this stream is saved to disk on save and is compressed using zip compression. But in the user case above the annotation is garbage collected and when the first page is reloaded the annotation in question's appearance stream Form object is reinitialized. The problem here is that the underlying stream Object assumes the raw data is compressed where in fact it is not. The content parser then returns -1 on the first read and no shapes are parsed thus no shapes are painted. The stream class already has a isCompressed flag which can be used during the decode process to determine if the stream needs to be uncompressed or not. So in the usage case above we won't try to uncompress a data stream that is already uncompressed and thus the shapes no get parsed.
        Hide
        Patrick Corless added a comment -

        Issue has been fixed on trunk and 5.0.1 branch.

        Show
        Patrick Corless added a comment - Issue has been fixed on trunk and 5.0.1 branch.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: