diff --git a/src/index.js b/src/index.js index ba3108d..048ee87 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,13 @@ // SPDX-FileCopyrightText: 2026 LibreCode coop and contributors // SPDX-License-Identifier: AGPL-3.0-or-later +import { GlobalWorkerOptions } from 'pdfjs-dist' +import pdfWorkerCode from 'pdfjs-dist/build/pdf.worker.min.mjs' + +GlobalWorkerOptions.workerSrc = pdfWorkerCode + import PDFElements from './components/PDFElements.vue' +export { setWorkerPath } from './utils/asyncReader.js' PDFElements.install = function(Vue) { if (PDFElements.install.installed) return diff --git a/src/utils/asyncReader.js b/src/utils/asyncReader.js index 5066c18..26035ee 100644 --- a/src/utils/asyncReader.js +++ b/src/utils/asyncReader.js @@ -6,6 +6,10 @@ import pdfWorkerCode from 'pdfjs-dist/build/pdf.worker.min.mjs' GlobalWorkerOptions.workerSrc = pdfWorkerCode +export function setWorkerPath(path) { + GlobalWorkerOptions.workerSrc = path +} + export function readAsArrayBuffer(file) { return new Promise((resolve, reject) => { const reader = new FileReader()