Product: PDFtron Demo
Please give a brief summary of your issue:
→ How to get annotation from PTVectorAnnot
→ App is crashing if we access second time
Steps to reproduce:
→ Load given PDF and Merge XFDF also
→ call below function and app will crash on last line.
//Iterate loop over all pages to get all annotations
var TotalAnnotoations = [PTAnnot]()
(1...documentController.pdfViewCtrl.pageCount).forEach({index in
let annotations = documentController.pdfViewCtrl.getAnnotationsOnPage(index).filter({ $0.isValid() && $0.isMarkup()})
TotalAnnotoations.append(contentsOf: annotations)
})
//Adding all annotations in PTVectorAnnot
let ptAnnotVector = PTVectorAnnot()
TotalAnnotoations.forEach { annot in
ptAnnotVector?.add(annot)
}
//Trying to get first PTAnnot from first index of PTVectorAnnot
let a = ptAnnotVector?.get(0).getUniqueIDAsString()
let b = ptAnnotVector?.get(0).getUniqueIDAsString() //When trying again App Crashes
(App is also crashed if we use “get” func first time from PTVectorAnnot and then we use func FDFExtractCommand: )
Sample File: PDF1.pdf (164.1 KB)
Sample XFDF: xfdf.xml (23.1 KB)
Can you please tell us what we are doing wrong? and how can we use this. Proper documentation was not there.