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:
Ludy
2025-09-24 13:07:27 +01:00
committed by GitHub
co-authored by ConnorYoh Reece Browne
parent 13eff6b333
commit 25bedf064f
15 changed files with 3446 additions and 64174 deletions
+5 -4
View File
@@ -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;
}
}