mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 03:20:46 +02:00
Update PDF.js integration and dependencies (#4360)
Co-authored-by: ConnorYoh <[email protected]> Co-authored-by: Reece Browne <[email protected]>
This commit is contained in:
co-authored by
ConnorYoh
Reece Browne
parent
13eff6b333
commit
25bedf064f
@@ -5,9 +5,7 @@
|
||||
* and ensuring proper cleanup when operations complete.
|
||||
*/
|
||||
|
||||
import * as pdfjsLib from 'pdfjs-dist';
|
||||
import { PDFDocumentProxy } from 'pdfjs-dist/types/src/display/api';
|
||||
const { getDocument, GlobalWorkerOptions } = pdfjsLib;
|
||||
import { GlobalWorkerOptions, getDocument, PDFDocumentProxy } from 'pdfjs-dist/legacy/build/pdf.mjs';
|
||||
|
||||
class PDFWorkerManager {
|
||||
private static instance: PDFWorkerManager;
|
||||
@@ -32,7 +30,10 @@ class PDFWorkerManager {
|
||||
*/
|
||||
private initializeWorker(): void {
|
||||
if (!this.isInitialized) {
|
||||
GlobalWorkerOptions.workerSrc = '/pdf.worker.js';
|
||||
GlobalWorkerOptions.workerSrc = new URL(
|
||||
'pdfjs-dist/legacy/build/pdf.worker.min.mjs',
|
||||
import.meta.url
|
||||
).toString();
|
||||
this.isInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user