一、下载地址

        http://mozilla.github.io/pdf.js/getting_started/#download

      下载稳定版

二、文件说明

       1、下载解压后文件内容如下

           

        2、直接打开viewer.html,加载出来的是空白的,pdf没有加载出来

             

            

        3、部署到tomcat上,启动项目,打开viewer.html,可以得到一个默认的pdf

           

三、打开自己需要展示的pdf页面

        1、传入pdf文件file=url(文件路径)

           

           注:file所携带的参数就是你要展示的pdf文件的路径

        2、展示页面如下

           

四、跨域问题报错

        1、跨域问题报错解决方案

              注释viewer.js中如下代码1564——1566行

                if (origin !== viewerOrigin && protocol !== 'blob:') {
                      throw new Error('file origin does not match viewer\'s');
                   }

       

           

           

GitHub 加速计划 / pd / pdf.js
47.48 K
9.86 K
下载
PDF Reader in JavaScript
最近提交(Master分支:1 个月前 )
18284815 [Editor] Update the disclaimer string in the new alt-text dialog (bug 1911738) 1 个月前
fc602c65 And tweak the css in order to take into account that disclaimer can be on two (or more lines). 1 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐