Skip to main content
Boris56
Known Participant
February 21, 2020
Answered

How to find Popup annotation

  • February 21, 2020
  • 1 reply
  • 1037 views

Hi,

I am creating a Highlight annotation. When you create this annotation automatically, as written in the documentation, an annotation of the Popup type is created. At some point, I need to delete the created annotation. In this case, I would like to delete the Popup annotation associated with the Highlight annotation. The documentation says that Highlight annotation is the parent of Popup annotations. How to find Popup annotation associated with her Highlight annotation?
Thanks

This topic has been closed for replies.
Correct answer Thom Parker

Convert the pdAnnot into a CosDict Object, then get the Popup Property. This can then be converted into a PDAnnot.

 

PDAnnotGetCosObj()

PDAnnotFromCosObj()

 

Do you have PDFCanOpener? This tool will be a huge help.

http://www.windjack.com/product/pdfcanopener/

 

1 reply

Thom Parker
Community Expert
Community Expert
February 21, 2020

All anotations have a "Popup" property in the annotation dict. This is an indirect reference to Popup annotation.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Boris56
Boris56Author
Known Participant
February 24, 2020

I have PDAnnot pdAnnot = PDPageGetAnnot (pdPage, i);
How can I get the "Popup" property in the annotation dict?
I did not find this in the API?

Boris56
Boris56Author
Known Participant
February 26, 2020

Convert the pdAnnot into a CosDict Object, then get the Popup Property. This can then be converted into a PDAnnot.

 

PDAnnotGetCosObj()

PDAnnotFromCosObj()

 

Do you have PDFCanOpener? This tool will be a huge help.

http://www.windjack.com/product/pdfcanopener/

 


Thanks. Everything worked out. True, I had to figure out how to get the Popup Property.
Just in case, I will give all code. Perhaps someone will come in handy.

CosObj cosObj = PDAnnotGetCosObj(pdAnnot);
CosObj cosObj1 = CosDictGet(cosObj, ASAtomFromString("Popup"));
PDAnnot pdAnnot1 = PDAnnotFromCosObj(cosObj1);