SetFormFieldAction

表单域、注释和热点链接

描述

把现有动作字典绑定到表单字段触发器

语法

Delphi

Function TPDFlib.SetFormFieldAction(Index: Integer; Const ActionType: WideString; ActionID: Integer): Integer;

ActiveX

Function PDFlib::SetFormFieldAction(Index As Long, ActionType As String, ActionID As Long) As Long

自类型库版本 3.6 起在 IPDFlibrary5 上可用

DLL

int DLSetFormFieldAction(int InstanceID, int Index, const wchar_t* ActionType, int ActionID);
int DLSetFormFieldActionA(int InstanceID, int Index, const char* ActionType, int ActionID);

参数

Index从 1 开始的表单字段索引
ActionType触发器名称:E、X、D、U、Fo、Bl、K、F、V 或 C
ActionID由 GetAnnotActionID、GetOutlineActionID 或 GetFormFieldActionID 返回的操作句柄

返回值

0字段、触发器或操作句柄无效,或 PDF/X-6 模式处于激活状态
1操作已复制并指派给字段触发器

备注

动作字典会先复制到所选文档,再指派给字段,因此之后对原始动作的编辑不会改变字段触发器

主鼠标抬起激活动作使用 ActionType U,与 GetFormFieldActionID(Index, 'U') 读取的动作一致

用 RemoveFormFieldAction 清除触发器,用 GetFormFieldActionInfo 通过 TPDFlibActionInfo 检查已指派的动作