1. Pdfjs-dist does not display signatures during rendering by default, so it is necessary to comment out the parts that do not display signatures in the source code
2. Internet Explorer browser is not supported, so the source code needs to be modified to support Internet Explorer. At the same time, the installation of PDFJS-dist must install the corresponding version, the current version: 2.0.489, (different versions of some API use is different). Download the source code and place it in a static source file:, the code will directly reference the local source, the code is as follows:
// Set the viewport width to -20px and height to -40px. High) = (900, 800) const PdfViewerDom = document.getElementById('PdfViewer') const defaultW = (PdfViewerDom && PdfViewerDom.offsetWidth) - PageMarginVertical || DefaultPageWidth const defaultH = (PdfViewerDom && PdfViewerDom.offsetHeight) - PageMarginHorizontal || DefaultPageHeight return import('pdfjs-dist').then(PDFJS => { // PDFJS.GlobalWorkerOptions.workerSrc = '/static/pdf.woker.min.js' return PDFJS.getDocument({ url: this.url, // workerSrc: '', cMapUrl: `./static/cmaps/`, cMapPacked: True}). Then (async PDF => {// this.total = pdf.numpages this.pdfSource = PDF) Const pagesArr = [] for (let I = 0; const pagesArr = [] for (let I = 0; i < PDF.numPages; i++) { pagesArr.push({ pageNum: i + PageStep, width: defaultW, height: defaultH }) } return { total: PDF.numPages, pages: pagesArr } }) .catch(err => { console.log(err) console.error(err) }) }) }Copy the code
3. Ie10 does not support setDragImage
It will be executed only if setDragImage exists, which does not affect the use at present
4. CMapUrl needs to be configured if some special fonts are not displayed on the PDF. You can find them on the official website or download them locally and put them in static resources