op.document.redact

From Tracker Software PDF SDK
Revision as of 05:16, 14 April 2017 by Palamar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Overview

This operation allows to permanently remove text and graphics, marked by Redaction annotations, from the document's content.

Parameters

Name Type Description
Input Array Array of IUnknown-based objects containing the Redaction Annotation items that will be used to apply redaction.
Output Array Array of IUnknown-based objects. Not used.
Options Dictionary Dictionary with options of the operation.

Sample

//C#
private void ApplyRedaction(PDFXEdit.IPXV_Document Doc, PDFXEdit.IPXV_Inst Inst)
{
	PDFXEdit.IPXS_Inst pSInt = (PDFXEdit.IPXS_Inst)Inst.GetExtension("PXS");
	uint nRedactAtom = pSInt.StrToAtom("Redact");
	int nID = Inst.Str2ID("op.document.redact", false);
	PDFXEdit.IOperation Op = Inst.CreateOp(nID);
	var input = Op.Params.Root["Input"];
	//Going through all of the pages and gathering the redaction annotation list
	for (uint i = 0; i < Doc.CoreDoc.Pages.Count; i++)
	{
		PDFXEdit.IPXC_Page page = Doc.CoreDoc.Pages[i];
		for (uint j = 0; j < page.GetAnnotsCount(); j++)
		{
			PDFXEdit.IPXC_Annotation annot = page.GetAnnot(j);
			if (annot.Type == nRedactAtom)
			{
				input.Add().v = annot;
			}
		}
	}
	PDFXEdit.ICabNode options = Op.Params.Root["Options"];
	options["Flags"].v = 4;
	Op.Do();
}