aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/pdf/PDFViewer.tsx6
-rw-r--r--src/typings/index.d.ts1
2 files changed, 6 insertions, 1 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 83b3dffe5..f6f319831 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -2,7 +2,11 @@ import { action, computed, IReactionDisposer, makeObservable, observable, Observ
import { observer } from 'mobx-react';
import * as Pdfjs from 'pdfjs-dist';
import * as PDFJSViewer from 'pdfjs-dist/web/pdf_viewer.mjs';
-import 'pdfjs-dist/webpack.mjs'; // sets the PDF workerSrc
+import { GlobalWorkerOptions } from 'pdfjs-dist/build/pdf.mjs';
+if (typeof window !== 'undefined' && 'Worker' in window) {
+ GlobalWorkerOptions.workerSrc = 'files/pdf.worker.min.mjs';
+}
+export * from 'pdfjs-dist/build/pdf.mjs';
import * as React from 'react';
import { addStyleSheet, addStyleSheetRule, clearStyleSheetRules, ClientUtils, returnAll, returnFalse, returnNone, returnZero, smoothScroll } from '../../../ClientUtils';
import { CreateLinkToActiveAudio, Doc, DocListCast, Opt } from '../../../fields/Doc';
diff --git a/src/typings/index.d.ts b/src/typings/index.d.ts
index dbfabed51..abcec13c0 100644
--- a/src/typings/index.d.ts
+++ b/src/typings/index.d.ts
@@ -11,6 +11,7 @@ declare module 'bezier-curve';
declare module 'fit-curve';
declare module 'iink-js';
declare module 'pdfjs-dist/web/pdf_viewer';
+declare module 'pdfjs-dist/build/pdf.mjs';
declare module 'react-jsx-parser';
declare module 'type_decls.d';
declare module 'standard-http-error';