IPXC_Annotation::Actions Property

From Tracker Software PDF SDK
Revision as of 04:35, 25 April 2016 by Palamar (Talk | contribs)

Jump to: navigation, search


Property Actions returns or sets list of actions associated with the annotation for the specific trigger. For most annotations only Trigger_Up is used.

Syntax

HRESULT get_Actions([in]           PXC_TriggerType     nTrigger,
                    [out, retval]  IPXC_ActionsList**  ppActions);
HRESULT put_Actions([in]  PXC_TriggerType    nTrigger,
                    [in]  IPXC_ActionsList*  ppActions);

Parameters

nTrigger
[in] Specifies the trigger for which list of action should set or retrieved.

Sample

//C#
public bool HasInvalidPaths(PDFXEdit.IPXC_Annotation annot)
{
	uint invalidCount = 0;
	uint GoTo = pxsInst.StrToAtom("GoTo");
	uint GoToR = pxsInst.StrToAtom("GoToR");
	uint Launch = pxsInst.StrToAtom("Launch");
	PDFXEdit.IPXC_ActionsList actions = annot.get_Actions(PDFXEdit.PXC_TriggerType.Trigger_Up);
	for (uint k = 0; k < actions.Count; k++)
	{
		if ((actions[k].Type == GoTo) || (actions[k].Type == GoToR))
		{
			PDFXEdit.IPXC_Action_Goto actionGoTo = (PDFXEdit.IPXC_Action_Goto)actions[k];
			if (actionGoTo.IsValid == false)
			{
				invalidCount++;
			}
			else if (actions[k].Type == GoToR)
			{
				PDFXEdit.IPXC_FileSpec path = actionGoTo.Target;
				if (File.Exists(path.DIPath) == false)
					invalidCount++;
			}

		}
		else if (actions[k].Type == Launch)
		{
			PDFXEdit.IPXC_Action_Launch actionLaunch = (PDFXEdit.IPXC_Action_Launch)actions[k];
			if (actionLaunch.IsValid == false)
			{
				invalidCount++;
			}
			else
			{
				PDFXEdit.IPXC_FileSpec path = actionLaunch.FileSpec;
				if (path == null)
				{
					if (File.Exists(actionLaunch.FileName) == false)
						invalidCount++;
				}
				else
				{
					if (File.Exists(path.DIPath) == false)
						invalidCount++;
				}

			}
		}
	}
	return (invalidCount > 0);
}

See Also

IPXC_Annotation