pdf.js使用问题


问题:使用pdf.js双方跨域
viewer.html?file=http://www.chuanbaofund.com/关于《川宝车厘子自由一号私募证券投资基金》成立的公告.pdf:1 Access to fetch at 'xx/xx.pdf' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
方案:
步骤1:
注释掉pdf.js里的1846-1848行,先使自己的项目能跨域

步骤2:
服务器设置http:响应头

但是放到服务器又发现一个问题,pdf.js功能都变成英文了,
所以需要配置以下

引用连接:
https://my.oschina.net/tigerBin/blog/1802998
https://www.cnblogs.com/sharestone/p/7105486.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM