简体   繁体   中英

How to display an existing pdf annotation using ios pdfkit

I have a pdf with popup text annotations that I want to display by tapping on the annotation icon or the area where an annotation is

Having watched the 2017 wwdc pdfkit presentation it seems this should be possible. I can add new annotations to the document and remove them, and can read properties (text, colour, rect) from the existing annotation to create a new annotation

I've tried changing many properties in the annotation object eg isOpen, shouldDisplay, buttonWidgetState followed by pdfView.annotationsChanged(on: currPage) but nothing happens.

It seems bizarre that I can access the PDFAnnotation object to get its properties but there isn't a simple method or flag to display it.. I must be missing something! if anyone can help that would be much appreciated :)

It doesn't seem possible to toggle whether an existing popup annotation is displayed through pdfkit. I tested a few documents with popup annotations in the iOS Books app etc and they weren't displayed there either.

My solution was to create a new popup annotation when tapped on, then remove it when tapped anywhere else, just one popup at a time. This way I got the text, colour and approximate location of the original popup annotation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM