How can I retrieve the opacity of an annotation?


I’m setting a line annotation’s opacity using SetOpacity. Later, I grab the appearance stream from the line annotation, then get the gstate of the element of that appearance stream. But when I call GState.GetStrokeOpacity(), that value is wrong. Why?


It may be wrong because of a failure to call RefreshAppearance on the annotation. But, in general, it’s much more reliable to call GetOpacity for a Line annotation (or other Markup annotation) to retrieve the value set by SetOpacity: