用pdf.js展示,pdf中有中文不显示问题
var pdfData=atob('....') pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://unpkg.com/pdfjs-dist@2.0.489/build/pdf.worker.min.js';// pdfjsLib.cMapUrl = './cmaps/'; pdfjsLib.getDocument({data: pdfData}).then(function getPdfHelloWorld(pdf) { pdf.getPage(1).then(function getPageHelloWorld(page) { var scale = 1.5; var viewport = page.getViewport(scale); var canvas = document.getElementById('the-canvas'); var context = canvas.getContext('2d'); canvas.height = viewport.height; canvas.width = viewport.width; var renderContext = { canvasContext: context, viewport: viewport }; page.render(renderContext); }); });
在页面中的截图
应该是有中文的,但是没显示。