Annotation is not editable after being imported from another document.

已查看 17 次
跳至第一个未读帖子

Ryan

未读,
2016年2月4日 13:31:472016/2/4
收件人 PDFTron PDFNet SDK
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





回复全部
回复作者
转发
0 个新帖子