PdfNet readonly 注释不是只读的

PdfNet readonly annotations are not readonly

我正在为 Winforms 使用 PdfNet (C#)。

我希望能够为文本添加下划线,所以我创建了一个下划线注释 像这样:

Annot underlineAnnot = Annot.Create(m_document, Annot.Type.e_Underline, rect)
underlineAnnot.SetFlag(Annot.Flag.e_read_only);

根据此页面,无法移动只读注释:https://www.pdftron.com/pdfnet/docs/PDFNet/html/T_pdftron_PDF_Annot_Flag.htm

但是当我用工具模式 e_annot_edit 移动它时,它确实移动了...

如何 'lock' 注释使其不响应鼠标事件?

目前查看器不强制只读。

您可以自己轻松完成此操作。

创建具有以下签名的委托方法。

return false to allow editing, otherwise return true
public bool edit_annot_proc(Annot annot, object obj)
{
    return annot.GetFlag(Annot.Flag.e_read_only);
}

然后在创建PDFViewCtrl对象时注册回调

mypdfviewctrl.SetAnnotationEditPermissionHandler(edit_annot_proc, null);