草庐IT

pdfjs-dist 编译报错

Moduleparsefailed:Unexpectedtoken(2902:55)Filewasprocessedwiththeseloaders:*./node_modules/cache-loader/dist/cjs.js*./node_modules/babel-loader/lib/index.jsYoumayneedanadditionalloadertohandletheresultoftheseloaders.|intent:renderingIntent,|renderInteractiveForms:renderInteractiveForms===true,>annot

前端pdf预览、pdfjs的使用

前言关于前端预览pdf,最简单的方式是使用window.open()直接在浏览器的新窗口打开就好,浏览器本身也是提供了非常多的功能但是因为客户的某些需求,不能使用浏览器自身的功能。后来又使用了https://github.com/gjTool/pdfh5,也挺好用的,操作比较简单。使用了一段时间吧,但是还是由于客户的某些需求,最终还是放弃了。百度查询了一下可以使用https://github.com/mozilla/pdf.js来实现功能自定义。pdfjs官方文档、examples、APIhttps://mozilla.github.io/pdf.js/安装npminstallpdfjs-di
12