Annotation is not editable after being imported from another document

Question:

After we import an annotation from another document, and position it, the annotation is not editable.

Answer:

The following code is the proper way to import and re-position (using Annot.Resize) an annotation onto the target page

PDFDoc source("path_to_source_pdf"); source.InitSecurityHandler(); pdfviewctrl->DocLock(true); // if viewing the target document, lock it first PDFDoc* target = pdfviewctrl->GetDoc(); Obj* src_annot = source.GetPage(1).GetAnnot(0); SDFDoc* sd = target->GetSDFDoc(); src_annot->Erase("P"); // erase reference to source page, to prevent importing more than what is needed Obj* dest_annot = sd->ImportObj(src_annot, true); Annot new_annot(dest_annot); target->GetPage(1).AnnotPushBack(new_annot); // calculate new position on target page new_annot.Resize(new_rect_position); // Important! pdfviewctrl->DocUnlock(); // unlock pdfviewctrl->Update(new_annot, 1); // refresh page