op.annots.delete

From PDF XChange PDF SDK
Jump to: navigation, search


Overview

The operation allows to delete annotations from the document.

Parameters

Name Type Description
Input Array Array of IUnknown-based objects containing the IPXC_Annotation objects that need to be deleted. Also the IPXC_Document can be specified - that will mean that all of the annotations will be deleted. Note that all of the annotations must belong to one document.
Output Array Array of IUnknown-based objects containing the IPXC_Document which annotations were deleted.
Options Dictionary Dictionary with options of the operation.

Sample

//C#
private void RemoveSquareAnnotations(PDFXEdit.IPXV_Document Doc, PDFXEdit.PXV_Inst Inst)
{
	PDFXEdit.IPXS_Inst pSInt = (PDFXEdit.IPXS_Inst)Inst.GetExtension("PXS");
	uint nSquareAtom = pSInt.StrToAtom("Square");
	int nID = Inst.Str2ID("op.annots.delete", false);
	PDFXEdit.IOperation Op = Inst.CreateOp(nID);
	PDFXEdit.ICabNode input = Op.Params.Root["Input"];
	//Filling the operation with the annotations of Square type
	PDFXEdit.IPXV_AnnotsList annotsList = Inst.CreateAnnotsList();
	for (uint i = 0; i < Doc.CoreDoc.Pages.Count; i++)
	{
		PDFXEdit.IPXC_Page page = Doc.CoreDoc.Pages[i];
		uint nCnt = page.GetAnnotsCount();
		for (uint j = 0; j < nCnt; j++)
		{
			PDFXEdit.IPXC_Annotation annot = page.GetAnnot(j);
			if (annot.Type == nSquareAtom)
				input.Add().v = annot;
		}
	}
	Op.Do();
}