{"id":8763,"date":"2026-06-29T16:43:20","date_gmt":"2026-06-29T08:43:20","guid":{"rendered":"https:\/\/support.fuxinsoft.cn\/?p=8763"},"modified":"2026-07-22T16:51:59","modified_gmt":"2026-07-22T08:51:59","slug":"websdk%e6%b3%a8%e9%87%8a%e7%bc%a9%e6%94%be%ef%bc%9a%e4%bb%a5%e4%b8%ad%e5%bf%83%e4%b8%ba%e5%9f%ba%e5%87%86%e6%94%be%e5%a4%a7-%e7%bc%a9%e5%b0%8f","status":"publish","type":"post","link":"https:\/\/support.fuxinsoft.cn\/?p=8763","title":{"rendered":"WebSDK\u6ce8\u91ca\u7f29\u653e\uff1a\u4ee5\u4e2d\u5fc3\u4e3a\u57fa\u51c6\u653e\u5927\/\u7f29\u5c0f"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"8763\" class=\"elementor elementor-8763\" data-elementor-post-type=\"post\">\n\t\t\t\t<div class=\"elementor-element elementor-element-308100d4 e-flex e-con-boxed e-con e-parent\" data-id=\"308100d4\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-4fe12f6a elementor-widget elementor-widget-text-editor\" data-id=\"4fe12f6a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><\/p>\n<h2 id=\"2\" style=\"margin: 0px 0px 10px;padding: 0px;font-weight: bold;cursor: text;position: relative;font-size: 24px;border-bottom: 1px solid #cccccc;color: black;font-family: Helvetica, arial, sans-serif\">\u6982\u8ff0<\/h2>\n<p class=\"wp-block-paragraph\" id=\"4\" style=\"margin: 15px 0px;color: #333333;font-family: Helvetica, arial, sans-serif;font-size: 14px\">\u5728 PDF \u6587\u6863\u5904\u7406\u4e2d\uff0c\u7ecf\u5e38\u9700\u8981\u5bf9\u5df2\u6709\u6ce8\u91ca\uff08Annotation\uff09\u7684\u8fb9\u6846\u8fdb\u884c\u7f29\u653e\u64cd\u4f5c\u3002\u672c\u6587\u63d0\u4f9b\u4e00\u5957\u57fa\u4e8e JavaScript \u7684\u5de5\u5177\u65b9\u6cd5\uff0c\u5b9e\u73b0<strong>\u83b7\u53d6\u6ce8\u91ca\u77e9\u5f62\u5927\u5c0f<\/strong>\uff0c\u5e76\u4ee5<strong>\u77e9\u5f62\u4e2d\u5fc3\u70b9\u4e3a\u539f\u70b9<\/strong>\u8fdb\u884c\u7b49\u6bd4\u4f8b\u653e\u5927\u6216\u7f29\u5c0f\uff0c\u8fd4\u56de\u7f29\u653e\u540e\u7684\u65b0\u8fb9\u6846\u5750\u6807\u3002<\/p>\n<h2 id=\"6\" style=\"margin: 20px 0px 10px;padding: 0px;font-weight: bold;cursor: text;position: relative;font-size: 24px;border-bottom: 1px solid #cccccc;color: black;font-family: Helvetica, arial, sans-serif\">\u9002\u7528\u573a\u666f<\/h2>\n<ul id=\"8\" style=\"margin: 15px 0px;padding-left: 30px;color: #333333;font-family: Helvetica, arial, sans-serif;font-size: 14px\">\n<li id=\"8\" style=\"margin: 0px 0px 15px\">PDF \u6ce8\u91ca\u81ea\u9002\u5e94\u7f29\u653e\uff1a\u6839\u636e\u6587\u672c\/\u56fe\u7247\u5185\u5bb9\u81ea\u52a8\u8c03\u6574\u6ce8\u91ca\u8fb9\u6846\u5927\u5c0f<\/li>\n<li id=\"9\" style=\"margin: 15px 0px\">\u6279\u91cf\u7f29\u653e\u6ce8\u91ca\uff1a\u7edf\u4e00\u8c03\u6574\u9875\u9762\u4e2d\u591a\u4e2a\u6ce8\u91ca\u7684\u663e\u793a\u5c3a\u5bf8<\/li>\n<li id=\"10\" style=\"margin: 15px 0px\">\u6ce8\u91ca\u7f16\u8f91\u5de5\u5177\uff1a\u62d6\u62fd\u56db\u89d2\u7f29\u653e\u65f6\uff0c\u4fdd\u6301\u6ce8\u91ca\u4e2d\u5fc3\u4f4d\u7f6e\u4e0d\u53d8<\/li>\n<li id=\"11\" style=\"margin: 15px 0px 0px\">\u6ce8\u91ca\u4e0e\u9875\u9762\u5143\u7d20\u5bf9\u9f50\uff1a\u4ee5\u6ce8\u91ca\u4e2d\u5fc3\u4e3a\u951a\u70b9\uff0c\u7cbe\u786e\u5339\u914d\u76ee\u6807\u5c3a\u5bf8<\/li>\n<\/ul>\n<h2 id=\"13\" style=\"margin: 20px 0px 10px;padding: 0px;font-weight: bold;cursor: text;position: relative;font-size: 24px;border-bottom: 1px solid #cccccc;color: black;font-family: Helvetica, arial, sans-serif\">\u6838\u5fc3\u4ee3\u7801<\/h2>\n<p><\/p>\n<p class=\"wp-block-paragraph\"><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d1d1d5f elementor-widget elementor-widget-code-highlight\" data-id=\"d1d1d5f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp>var originalRect = annots[0][0].getRect()\n\/\/ \u539f\u77e9\u5f62\u5750\u6807\uff08\u539f\u70b9\uff1a\u5de6\u4e0b\u89d2\uff09\nconst originalRect = {\nleft: 167.17929077148438,\nbottom: 288.0683898925781,\nright: 317.1792907714844,\ntop: 333.0683898925781\n};\n\/**\n- \u4ee5\u77e9\u5f62\u4e2d\u5fc3\u4e3a\u57fa\u51c6\u7f29\u653e\uff0c\u8fd4\u56de\u65b0\u7684\u8fb9\u6846\u5750\u6807\uff08\u5de6\u4e0b\u89d2\u539f\u70b9\uff09\n- @param {object} rect \u539f\u77e9\u5f62 {left, bottom, right, top}\n- @param {number} scale \u7f29\u653e\u6bd4\u4f8b\uff081=\u539f\u5927\u5c0f\uff0c1.2=\u653e\u592720%\uff0c0.8=\u7f29\u5c0f20%\uff09\n- @returns {object} \u65b0\u77e9\u5f62\u5750\u6807\n*\/\nfunction scaleFromCenter(rect, scale) {\n    \/\/ 1. \u8ba1\u7b97\u539f\u5bbd\u9ad8\n    const width = rect.right - rect.left;const height = rect.top - rect.bottom;\n    \/\/ 2. \u8ba1\u7b97\u4e2d\u5fc3\u70b9\u5750\u6807\uff08\u5de6\u4e0b\u89d2\u539f\u70b9\uff09\n    const centerX = rect.left + width \/ 2;\n    const centerY = rect.bottom + height \/ 2;\n    \/\/ 3. \u8ba1\u7b97\u7f29\u653e\u540e\u7684\u65b0\u5bbd\u9ad8\n    const newWidth = width * scale;\n    const newHeight = height * scale;\n    \/\/ 4. \u4ee5\u4e2d\u5fc3\u4e3a\u57fa\u51c6\u8ba1\u7b97\u65b0\u5750\u6807\n    const newLeft = centerX - newWidth \/ 2;\n    const newRight = centerX + newWidth \/ 2;\n    const newBottom = centerY - newHeight \/ 2;\n    const newTop = centerY + newHeight \/ 2;\n    return {\n        left: newLeft,\n        bottom: newBottom,\n        right: newRight,\n        top: newTop\n    };\n}\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-ffe40be e-flex e-con-boxed e-con e-parent\" data-id=\"ffe40be\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-bc73ac7 elementor-widget elementor-widget-text-editor\" data-id=\"bc73ac7\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span style=\"color: black;font-family: Helvetica, arial, sans-serif;font-size: 24px;font-weight: bold\">\u4f7f\u7528\u793a\u4f8b<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-be2d560 e-flex e-con-boxed e-con e-parent\" data-id=\"be2d560\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-855ae4f elementor-widget elementor-widget-code-highlight\" data-id=\"855ae4f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp>\/\/ --- \u653e\u5927 1.5 \u500d ---\r\nconst scaledUp = scaleFromCenter(originalRect, 1.5);\r\nconsole.log('\u653e\u5927 1.5 \u500d\u5750\u6807\uff1a', scaledUp);\r\n\/\/ \u8f93\u51fa\uff1a\r\n\/\/ {\r\n\/\/   left:   92.17929077148438,\r\n\/\/   bottom: 265.5683898925781,\r\n\/\/   right:  392.1792907714844,\r\n\/\/   top:    355.5683898925781\r\n\/\/ }\r\n\r\n\/\/ --- \u7f29\u5c0f 0.5 \u500d ---\r\nconst scaledDown = scaleFromCenter(originalRect, 0.5);\r\nconsole.log('\u7f29\u5c0f 0.5 \u500d\u5750\u6807\uff1a', scaledDown);\r\n\/\/ \u8f93\u51fa\uff1a\r\n\/\/ {\r\n\/\/   left:   204.67929077148438,\r\n\/\/   bottom: 310.5683898925781,\r\n\/\/   right:  279.67929077148438,\r\n\/\/   top:    310.5683898925781\r\n\/\/ }\r\n\r\n\/\/ --- \u5e94\u7528\u7f29\u653e\u540e\u7684\u5750\u6807\uff08\u793a\u4f8b\uff1a\u8bbe\u7f6e\u6ce8\u91ca\u65b0\u8fb9\u6846\uff09 ---\r\nannot.setRect(scaledUp);<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-0b30d47 e-flex e-con-boxed e-con e-parent\" data-id=\"0b30d47\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-95511df elementor-widget elementor-widget-text-editor\" data-id=\"95511df\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h2 id=\"179\" style=\"margin: 20px 0px 10px;padding: 0px;font-weight: bold;cursor: text;position: relative;font-size: 24px;border-bottom: 1px solid #cccccc;color: black;font-family: Helvetica, arial, sans-serif\">\u6ce8\u610f\u4e8b\u9879<\/h2>\n<ol id=\"181\" style=\"padding-left: 30px;color: #333333;font-family: Helvetica, arial, sans-serif;font-size: 14px;margin: 15px 0px 0px !important 0px\">\n<li id=\"181\" style=\"margin: 0px 0px 15px\"><strong style=\"margin-top: 0px\">scale \u53c2\u6570\u6821\u9a8c<\/strong>\uff1a\u5efa\u8bae\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u5bf9 <code style=\"margin: 0px 2px;padding: 0px 5px;white-space: nowrap;border: 1px solid #eaeaea;background-color: #f8f8f8;border-radius: 3px\">scale &lt;= 0<\/code> \u7684\u60c5\u51b5\u505a\u9632\u62a4\uff0c\u907f\u514d\u751f\u6210\u975e\u6cd5\u5750\u6807\u3002<\/li>\n<li id=\"182\" style=\"margin: 15px 0px\"><strong style=\"margin-top: 0px;margin-bottom: 0px\">\u5750\u6807\u7cfb\u4e00\u81f4\u6027<\/strong>\uff1a\u786e\u4fdd\u6574\u4e2a\u8ba1\u7b97\u94fe\u8def\u4f7f\u7528\u540c\u4e00\u79cd\u5750\u6807\u7cfb\uff0c\u6df7\u7528\u4f1a\u5bfc\u81f4\u6ce8\u91ca\u4f4d\u7f6e\u504f\u79fb\u3002<\/li>\n<li id=\"183\" style=\"margin: 15px 0px\"><strong style=\"margin-top: 0px;margin-bottom: 0px\">\u7cbe\u5ea6\u95ee\u9898<\/strong>\uff1aPDF \u5750\u6807\u901a\u5e38\u4fdd\u7559\u8f83\u9ad8\u7cbe\u5ea6\uff08float64\uff09\uff0c\u7f29\u653e\u540e\u53ef\u80fd\u51fa\u73b0\u6d6e\u70b9\u8bef\u5dee\uff0c\u5bf9\u6700\u7ec8\u663e\u793a\u5f71\u54cd\u6781\u5c0f\u53ef\u5ffd\u7565\u3002<\/li>\n<\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-fc537c1 e-flex e-con-boxed e-con e-parent\" data-id=\"fc537c1\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-8229163 elementor-align-center elementor-widget elementor-widget-button\" data-id=\"8229163\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/developers.fuxinsoft.cn\/free-trial\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">\u514d\u8d39\u7533\u8bf7 SDK \u8bd5\u7528<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\u6982\u8ff0 \u5728 PDF \u6587\u6863\u5904\u7406\u4e2d\uff0c\u7ecf\u5e38\u9700\u8981\u5bf9\u5df2\u6709\u6ce8\u91ca\uff08Annotation\uff09\u7684\u8fb9\u6846\u8fdb\u884c\u7f29\u653e\u64cd\u4f5c\u3002\u672c\u6587\u63d0\u4f9b\u4e00\u5957\u57fa\u4e8e  [&hellip;]<\/p>\n","protected":false},"author":33,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[67],"tags":[922,595,242],"class_list":["post-8763","post","type-post","status-publish","format-standard","hentry","category-websdk","tag-pdf","tag-websdk","tag-242"],"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\/8763","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\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8763"}],"version-history":[{"count":6,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=\/wp\/v2\/posts\/8763\/revisions"}],"predecessor-version":[{"id":9119,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=\/wp\/v2\/posts\/8763\/revisions\/9119"}],"wp:attachment":[{"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/support.fuxinsoft.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}