Details
-
Type: Bug
-
Status: Closed
-
Priority: 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.
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.