Hi, Andrea.
To create new annotation you may use JS:
Code: Select all
var pageIndex = this.pageNum;
var annot = this.addAnnot({
page: pageIndex,
type: "Square",
name: "myBlackRect99",
rect: [400, 400, 550, 500],
fillColor: color.black,
strokeColor: color.black});
To delete any annotation you can use JS:
Code: Select all
// by name
var a = this.getAnnot(pageIndex, "myBlackRect99");
if (a != null)
a.destroy();
// or by [pageIndex, annotIndexOnPage]:
var aa = this.getAnnots(pageIndex);
if ((aa.length != 0) && (annotIndexOnPage >= 0) && (annotIndexOnPage < aa.length))
aa[annotIndexOnPage].destroy();
To select annotation and delete it:
Code: Select all
// select by name(unique):
pdfViewer.DoDocumentVerb(docID, "", "SelectAnnot", dataIn("myBlackRect99"), null, PXCVA_Sync);
// or select by [pageIndex, annotIndexOnPage]
pdfViewer.DoDocumentVerb(docID, "", "SelectAnnot", dataIn(pageIndex, annotIndexOnPage), null, PXCVA_Sync);
// delete the selection:
pdfViewer.DoVerb("", "ExecuteCommand", dataIn("Delete"), null, PXCVA_Sync);
Finally in the Comments Pane can I disable / hide the tools.
- you may disable any UI-command item by:
Code: Select all
pdfViewer.SetProperty("Commands[#CmdID].State", dataIn("Offline"), 0);
// or by name
pdfViewer.SetProperty("Commands["CmdName"].State", dataIn("Offline"), 0);
HTH
PDF-XChange Co. LTD (Project Developer)
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.