const pdfJS = window["pdfjs-dist/build/pdf"]; import { ref } import 'vue'; const pdfEnd = ref(0); // 尾页码 const myCanvas = ref(null); // 拿到pdf dom let pdfObj = null; // 用于保存pdf实例 const curPage = ref(1); // 当前页 const getPage = (pdf, pageNumber) => { ...
pdfToCanvas = (pdfArrayBuffer) => { const that = this; return new Promise(async (resolve, reject) => { const pdfData = await PDFJS.getDocument(pdfArrayBuffer); const fragment = document.createDocumentFragment(); const canvasBox =this.refs.info; const numPages = pdfData.numPages; that.set...
import { PDFDocumentProxy, PDFSource, PDFProgressData } from 'pdfjs-dist'; 报错的大意是pdfjs-dist没有导出这三个对象。 后来看了下node_modules/ng2-pdf-viewer/package.json,其中有以下配置: "dependencies": { "@types/pdfjs-dist": "^2.1.3", "pdfjs-dist": "^2.4.456", "tslib": "^1.10...
pdfToCanvas=(pdfArrayBuffer)=>{constthat=this;returnnewPromise(async(resolve,reject)=>{constpdfData=awaitPDFJS.getDocument(pdfArrayBuffer);constfragment=document.createDocumentFragment();constcanvasBox=this.refs.info;constnumPages=pdfData.numPages;that.setState({number:numPages})for(leti=1;i<=numPages...