pdf预览 小咪咪 2023-07-25 06:25 1阅读 0赞 > 首先下载pdf.js插件,放到项目里面 > > 官网下载地址:[http://mozilla.github.io/pdf.js/getting\_started/\#download][http_mozilla.github.io_pdf.js_getting_started_download] ![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1N1bnNoaW5lQmxvZw_size_16_color_FFFFFF_t_70][] > 在页面引入pdf.js,然后进行下图操作 <button onclick="prepdf()">预览</button> <script src="~/Scripts/jquery-3.3.1.min.js"></script> <script src="~/Content/pdf/build/pdf.js"></script> <script> function prepdf() { var file = "/Content/测试.pdf" window.open("/Content/pdf/web/viewer.html?file=" + file); } </script> 效果如下: ![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1N1bnNoaW5lQmxvZw_size_16_color_FFFFFF_t_70 1][] [http_mozilla.github.io_pdf.js_getting_started_download]: http://mozilla.github.io/pdf.js/getting_started/#download [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1N1bnNoaW5lQmxvZw_size_16_color_FFFFFF_t_70]: /images/20230528/7b74419dd7c1414f8a16c61ef435f806.png [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1N1bnNoaW5lQmxvZw_size_16_color_FFFFFF_t_70 1]: /images/20230528/f51cf595e20049b1baeeea4218c73349.png
还没有评论,来说两句吧...