{"id":5399,"date":"2025-05-25T17:32:14","date_gmt":"2025-05-25T09:32:14","guid":{"rendered":"https:\/\/support.fuxinsoft.cn\/?p=5399"},"modified":"2025-05-25T17:37:27","modified_gmt":"2025-05-25T09:37:27","slug":"gsdk%e5%a6%82%e4%bd%95%e5%90%91pdf%e6%b7%bb%e5%8a%a0%e9%9a%90%e8%97%8f%e7%9a%84%e6%96%87%e6%9c%ac%e5%9f%9f%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/support.fuxinsoft.cn\/?p=5399","title":{"rendered":"GSDK\u5982\u4f55\u5411PDF\u6dfb\u52a0\u9690\u85cf\u7684\u6587\u672c\u57df\uff1f"},"content":{"rendered":"\n<p>\u8bf7\u53c2\u8003\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>                    \/\/ \u6dfb\u52a0\u6587\u672c\u9690\u85cf\u57df\n                    Control control = form.addControl(page, \"Text Field0\", Field.e_TypeTextField, new RectF(50, 600, 90, 640));\n                    control.getField().setValue(\"3\");\n                    DefaultAppearance defaultAppearance = new DefaultAppearance();\n                    \/\/ \u5237\u65b0\u5916\u89c2\n                    control.getWidget().resetAppearanceStream();\n\n                    int annotCount = page.getAnnotCount();\n                    for (int i = 0; i &lt; annotCount; i++) {\n                        Annot annot = page.getAnnot(i);\n                        \/\/ \u8bbe\u7f6e\u9690\u85cf\u57df\u7684\u5916\u89c2\u4e0d\u53ef\u89c1\n                        annot.setFlags(e_FlagHidden | e_FlagReadOnly);\n                        annot.resetAppearanceStream();\n                    }<\/code><\/pre>\n\n\n\n<p><strong>\u4e00\u3001\u521b\u5efa\u5e76\u914d\u7f6e\u9690\u85cf\u6587\u672c\u57df<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u5b57\u6bb5\u521d\u59cb\u5316\u4e0e\u4f4d\u7f6e\u8bbe\u7f6e<\/strong><br>\u4ee3\u7801\u901a\u8fc7\u00a0<code>form.addControl()<\/code>\u00a0\u65b9\u6cd5\u5728 PDF \u9875\u9762\u4e2d\u6dfb\u52a0\u6587\u672c\u57df\u63a7\u4ef6\u3002\u53c2\u6570\u4f9d\u6b21\u4e3a\uff1a\u76ee\u6807\u9875\u9762\u00a0<code>page<\/code>\u3001\u5b57\u6bb5\u540d\u79f0\u00a0<code>\"Text Field0\"<\/code>\u3001\u5b57\u6bb5\u7c7b\u578b\u00a0<code>Field.e_TypeTextField<\/code>\uff08\u6587\u672c\u7c7b\u578b\uff09\uff0c\u4ee5\u53ca\u5750\u6807\u533a\u57df\u00a0<code>new RectF(50, 600, 90, 640)<\/code>\u3002\u8fd9\u91cc\u7684\u5750\u6807\u91c7\u7528 PDF \u5750\u6807\u7cfb\uff08\u5de6\u4e0b\u89d2\u4e3a\u539f\u70b9\uff09\uff0c\u8868\u793a\u6587\u672c\u57df\u7684\u4f4d\u7f6e\u4e3a\uff1a\u5de6\u8fb9\u754c\u00a0<code>50<\/code>\u3001\u4e0b\u8fb9\u754c\u00a0<code>600<\/code>\u3001\u53f3\u8fb9\u754c\u00a0<code>90<\/code>\u3001\u4e0a\u8fb9\u754c\u00a0<code>640<\/code>\uff0c\u5b9e\u9645\u5360\u636e\u7684\u77e9\u5f62\u533a\u57df\u5bbd\u5ea6\u4e3a\u00a0<code>40<\/code>\uff0890-50\uff09\u3001\u9ad8\u5ea6\u4e3a\u00a0<code>40<\/code>\uff08640-600\uff09\u3002<\/li>\n\n\n\n<li><strong>\u8bbe\u7f6e\u5b57\u6bb5\u503c<\/strong><br>\u901a\u8fc7\u00a0<code>control.getField().setValue(\"3\")<\/code>\u00a0\u4e3a\u6587\u672c\u57df\u8d4b\u503c\u00a0<code>\"3\"<\/code>\uff0c\u8be5\u503c\u5728 PDF \u4e2d\u4e0d\u53ef\u89c1\uff0c\u4f46\u53ef\u901a\u8fc7\u8868\u5355\u6570\u636e\u8bfb\u53d6\u3002<\/li>\n\n\n\n<li><strong>\u5916\u89c2\u5237\u65b0<\/strong><br>\u521b\u5efa\u9ed8\u8ba4\u5916\u89c2\u5bf9\u8c61\u00a0<code>DefaultAppearance<\/code>\u00a0\u540e\uff0c\u8c03\u7528\u00a0<code>control.getWidget().resetAppearanceStream()<\/code>\u00a0\u91cd\u7f6e\u63a7\u4ef6\u7684\u5916\u89c2\u6d41\u3002\u8fd9\u4e00\u6b65\u7528\u4e8e\u786e\u4fdd\u5b57\u6bb5\u7684\u89c6\u89c9\u5448\u73b0\u88ab\u66f4\u65b0\uff0c\u5c3d\u7ba1\u9690\u85cf\u57df\u672c\u8eab\u4e0d\u663e\u793a\uff0c\u4f46\u5916\u89c2\u5237\u65b0\u662f\u5e94\u7528\u9690\u85cf\u5c5e\u6027\u7684\u5fc5\u8981\u6b65\u9aa4\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4e8c\u3001\u9690\u85cf\u6587\u672c\u57df\u7684\u5916\u89c2<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u904d\u5386\u9875\u9762\u6ce8\u91ca<\/strong><br>\u901a\u8fc7\u00a0<code>page.getAnnotCount()<\/code>\u00a0\u83b7\u53d6\u5f53\u524d\u9875\u9762\u7684\u6ce8\u91ca\u6570\u91cf\uff0c\u5faa\u73af\u904d\u5386\u6bcf\u4e2a\u6ce8\u91ca\u00a0<code>Annot annot<\/code>\u3002\u6ce8\u91ca\u662f PDF \u4e2d\u6807\u8bb0\u8868\u5355\u5b57\u6bb5\u7b49\u5143\u7d20\u7684\u5bf9\u8c61\uff0c\u6587\u672c\u57df\u7684\u9690\u85cf\u5c5e\u6027\u9700\u901a\u8fc7\u6ce8\u91ca\u7684\u6807\u5fd7\u4f4d\u8bbe\u7f6e\u3002<\/li>\n\n\n\n<li><strong>\u8bbe\u7f6e\u9690\u85cf\u4e0e\u53ea\u8bfb\u6807\u5fd7<\/strong><br>\u5bf9\u6bcf\u4e2a\u6ce8\u91ca\u8c03\u7528\u00a0<code>annot.setFlags(e_FlagHidden | e_FlagReadOnly)<\/code>\uff0c\u5176\u4e2d\uff1a\n<ul class=\"wp-block-list\">\n<li><code>e_FlagHidden<\/code>\u00a0\u7528\u4e8e\u9690\u85cf\u6ce8\u91ca\u7684\u5916\u89c2\uff0c\u4f7f\u6587\u672c\u57df\u5728 PDF \u4e2d\u4e0d\u53ef\u89c1\uff1b<\/li>\n\n\n\n<li><code>e_FlagReadOnly<\/code>\u00a0\u4f7f\u5b57\u6bb5\u53d8\u4e3a\u53ea\u8bfb\uff0c\u9632\u6b62\u7528\u6237\u4fee\u6539\u5176\u503c\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5237\u65b0\u6ce8\u91ca\u5916\u89c2<\/strong><br>\u8c03\u7528\u00a0<code>annot.resetAppearanceStream()<\/code>\u00a0\u91cd\u65b0\u751f\u6210\u6ce8\u91ca\u7684\u5916\u89c2\u6d41\uff0c\u786e\u4fdd\u9690\u85cf\u548c\u53ea\u8bfb\u5c5e\u6027\u751f\u6548\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u5173\u952e\u903b\u8f91\u603b\u7ed3<\/strong><\/h3>\n\n\n\n<p>\u904d\u5386\u6240\u6709\u6ce8\u91ca\u5e76\u8bbe\u7f6e\u6807\u5fd7\u4f4d\u65f6\uff0c\u5efa\u8bae\u589e\u52a0\u5b57\u6bb5\u540d\u79f0\u6821\u9a8c\uff08\u5982\u901a\u8fc7\u00a0<code>annot.getFieldName()<\/code>\u00a0\u5339\u914d\uff09\uff0c\u907f\u514d\u5f71\u54cd\u5176\u4ed6\u6ce8\u91ca\u3002<\/p>\n\n\n\n<p><strong>\u6838\u5fc3\u6b65\u9aa4<\/strong>\uff1a\u521b\u5efa\u6587\u672c\u57df \u2192 \u8d4b\u503c \u2192 \u5237\u65b0\u5916\u89c2 \u2192 \u904d\u5386\u6ce8\u91ca\u5e76\u8bbe\u7f6e\u9690\u85cf\u6807\u5fd7\u3002<\/p>\n\n\n\n<p><strong>\u9690\u85cf\u539f\u7406<\/strong>\uff1a\u901a\u8fc7\u4fee\u6539\u6ce8\u91ca\u7684\u00a0<code>e_FlagHidden<\/code>\u00a0\u6807\u5fd7\u4f4d\uff0c\u800c\u975e\u76f4\u63a5\u5220\u9664\u5b57\u6bb5\uff0c\u4f7f\u6587\u672c\u57df\u5728\u89c6\u89c9\u4e0a\u4e0d\u53ef\u89c1\uff0c\u4f46\u4fdd\u7559\u5176\u6570\u636e\u5b58\u50a8\u529f\u80fd\u3002<\/p>\n\n\n\n<p><strong>\u6ce8\u610f\u4e8b\u9879<\/strong>\uff1a<\/p>\n\n\n\n<p>\u5750\u6807\u503c\u9700\u6839\u636e PDF \u5b9e\u9645\u5c3a\u5bf8\u8c03\u6574\uff0c\u907f\u514d\u4e0e\u5176\u4ed6\u5143\u7d20\u91cd\u53e0\uff1b<\/p>\n\n\n\n<p>\u9690\u85cf\u5b57\u6bb5\u4ecd\u53ef\u901a\u8fc7 PDF \u7f16\u8f91\u5668\u7684\u8868\u5355\u67e5\u770b\u529f\u80fd\u83b7\u53d6\u503c\uff0c\u82e5\u9700\u5b8c\u5168\u5b89\u5168\uff0c\u9700\u914d\u5408 PDF \u52a0\u5bc6\uff1b<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf7\u53c2\u8003\u4ee5\u4e0b\u4ee3\u7801\uff1a \u4e00\u3001\u521b\u5efa\u5e76\u914d\u7f6e\u9690\u85cf\u6587\u672c\u57df \u4e8c\u3001\u9690\u85cf\u6587\u672c\u57df\u7684\u5916\u89c2 \u5173\u952e\u903b\u8f91\u603b\u7ed3 \u904d\u5386\u6240\u6709\u6ce8\u91ca\u5e76\u8bbe\u7f6e\u6807\u5fd7\u4f4d\u65f6\uff0c\u5efa [&hellip;]<\/p>\n","protected":false},"author":29,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[96],"tags":[],"class_list":["post-5399","post","type-post","status-publish","format-standard","hentry","category-editor"],"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","_links":{"self":[{"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=\/wp\/v2\/posts\/5399","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\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5399"}],"version-history":[{"count":2,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=\/wp\/v2\/posts\/5399\/revisions"}],"predecessor-version":[{"id":5402,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=\/wp\/v2\/posts\/5399\/revisions\/5402"}],"wp:attachment":[{"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5399"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}