Я использую pdfjs
в проекте VUE. Некоторые страницы могут отображаться правильно, но когда вы встречаете некоторые специальные символы, pdfjs
не показывает их.
Я не знаю, как показать слова специальными шрифтами.
получить pdfjs
объект
const pdfWorkerUrl = that.common.PdfWorker;
window.fetch(pdfWorkerUrl).then(response => response.text()).then((res) => {
PDFJS.GlobalWorkerOptions.workerPort = new window.Worker(
window.URL.createObjectURL(new window.Blob([res])));
});
Загрузить PDF
that.pdfjsDocument = PDFJS.getDocument(this.pdfUrl);
that.pdfjsDocument.onProgress = () => {
// console.log(progress, total);
};
that.pdfjsDocument.then((pdf) => {
that.pdfPage = pdf;
that.pdfLoadState = 0;
that.loadPage(pdfUrl, index);
});
that.pdfPage.getPage(pageIndex).then((page) => {.......}
Фактически, он может отображать текст в обычных шрифтах.