Speed up iterating through all annotations in a document?

10 views
Skip to first unread message

Ryan

unread,
Jun 15, 2016, 3:00:34 PM6/15/16
to PDFTron PDFNet SDK
Question:

We have a PDF with 500 pages, and 100 annotations per page. We find iterating through all the annotations slow. Is there a faster way to create a set of annotations?

PageIterator itr = pdfDocument.GetPageIterator();
Page page = itr.Current();
                   
int num_annots = page.GetNumAnnots();
                    pageNumber
++;


                   
for (int i=0; i<num_annots; ++i)
                   
{
                       
Annot annot = page.GetAnnot(i);

Answer:

Yes, you can use multi-threading. Just make sure to call PDFDoc.LockRead and PDFDoc.UnlockRead on each thread, and have each thread operate on a different page.

Otherwise, no there isn't any other shortcut.
Reply all
Reply to author
Forward
0 new messages