{"id":270,"date":"2023-08-16T15:38:04","date_gmt":"2023-08-16T07:38:04","guid":{"rendered":""},"modified":"2023-08-16T15:38:04","modified_gmt":"2023-08-16T07:38:04","slug":"article-slug","status":"publish","type":"post","link":"https:\/\/support.fuxinsoft.cn\/?p=270","title":{"rendered":"\u3010Foxit PDF SDK\u3011\u5982\u4f55\u83b7\u53d6PDF\u6ce8\u91ca\u7684\u64cd\u4f5c\uff1f"},"content":{"rendered":"<p><span style=\"font-family: \u7b49\u7ebf;\">\u5728<\/span> PDF <span style=\"font-family: \u7b49\u7ebf;\">\u6587\u6863\u4e2d\uff0c\u67d0\u4e9b\u7c7b\u578b\u7684\u6ce8\u91ca\u53ef\u80fd\u5305\u542b\u6fc0\u6d3b\u6ce8\u91ca\u65f6\u5e94\u6267\u884c\u7684\u64cd\u4f5c\u6216\u54cd\u5e94\u4e8e\u8be5\u6ce8\u91ca\u7684\u7279\u5b9a\u89e6\u53d1\u4e8b\u4ef6\u5e94\u6267\u884c\u7684\u989d\u5916\u64cd\u4f5c\u3002<\/span><\/p>\n<p><span style=\"font-family:\u7b49\u7ebf\">\u54ea\u4e9b\u7c7b\u578b\u7684\u6ce8\u91ca\u53ef\u80fd\u5177\u6709\u64cd\u4f5c\u6216\u9644\u52a0\u64cd\u4f5c\u5462\uff1f<\/span><\/p>\n<p><span style=\"font-family:Symbol\">\u00b7<span style=\"font:9px &#39;Times New Roman&#39;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family:\u7b49\u7ebf\">\u94fe\u63a5\u6ce8\u91ca\u53ef\u80fd\u6709\u64cd\u4f5c<\/span><\/p>\n<p><span style=\"font-family:Symbol\">\u00b7<span style=\"font:9px &#39;Times New Roman&#39;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family:\u7b49\u7ebf\">\u5c0f\u7a97\u53e3\u5de5\u5177\u6ce8\u91ca\u6709\u64cd\u4f5c\u548c\u9644\u52a0\u64cd\u4f5c<\/span><\/p>\n<p><span style=\"font-family:Symbol\">\u00b7<span style=\"font:9px &#39;Times New Roman&#39;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><\/span><span style=\"font-family:\u7b49\u7ebf\">\u5c4f\u5e55\u6ce8\u91ca\u53ef\u4ee5\u6709\u64cd\u4f5c\u548c\u9644\u52a0\u64cd\u4f5c<\/span><\/p>\n<p><span style=\"font-family:\u7b49\u7ebf\">\u5982\u4f55\u83b7\u53d6<\/span>PDF<span style=\"font-family:\u7b49\u7ebf\">\u6ce8\u91ca\u7684\u64cd\u4f5c\uff1f<\/span><\/p>\n<p><span style=\"font-family:\u7b49\u7ebf\">\u5173\u4e8e\u6ce8\u91ca\u64cd\u4f5c<\/span>, ++ <span style=\"font-family:\u7b49\u7ebf\">\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a<\/span><\/p>\n<p>Cint annot_count = pdf_page.GetAnnotCount();<br \/> for (int i = 0; i&lt;annot_count; i++) {<br \/> &nbsp; &nbsp; Annot annot = pdf_page.GetAnnot(i);<br \/> &nbsp; &nbsp; Action action;<br \/> &nbsp; &nbsp; switch (annot.GetType()) {<br \/> &nbsp; &nbsp; &nbsp; &nbsp; case Annot::e_Link: {<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Link link_annot(annot);<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; action = link_annot.GetAction();<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br \/> &nbsp; &nbsp; &nbsp; &nbsp; }<br \/> &nbsp; &nbsp; &nbsp; &nbsp; case Annot::e_Screen: {<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Screen screen_annot(annot);<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; action = screen_annot.GetAction();<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br \/> &nbsp; &nbsp; &nbsp; &nbsp; }<br \/> &nbsp; &nbsp; &nbsp; &nbsp; case Annot::e_Widget: {<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Widget widget_annot(annot);<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; action = widget_annot.GetAction();<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br \/> &nbsp; &nbsp; &nbsp; &nbsp; }<br \/> &nbsp; &nbsp; &nbsp; &nbsp; default:<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br \/> &nbsp; &nbsp; }<br \/> &nbsp;&nbsp;&nbsp; \/\/ Please check if Action object is empty before using it.<br \/> &nbsp;&nbsp;&nbsp; \/\/ If Action object is empty, that means current annotation doesn&#39;t have action.<br \/> &nbsp; &nbsp; if (action.IsEmpty()) continue;<br \/> &nbsp; &nbsp; &#8230;<br \/> }<\/p>\n<p><span style=\"font-family:\u7b49\u7ebf\">\u5173\u4e8e\u989d\u5916\u64cd\u4f5c<\/span>, C++ <span style=\"font-family:\u7b49\u7ebf\">\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>int annot_count = pdf_page.GetAnnotCount();<br \/> for (int i = 0; i&lt;annot_count; i++) {<br \/> &nbsp; &nbsp; Annot annot = pdf_page.GetAnnot(i);<br \/> &nbsp; &nbsp; Annot::Type annot_type = annot.GetType();<br \/> &nbsp; &nbsp; if (annot_type != Annot::e_Screen &amp;&amp; annot_type != Annot::e_Widget)<br \/> &nbsp; &nbsp; &nbsp; &nbsp; continue;<br \/> &nbsp; &nbsp; AdditionalAction annot_aa(annot);<br \/> &nbsp; &nbsp; \/\/ Here, use &quot;AdditionalAction::e_TriggerAnnotMouseButtonPressed&quot; as example.<br \/> &nbsp; &nbsp; \/\/ For more available trigger values, please refer to API reference.<br \/> &nbsp; &nbsp; AdditionalAction::TriggerEvent trigger = AdditionalAction::e_TriggerAnnotMouseButtonPressed;<br \/> &nbsp; &nbsp; Action action = annot_aa.GetAction(trigger);<br \/> &nbsp;&nbsp;&nbsp; \/\/ Please check if Action object is empty before using it.<br \/> &nbsp;&nbsp;&nbsp; \/\/ If Action object is empty, that means current annotation doesn&#39;t have additional action for specific trigger event.<br \/> &nbsp; &nbsp; if (action.IsEmpty()) continue;<br \/> &nbsp; &nbsp; &#8230;<br \/> }<\/p>\n<p>&nbsp;<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 PDF \u6587\u6863\u4e2d\uff0c\u67d0\u4e9b\u7c7b\u578b\u7684\u6ce8\u91ca\u53ef\u80fd\u5305\u542b\u6fc0\u6d3b\u6ce8\u91ca\u65f6\u5e94\u6267\u884c\u7684\u64cd\u4f5c\u6216\u54cd\u5e94\u4e8e\u8be5\u6ce8\u91ca\u7684\u7279\u5b9a\u89e6\u53d1\u4e8b\u4ef6\u5e94\u6267\u884c\u7684\u989d\u5916\u64cd\u4f5c\u3002 [&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-270","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\/270","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=270"}],"version-history":[{"count":0,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=\/wp\/v2\/posts\/270\/revisions"}],"wp:attachment":[{"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}