Q:
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?
A:
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:
https://www.pdftron.com/pdfnet/docs/PDFNet/html/M_pdftron_PDF_Annots_Markup_GetOpacity.htm