op.annots.setProps

From PDF XChange PDF SDK
Jump to: navigation, search
(Sample)
(One intermediate revision by the same user not shown)
Line 33: Line 33:
 
uint nWidgetAtom = pSInt.StrToAtom("Widget");
 
uint nWidgetAtom = pSInt.StrToAtom("Widget");
 
int nID = Inst.Str2ID("op.annots.setProps", false);
 
int nID = Inst.Str2ID("op.annots.setProps", false);
PDFXEdit.IOperation Op = pdfCtl.Inst.CreateOp(nID);
+
PDFXEdit.IOperation Op = Inst.CreateOp(nID);
 
PDFXEdit.ICabNode input = Op.Params.Root["Input"];
 
PDFXEdit.ICabNode input = Op.Params.Root["Input"];
 
//Get widget annotations from the first page
 
//Get widget annotations from the first page
Line 51: Line 51:
 
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
 
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
 
options["ContentRotation"].v = 90;
 
options["ContentRotation"].v = 90;
options["MaskEx"].v = 0x00000400;
+
options["MaskEx"].v = 0x00000400; // widgets will be modified
 
Op.Do();
 
Op.Do();
 
}
 
}
 
</pre>
 
</pre>

Revision as of 07:25, 15 April 2016


Overview

The operation allows to set properties of the given annotations.

Parameters

Name Type Description
Input Array Array of IUnknown-based objects containing the IPXC_Annotation objects which will have their properties modified. Note that all of the annotations must belong to one document.
Output Array Not yet implemented.
Options Dictionary Dictionary with options of the operation.

Sample

//C#
private void SetAnnotationsProperties(PDFXEdit.IPXV_Document Doc, PDFXEdit.IPXV_Inst Inst)
{
	PDFXEdit.IPXS_Inst pSInt = (PDFXEdit.IPXS_Inst)Inst.GetExtension("PXS");
	uint nWidgetAtom = pSInt.StrToAtom("Widget");
	int nID = Inst.Str2ID("op.annots.setProps", false);
	PDFXEdit.IOperation Op = Inst.CreateOp(nID);
	PDFXEdit.ICabNode input = Op.Params.Root["Input"];
	//Get widget annotations from the first page
	PDFXEdit.IPXC_Page page = Doc.CoreDoc.Pages[0];
	uint nPageCount = page.GetAnnotsCount();
	for (uint i = 0; i < nPageCount; i++)
	{
		PDFXEdit.IPXC_Annotation annot = page.GetAnnot(i);
		if (annot.Type == nWidgetAtom)
		{
			if ((annot.Field != null) && (annot.Field.Type == PDFXEdit.PXC_FormFieldType.FFT_Text))
				input.Add().v = annot;
		}
	}
	if (input.Count == 0)
		return;
	PDFXEdit.ICabNode options = Op.Params.Root["Options"];
	options["ContentRotation"].v = 90;
	options["MaskEx"].v = 0x00000400; // widgets will be modified
	Op.Do();
}