{"id":6643,"date":"2025-09-25T11:40:20","date_gmt":"2025-09-25T03:40:20","guid":{"rendered":"https:\/\/support.fuxinsoft.cn\/?p=6643"},"modified":"2025-09-30T10:04:34","modified_gmt":"2025-09-30T02:04:34","slug":"%e5%a6%82%e4%bd%95%e9%9a%90%e5%bc%8f%e6%89%93%e5%bc%80pdf%ef%bc%8c%e5%b9%b6%e5%88%a4%e6%96%ad%e6%96%87%e6%a1%a3%e6%9d%83%e9%99%90%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/support.fuxinsoft.cn\/?p=6643","title":{"rendered":"\u9690\u5f0f\u6253\u5f00PDF\u53ca\u6587\u6863\u6743\u9650\u5224\u65ad\u65b9\u6cd5"},"content":{"rendered":"\n<p>\u5728\u8fdb\u884c\u6587\u6863\u6279\u91cf\u5904\u7406\u7b49\u64cd\u4f5c\u65f6\uff0c\u901a\u5e38\u9700\u8981\u5728\u7528\u6237\u9009\u62e9\u6587\u4ef6\u5217\u8868\u540e\uff0c\u5728\u6587\u6863\u8f6c\u6362\u524d\u9690\u5f0f\u6253\u5f00PDF\u6587\u4ef6\uff0c\u4ee5\u68c0\u67e5\u6587\u6863\u6743\u9650\u3001\u9875\u6570\u53ca\u5176\u4ed6\u5c5e\u6027\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u9690\u5f0f\u6253\u5f00PDF\u7684\u65b9\u6cd5<\/h2>\n\n\n\n<p>\u4f7f\u7528FRDocOpenFromFile2\u63a5\u53e3\u53ef\u4ee5\u9690\u5f0f\u6253\u5f00PDF\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>FR_Document frDoc = FRDocOpenFromFile2(pdfFullPath,\"\", false, false,true);<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u6587\u6863\u6743\u9650\u5224\u65ad\u4e0e\u5904\u7406<\/h2>\n\n\n\n<p>\u5728\u8fdb\u884c\u6587\u6863\u8f6c\u6362\u65f6\uff0c\u5982\u679c\u6587\u6863\u5b58\u5728\u5bc6\u7801\u52a0\u5bc6\u3001\u6570\u5b57\u7b7e\u540d\u7b49\u6743\u9650\u8bbe\u7f6e\uff0c\u901a\u5e38\u4e0d\u5141\u8bb8\u76f4\u63a5\u8fdb\u884c\u8f6c\u6362\u3002\u7279\u522b\u662f\u5bc6\u7801\u52a0\u5bc6\u7684\u6587\u6863\uff0c\u9700\u8981\u8f93\u5165\u5177\u6709\u7f16\u8f91\u6743\u9650\u7684\u5bc6\u7801\u624d\u80fd\u5b8c\u6210\u8f6c\u6362\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u5b8c\u6574\u7684\u9690\u5f0f\u6253\u5f00PDF\u3001\u5224\u65ad\u6743\u9650\uff0c\u5e76\u901a\u8fc7\u7528\u6237\u8f93\u5165\u5bc6\u7801\u8fdb\u884c\u4e8c\u6b21\u9a8c\u8bc1\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tFS_LPCWSTR pdfFullPath = L\"D:\/\/security\/test1.pdf\";\n\tOpenFile(pdfFullPath);\n\nbool CheckPassword(FPD_Parser fpdParser, FS_LPCSTR pwd ,int pwdLength)\n{\n\tif (FPDParserCheckStandardSecurityPassword(fpdParser, FS_LPCBYTE(pwd),\n\t\tstatic_cast&lt;FS_DWORD&gt;( pwdLength), TRUE, NULL) == 1)\n\t{\n\t\treturn TRUE;\n\t}\n\treturn false;\n}\nvoid OpenFile(FS_LPCWSTR pdfFullPath)\n{\n\t\n\tFR_OpenFileOption openfileOp;\n\t\/\/\u7528FRDoc\u9690\u5f0f\u6253\u5f00\uff0c\u5982\u679c\u6253\u5f00\u5f02\u5e38\u4f1a\u6709\u7f16\u8f91\u5668\u6846\u67b6\u81ea\u5e26\u7684\u63d0\u793a \n\tFR_Document frDoc =\tFRDocOpenFromFile2(pdfFullPath,\"\", false, false,true);\n\t\/\/\u5982\u679c\u6587\u6863\u80fd\u6b63\u5e38\u6253\u5f00\n\tif (frDoc != NULL)\n\t{\n\t\t\tFS_DWORD userPermission = FRDocGetPermissions(frDoc);\n\t\t\tif ((userPermission &amp; FR_PERM_EXTRACT_COPY &amp; 0xffff) != 0)\n\t\t\t{\n\t\t\t\t\/\/\u5982\u679c\u6709\u6743\u9650\n\t\t\t\t\/\/\u53ef\u4ee5\u8fdb\u884c\u8f6c\u6362\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tbool isownerPermission = FRDocHasOwnerPermission(frDoc);\n\t\t\t\t\/\/\u5224\u65ad\u662f\u5426\u662f\u5bc6\u7801\u52a0\u5bc6\n\t\t\t\tif (isownerPermission)\n\t\t\t\t{\n\t\t\t\t\t\/\/\u5982\u679c\u662f\u5bc6\u7801\u52a0\u5bc6\uff0c\u4f46\u662f\u6ca1\u6709owner\u6743\u9650\n\t\t\t\t\t\/\/\u5f39\u7a97\u63d0\u793a\u8f93\u5165\u5bc6\u7801\n\t\t\t\t\tFPD_Parser fpdParser = FRDocGetParser(frDoc);\n\t\t\t\t\t\n\t\t\t\t\t\/\/\u5224\u65ad\u5bc6\u7801\u662f\u5426\u662fowner\u5bc6\u7801\n\t\t\t\t\tbool isOwner = CheckPassword(fpdParser, \"123456\", 6);\n\t\t\t\t\tif (isOwner)\n\t\t\t\t\t{\n\t\t\t\t\t\t\/\/\u53ef\u4ee5\u8f6c\u6362\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t\/\/\u5176\u4ed6\u52a0\u5bc6\u65b9\u5f0f\n\t\t\t\t}\n\t\t\t}\n\t\tFRDocClose(frDoc, false, false, true);\n\t}\n\treturn;\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u8fdb\u884c\u6587\u6863\u6279\u91cf\u5904\u7406\u7b49\u64cd\u4f5c\u65f6\uff0c\u901a\u5e38\u9700\u8981\u5728\u7528\u6237\u9009\u62e9\u6587\u4ef6\u5217\u8868\u540e\uff0c\u5728\u6587\u6863\u8f6c\u6362\u524d\u9690\u5f0f\u6253\u5f00PDF\u6587\u4ef6\uff0c\u4ee5\u68c0\u67e5\u6587\u6863\u6743\u9650\u3001\u9875\u6570 [&hellip;]<\/p>\n","protected":false},"author":31,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[90],"tags":[1088,636,1087,867,563,1011],"class_list":["post-6643","post","type-post","status-publish","format-standard","hentry","category-plugin-sdk","tag-frdocopenfromfile2","tag-636","tag-1087","tag-867","tag-563","tag-1011"],"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\/6643","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\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6643"}],"version-history":[{"count":2,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=\/wp\/v2\/posts\/6643\/revisions"}],"predecessor-version":[{"id":7005,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=\/wp\/v2\/posts\/6643\/revisions\/7005"}],"wp:attachment":[{"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}