IPXC_Annotation::Actions Property

From PDF XChange PDF SDK
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**  pActions);
HRESULT put_Actions([in]  PXC_TriggerType    nTrigger,
                    [in]  IPXC_ActionsList*  pActions);

Parameters

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

Sample

01//C#
02public bool HasInvalidPaths(PDFXEdit.IPXC_Annotation annot)
03{
04    uint invalidCount = 0;
05    uint GoTo = pxsInst.StrToAtom("GoTo");
06    uint GoToR = pxsInst.StrToAtom("GoToR");
07    uint Launch = pxsInst.StrToAtom("Launch");
08    PDFXEdit.IPXC_ActionsList actions = annot.get_Actions(PDFXEdit.PXC_TriggerType.Trigger_Up);
09    for (uint k = 0; k < actions.Count; k++)
10    {
11        if ((actions[k].Type == GoTo) || (actions[k].Type == GoToR))
12        {
13            PDFXEdit.IPXC_Action_Goto actionGoTo = (PDFXEdit.IPXC_Action_Goto)actions[k];
14            if (actionGoTo.IsValid == false)
15            {
16                invalidCount++;
17            }
18            else if (actions[k].Type == GoToR)
19            {
20                PDFXEdit.IPXC_FileSpec path = actionGoTo.Target;
21                if (File.Exists(path.DIPath) == false)
22                    invalidCount++;
23            }
24 
25        }
26        else if (actions[k].Type == Launch)
27        {
28            PDFXEdit.IPXC_Action_Launch actionLaunch = (PDFXEdit.IPXC_Action_Launch)actions[k];
29            if (actionLaunch.IsValid == false)
30            {
31                invalidCount++;
32            }
33            else
34            {
35                PDFXEdit.IPXC_FileSpec path = actionLaunch.FileSpec;
36                if (path == null)
37                {
38                    if (File.Exists(actionLaunch.FileName) == false)
39                        invalidCount++;
40                }
41                else
42                {
43                    if (File.Exists(path.DIPath) == false)
44                        invalidCount++;
45                }
46 
47            }
48        }
49    }
50    return (invalidCount > 0);
51}

See Also

IPXC_Annotation