{"id":1352,"date":"2017-04-18T16:30:27","date_gmt":"2017-04-18T08:30:27","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=1352"},"modified":"2017-07-14T11:48:04","modified_gmt":"2017-07-14T03:48:04","slug":"%e8%af%a6%e8%a7%a3-%e4%bd%bf%e7%94%a8pdf-js-%e6%8f%92%e4%bb%b6%e5%ae%9e%e7%8e%b0pdf%e6%96%87%e6%a1%a3%e5%9c%a8%e7%ba%bf%e6%b5%8f%e8%a7%88%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=1352","title":{"rendered":"\u8be6\u89e3 \u4f7f\u7528pdf.js \u63d2\u4ef6\u5b9e\u73b0pdf\u6587\u6863\u5728\u7ebf\u6d4f\u89c8\u529f\u80fd"},"content":{"rendered":"<p>\n\t\u5728\u5f88\u65e9\u4e4b\u524d\u5c31\u60f3\u5b9e\u73b0\u4e00\u4e2apdf\u5728\u7ebf\u9884\u89c8\u7684\u529f\u80fd\uff0c\u53ea\u662f\u9650\u4e8e\u6d41\u91cf\u548c\u5bf9\u670d\u52a1\u5668\u6027\u80fd\u8981\u6c42\u8f83\u9ad8\u4f5c\u7f62\u3002\u73b0\u5728\u672c\u6587\u5c06\u5176\u4e2d\u6d89\u53ca\u7684\u5230\u5173\u952e\u6280\u672f\u5171\u4eab\u7ed9\u5927\u5bb6\u3002\n<\/p>\n<h2>\n\tpdf.js \u63d2\u4ef6\u4ecb\u7ecd<br \/>\n<\/h2>\n<p>\n\t<a href=\"http:\/\/mozilla.github.io\/pdf.js\/\" name=\"pdf.js \u5b98\u7f51\" target=\"_blank\" title=\"pdf.js \u5b98\u7f51\">pdf.js<\/a>\u53ef\u4ee5\u5b9e\u73b0\u5728html\u4e0b\u76f4\u63a5\u6d4f\u89c8pdf\u6587\u6863\uff0c\u662f\u4e00\u6b3e\u5f00\u6e90\u7684pdf\u6587\u6863\u8bfb\u53d6\u89e3\u6790\u63d2\u4ef6\u3002\u5b98\u65b9\u5730\u5740\uff1a<a href=\"http:\/\/mozilla.github.io\/pdf.js\/\" name=\"pdf.js \u5b98\u7f51\" target=\"_blank\" title=\"pdf.js \u5b98\u7f51\">http:\/\/mozilla.github.io\/pdf.js\/<\/a>\n<\/p>\n<p>\n\tpdf.js\u4e3b\u8981\u5305\u542b\u4e24\u4e2a\u5e93\u6587\u4ef6\uff0c\u4e00\u4e2apdf.js\u548c\u4e00\u4e2apdf.worker.js\uff0c\uff0c\u4e00\u4e2a\u8d1f\u8d23API\u89e3\u6790\uff0c\u4e00\u4e2a\u8d1f\u8d23\u6838\u5fc3\u89e3\u6790\u3002\n<\/p>\n<p>\n\t\u4e0b\u9762\u662f pdf.js \u63d2\u4ef6\u7ed3\u6784\u56fe\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"pdf.js \u63d2\u4ef6\u7ed3\u6784\u56fe\" src=\"http:\/\/img.bbs.csdn.net\/upload\/201704\/18\/1492503385_458372.png\" \/>\n<\/p>\n<h2>\n\tpdf.js \u5236\u4f5c pdf\u6587\u6863\u5728\u7ebf\u9605\u8bfb\u529f\u80fd<br \/>\n<\/h2>\n<p>\n\t\u9996\u5148\u6211\u4eec\u9700\u8981\u5c06 pdf.js \u4ece\u5b98\u7f51\u4e0a\u4e0b\u8f7d\u4e0b\u6765\u3002\u7136\u540e\u9879\u76ee\uff0c\u5728\u9879\u76ee\u4e2d\u653e\u7f6e\u4e00\u4e2a\u5f85\u9884\u89c8\u7684pdf\u6587\u6863\uff0c\u540c\u65f6\u5c06pdf.js \u590d\u5236\u5230\u9879\u76ee\u4e2d\u3002\u65b0\u5efa\u4e00\u4e2aindex.html\u6587\u4ef6\u3002\u5185\u5bb9\u5982\u4e0b\uff1a\n<\/p>\n<pre class=\"brush:xml;\">\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;meta charset=&quot;UTF-8&quot;&gt;\r\n    &lt;title&gt;\u4e1a\u4f59\u8349\uff1awww.xttblog.com pdf\u5728\u7ebf\u9884\u89c8&lt;\/title&gt;\r\n    &lt;style type=&quot;text\/css&quot;&gt;\r\n        .lightbox{\r\n            position: fixed;\r\n            top: 0px;\r\n            left: 0px;\r\n            height: 100%;\r\n            width: 100%;\r\n            z-index: 7;\r\n            opacity: 0.3;\r\n            display: block;\r\n            background-color: rgb(0, 0, 0);\r\n            display: none;\r\n        }\r\n        .pop,iframe{\r\n            position: absolute;\r\n            left: 50%;\r\n            top:0;\r\n            width: 893px;\r\n            height: 100%;\r\n            margin-left: -446.5px;\r\n            z-index: 9;\r\n        }\r\n    &lt;\/style&gt;\r\n    &lt;script src=&quot;Scripts\/pdf.js&quot; type=&quot;text\/javascript&quot;&gt;&lt;\/script&gt;\r\n    &lt;script type=&quot;text\/javascript&quot;&gt;\r\n        function showPdf(isShow) {\r\n            var state = &quot;&quot;;\r\n            if (isShow) {\r\n                state = &quot;block&quot;;\r\n            } else {\r\n                state = &quot;none&quot;;\r\n            }\r\n            var pop = document.getElementById(&quot;pop&quot;);\r\n            pop.style.display = state;\r\n            var lightbox = document.getElementById(&quot;lightbox&quot;);\r\n            lightbox.style.display = state;\r\n        }\r\n        function close() {\r\n            showPdf(false);\r\n        }\r\n    &lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;ul&gt;\r\n        &lt;li&gt;&lt;a href=&quot;Scripts\/jQuery\u7ecf\u5178\u5165\u95e8\u6559\u7a0b(\u7edd\u5bf9\u8be6\u7ec6).pdf&quot; target=&quot;pdfContainer&quot; onclick=&quot;showPdf(true)&quot;&gt;0001_pdf&lt;\/a&gt;&lt;\/li&gt;   \r\n    &lt;\/ul&gt;\r\n    &lt;div class=&quot;lightbox&quot; id=&quot;lightbox&quot;&gt;&lt;\/div&gt;\r\n    &lt;div id=&quot;pop&quot; class=&quot;pop&quot; style=&quot;display: none;&quot;&gt;\r\n        &lt;a href=&quot;javascript:close()&quot; style=&quot;\r\n            position: absolute;\r\n            right: -90px;\r\n            display: inline-block;\r\n            width: 80px;\r\n            height: 30px;\r\n        &quot; id=&quot;close&quot;&gt;\u5173\u95ed&lt;\/a&gt;\r\n        &lt;iframe src=&quot;&quot; frameborder=&quot;0&quot; id=&quot;pdfContainer&quot; name=&quot;pdfContainer&quot;&gt;&lt;\/iframe&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\n\t\u9879\u76ee\u7ed3\u6784\u5982\u4e0b\u56fe\u6240\u793a\uff1a\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"PDF\u6587\u6863\u5728\u7ebf\u9605\u8bfb\u529f\u80fd\" src=\"http:\/\/img.bbs.csdn.net\/upload\/201707\/14\/1500003973_348666.png\" style=\"width: 244px;height: 141px\" \/>\n<\/p>\n<p>\n\t\u9879\u76ee\u8fd0\u884c\u6548\u679c\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"pdf\u5728\u7ebf\u6d4f\u89c8\u6548\u679c\u56fe\" src=\"http:\/\/img.bbs.csdn.net\/upload\/201707\/14\/1500003982_989773.png\" style=\"width: 1163px;height: 276px\" \/>\u70b9\u51fb\u67e5\u770b\u8fd0\u884c\u6548\u679c\uff1a<a href=\"http:\/\/mozilla.github.io\/pdf.js\/web\/viewer.html\" name=\"pdf \u5728\u7ebf\u9605\u8bfb\" target=\"_blank\" title=\"pdf \u5728\u7ebf\u9605\u8bfb\">http:\/\/mozilla.github.io\/pdf.js\/web\/viewer.html<\/a>\n<\/p>\n<p>\n\t\u6ce8\u610f\uff1a\u5982\u679c\u9047\u5230\u65e0\u6cd5\u9605\u8bfb\u7684\u60c5\u51b5\uff0c\u8bf7\u6309\u4e0b\u56fe\u64cd\u4f5c\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\u8bbe\u7f6e\u6d4f\u89c8\u5668\u81ea\u5b9a\u4e49\u5b89\u5168\u7ea7\u522b\" src=\"http:\/\/img.bbs.csdn.net\/upload\/201704\/18\/1492504085_850201.png\" style=\"width: 768px;height: 512px\" \/><\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=1352\">\u8be6\u89e3 \u4f7f\u7528pdf.js \u63d2\u4ef6\u5b9e\u73b0pdf\u6587\u6863\u5728\u7ebf\u6d4f\u89c8\u529f\u80fd<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u5728\u5f88\u65e9\u4e4b\u524d\u5c31\u60f3\u5b9e\u73b0\u4e00\u4e2apdf\u5728\u7ebf\u9884\u89c8\u7684\u529f\u80fd\uff0c\u53ea\u662f\u9650\u4e8e\u6d41\u91cf\u548c\u5bf9\u670d\u52a1\u5668\u6027\u80fd\u8981\u6c42\u8f83\u9ad8\u4f5c\u7f62\u3002\u73b0\u5728\u672c\u6587\u5c06\u5176\u4e2d\u6d89\u53ca\u7684\u5230\u5173\u952e [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[31,119,1106,1105],"class_list":["post-1352","post","type-post","status-publish","format-standard","hentry","category-html5","tag-canvas","tag-html5","tag-javascript","tag-pdf-js"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1352"}],"version-history":[{"count":2,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1352\/revisions"}],"predecessor-version":[{"id":1637,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1352\/revisions\/1637"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}