{"id":271,"date":"2023-08-16T15:41:31","date_gmt":"2023-08-16T07:41:31","guid":{"rendered":""},"modified":"2023-08-16T15:42:15","modified_gmt":"2023-08-16T07:42:15","slug":"article-slug","status":"publish","type":"post","link":"https:\/\/support.fuxinsoft.cn\/?p=271","title":{"rendered":"\u3010Foxit PDF SDK\u3011\u5982\u4f55\u6267\u884c\u8868\u5355\u57df\u7684JavaScript?"},"content":{"rendered":"<p><span style=\"font-family:\u7b49\u7ebf\">\u5728<\/span>PDF<span style=\"font-family:\u7b49\u7ebf\">\u6587\u4ef6\u4e2d\uff0c<\/span>JavaScript<span style=\"font-family:\u7b49\u7ebf\">\u88ab\u5b9a\u4e49\u4e3a<\/span>JavaScript<span style=\"font-family:\u7b49\u7ebf\">\u64cd\u4f5c\u3002<\/span> JavaScript <span style=\"font-family:\u7b49\u7ebf\">\u64cd\u4f5c\u662f\u8868\u5355\u5b57\u6bb5\u7684\u76f8\u5173\u64cd\u4f5c\u6216\u9644\u52a0\u64cd\u4f5c\u6700\u5e38\u7528\u7684\u64cd\u4f5c\u7c7b\u578b\u4e4b\u4e00\u3002<\/span> <span style=\"font-family:\u7b49\u7ebf\">\u8868\u5355\u5b57\u6bb5\u53ef\u4ee5\u5305\u542b\u5f53\u8868\u5355\u5b57\u6bb5\u88ab\u6fc0\u6d3b\u65f6\u5e94\u6267\u884c\u7684\u64cd\u4f5c\u6216\u54cd\u5e94\u4e8e\u8be5\u8868\u5355\u5b57\u6bb5\u7684\u7279\u5b9a\u89e6\u53d1\u4e8b\u4ef6\u800c\u5e94\u6267\u884c\u7684\u9644\u52a0\u64cd\u4f5c\u3002<\/span> <span style=\"font-family:\u7b49\u7ebf\">\u5728\u672c\u7ae0\uff0c\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528<\/span> Foxit PDF SDK <span style=\"font-family:\u7b49\u7ebf\">\u6267\u884c\u4e0e\u8868\u5355\u5b57\u6bb5\u76f8\u5173\u7684<\/span> JavaScript <span style=\"font-family:\u7b49\u7ebf\">\u64cd\u4f5c\u3002<\/span><\/p>\n<p><span style=\"font-size:17px;line-height:107%;font-family:\u7b49\u7ebf\"><br \/><\/span><\/p>\n<p><span style=\"font-size:17px;line-height:107%;font-family:\u7b49\u7ebf\">\u5982\u4f55\u4e3a\u8868\u5355\u5b57\u6bb5\u5b9a\u4e49\u64cd\u4f5c\uff1f<\/span><\/p>\n<p><span style=\"font-family:\u7b49\u7ebf\">\u5c0f\u90e8\u4ef6\u6ce8\u91ca\u7528\u4e8e\u8868\u793a<\/span> PDF <span style=\"font-family:\u7b49\u7ebf\">\u6587\u4ef6\u4e2d\u8868\u5355\u5b57\u6bb5\u7684\u5916\u89c2\u3002<\/span> <span style=\"font-family:\u7b49\u7ebf\">\u56e0\u6b64\uff0c\u8868\u5355\u5b57\u6bb5\u7684\u76f8\u5173\u64cd\u4f5c\u6216\u9644\u52a0\u64cd\u4f5c\u53ef\u4ee5\u5728\u5176\u672c\u8eab\u4ee5\u53ca\u76f8\u5173\u7684\u5c0f\u90e8\u4ef6\u6ce8\u91ca\u4e2d\u5b9a\u4e49\uff1a<\/span><\/p>\n<p>&#8211;<span style=\"font:9px &#39;Times New Roman&#39;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-family:\u7b49\u7ebf\">\u5728\u8868\u5355\u5b57\u6bb5\u672c\u8eab\u4e2d\u53ef\u80fd\u5305\u542b\u5176\u4ed6\u64cd\u4f5c\u3002<\/span><\/p>\n<p>&#8211;<span style=\"font:9px &#39;Times New Roman&#39;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-family:\u7b49\u7ebf\">\u5728\u76f8\u5173\u7684<\/span>widget<span style=\"font-family:\u7b49\u7ebf\">\u6ce8\u89e3\u4e2d\uff0c\u53ef\u80fd\u4f1a\u5305\u542b<\/span>action<span style=\"font-family:\u7b49\u7ebf\">\uff08\u901a\u5e38\u662f\u5728<\/span>widget<span style=\"font-family:\u7b49\u7ebf\">\u6ce8\u89e3\u88ab\u6fc0\u6d3b\u65f6\u89e6\u53d1\uff0c\u6bd4\u5982\u70b9\u51fb\uff09\u548c\u9644\u52a0\u52a8\u4f5c\u3002<\/span><\/p>\n<p><span style=\"font-family:\u7b49\u7ebf\">\u9644\u52a0\u64cd\u4f5c\u6269\u5c55\u4e86\u53ef\u4ee5\u89e6\u53d1\u64cd\u4f5c\u6267\u884c\u7684\u4e8b\u4ef6\u96c6\u3002<\/span> <span style=\"font-family:\u7b49\u7ebf\">\u56e0\u6b64\u53ef\u4ee5\u9488\u5bf9\u4e0d\u540c\u7684\u4e8b\u4ef6\u89e6\u53d1\u9644\u52a0\u64cd\u4f5c\u3002<\/span><\/p>\n<p><span style=\"font-size:17px;line-height:107%;font-family:\u7b49\u7ebf\"><br \/><\/span><\/p>\n<p><span style=\"font-size:17px;line-height:107%;font-family:\u7b49\u7ebf\">\u5982\u4f55\u901a\u8fc7<\/span><span style=\"font-size:17px;line-height:107%\">Foxit PDF SDK<\/span><span style=\"font-size:17px;line-height:107%;font-family:\u7b49\u7ebf\">\u6267\u884c\u8868\u5355\u5b57\u6bb5\u7684<\/span><span style=\"font-size:17px;line-height:107%\">JavaScript<\/span><span style=\"font-size:17px;line-height:107%;font-family:\u7b49\u7ebf\">\u64cd\u4f5c\uff1f<\/span><\/p>\n<p>JavaScript <span style=\"font-family:\u7b49\u7ebf\">\u64cd\u4f5c\u5b9a\u4e49\u4e3a\u8868\u5355\u5b57\u6bb5\u6216\u5176\u76f8\u5173\u5c0f\u90e8\u4ef6\u6ce8\u91ca\u7684\u9644\u52a0\u64cd\u4f5c<\/span><\/p>\n<p><span style=\"font-family:\u7b49\u7ebf\">\u4f7f\u7528<\/span>class foxit::pdf::action::AdditionalAction <span style=\"font-family:\u7b49\u7ebf\">\u548c<\/span>APIAdditionalAction::DoJSAction(TriggerEvent)<span style=\"font-family:\u7b49\u7ebf\">\u3002<\/span><\/p>\n<p>&#8211;<span style=\"font:9px &#39;Times New Roman&#39;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-family:\u7b49\u7ebf\">\u5bf9\u4e8e\u8868\u5355\u5b57\u6bb5\uff0c\u8bf7\u4f7f\u7528\u6784\u9020\u51fd\u6570<\/span>foxit::pdf::action::AdditionalAction(Field)<span style=\"font-family:\u7b49\u7ebf\">\u3002<\/span> <span style=\"font-family:\u7b49\u7ebf\">\u7136\u540e\u4f7f\u7528\u4ee5\u201c<\/span>e_TriggerField<span style=\"font-family:\u7b49\u7ebf\">\u201d\u5f00\u5934\u7684\u679a\u4e3e\u503c\u4f5c\u4e3a<\/span>AdditionalAction::DoJSAction() <span style=\"font-family:\u7b49\u7ebf\">\u4e2d\u7684\u53c2\u6570<\/span>TriggerEvent<span style=\"font-family:\u7b49\u7ebf\">\u3002<\/span><\/p>\n<p>&#8211;<span style=\"font:9px &#39;Times New Roman&#39;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span style=\"font-family:\u7b49\u7ebf\">\u5bf9\u4e8e\u8868\u5355\u5b57\u6bb5\u7684\u76f8\u5173\u5c0f\u90e8\u4ef6\u6ce8\u91ca\uff0c\u8bf7\u4f7f\u7528\u6784\u9020\u51fd\u6570<\/span>foxit::pdf::action::AdditionalAction(Annot)<span style=\"font-family:\u7b49\u7ebf\">\u3002<\/span> <span style=\"font-family:\u7b49\u7ebf\">\u7136\u540e\u4f7f\u7528\u4ee5\u201c<\/span>e_TriggerAnnot<span style=\"font-family:\u7b49\u7ebf\">\u201d\u5f00\u5934\u7684\u679a\u4e3e\u503c\u4f5c\u4e3a<\/span>AdditionalAction::DoJSAction() <span style=\"font-family:\u7b49\u7ebf\">\u4e2d\u7684\u53c2\u6570<\/span>TriggerEvent<span style=\"font-family:\u7b49\u7ebf\">\u3002<\/span><\/p>\n<p><span style=\"font-family:\u7b49\u7ebf\">\u5982\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684<\/span>C++<span style=\"font-family:\u7b49\u7ebf\">\u793a\u4f8b\u4ee3\u7801\uff0c\u8bf4\u660e\u5982\u4f55\u4f7f\u7528<\/span> class foxit::pdf::action::AdditionalAction<span style=\"font-family:\u7b49\u7ebf\">\u548c<\/span>APIAdditionalAction::DoJSAction(TriggerEvent)<span style=\"font-family:\u7b49\u7ebf\">\u3002<\/span><\/p>\n<p>\/\/ Assume that we have retrieved a foxit::pdf::interform::Field object, named as &quot;field&quot;.<\/p>\n<p>\/\/ Now, we want to execute the JavaScript action of &quot;field&quot;.<\/p>\n<p>AdditionalAction field_aa(field);<\/p>\n<p>\/\/ Choose a trigger event type to be executed.<\/p>\n<p>\/\/ Here, assume the JavaScript is defined to be triggered when field&#39;s value is changed.<\/p>\n<p>AdditionalAction::TriggerEvent trigger_event = AdditionalAction::e_TriggerFieldValueChanged;<\/p>\n<p>bool ret = field_aa.DoJSAction(trigger_event);<\/p>\n<p>..\/\/ Check &quot;ret&quot; to see whether API DoJSAction() succeeded or not.<\/p>\n<p>JavaScript <span style=\"font-family:\u7b49\u7ebf\">\u64cd\u4f5c\u5b9a\u4e49\u4e3a\u8868\u5355\u5b57\u6bb5\u7684\u76f8\u5173\u5c0f\u7a97\u6ce8\u91ca\u4e2d\u7684\u64cd\u4f5c<\/span><\/p>\n<p><span style=\"font-family:\u7b49\u7ebf\">\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c<\/span>class foxit::pdf::action::AddtionalAction <span style=\"font-family:\u7b49\u7ebf\">\u6839\u672c\u65e0\u6cd5\u89e6\u53d1\u64cd\u4f5c\u3002<\/span> <span style=\"font-family:\u7b49\u7ebf\">\u4ec5\u5f53\u5355\u51fb\u9f20\u6807\u5728\u76f8\u5173\u8868\u5355\u5b57\u6bb5\u4e2d\u65f6\u624d\u80fd\u89e6\u53d1\u3002<\/span>class foxit::pdf::interform::Filler<span style=\"font-family:\u7b49\u7ebf\">\u8fd9\u79cd\u60c5\u51b5\u5e94\u8be5\u53cc\u53cc\u8c03\u7528<\/span> API Filler::OnLButtonDown() <span style=\"font-family:\u7b49\u7ebf\">\u548c<\/span> Filler::OnLButtonUp()<span style=\"font-family:\u7b49\u7ebf\">\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728PDF\u6587\u4ef6\u4e2d\uff0cJavaScript\u88ab\u5b9a\u4e49\u4e3aJavaScript\u64cd\u4f5c\u3002 JavaScript \u64cd\u4f5c\u662f\u8868\u5355\u5b57\u6bb5\u7684 [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[],"class_list":["post-271","post","type-post","status-publish","format-standard","hentry","category-software-development-kit"],"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"","_links":{"self":[{"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=\/wp\/v2\/posts\/271","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=271"}],"version-history":[{"count":0,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=\/wp\/v2\/posts\/271\/revisions"}],"wp:attachment":[{"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}