Skip to content

Commit f9610e4

Browse files
fix: set pdf worker path synchronously
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent e24cdc1 commit f9610e4

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/helpers/pdfWorker.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55
import { setWorkerPath } from '@libresign/pdf-elements'
6+
import pdfWorkerUrl from 'pdfjs-dist/legacy/build/pdf.worker.min.mjs?url'
67

78
let configured = false
89

@@ -11,11 +12,5 @@ export const ensurePdfWorker = (): void => {
1112
return
1213
}
1314
configured = true
14-
import('pdfjs-dist/legacy/build/pdf.worker.min.mjs?url')
15-
.then((mod) => {
16-
setWorkerPath(mod.default as string)
17-
})
18-
.catch((error) => {
19-
console.error('Failed to load pdf.js worker URL:', error)
20-
})
15+
setWorkerPath(pdfWorkerUrl)
2116
}

0 commit comments

Comments
 (0)