File tree Expand file tree Collapse file tree 9 files changed +49
-17
lines changed Expand file tree Collapse file tree 9 files changed +49
-17
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,14 @@ if (!pdfjsLib.getDocument || !pdfjsViewer.PDFPageView) {
1818 alert ( "Please build the pdfjs-dist library using\n `gulp dist-install`" ) ;
1919}
2020
21+ pdfjsLib . GlobalWorkerOptions . workerSrc = new URL (
22+ '../../node_modules/pdfjs-dist/build/pdf.worker.mjs' ,
23+ import . meta. url
24+ ) ;
2125// The workerSrc property shall be specified.
2226//
23- pdfjsLib . GlobalWorkerOptions . workerSrc =
24- "../../node_modules/pdfjs-dist/build/pdf.worker.mjs" ;
27+ // pdfjsLib.GlobalWorkerOptions.workerSrc =
28+ // "../../node_modules/pdfjs-dist/build/pdf.worker.mjs";
2529
2630// Some PDFs need external cmaps.
2731//
Original file line number Diff line number Diff line change @@ -18,10 +18,14 @@ if (!pdfjsLib.getDocument || !pdfjsViewer.PDFViewer) {
1818 alert ( "Please build the pdfjs-dist library using\n `gulp dist-install`" ) ;
1919}
2020
21+ pdfjsLib . GlobalWorkerOptions . workerSrc = new URL (
22+ '../../node_modules/pdfjs-dist/build/pdf.worker.mjs' ,
23+ import . meta. url
24+ ) ;
2125// The workerSrc property shall be specified.
2226//
23- pdfjsLib . GlobalWorkerOptions . workerSrc =
24- "../../node_modules/pdfjs-dist/build/pdf.worker.mjs" ;
27+ // pdfjsLib.GlobalWorkerOptions.workerSrc =
28+ // "../../node_modules/pdfjs-dist/build/pdf.worker.mjs";
2529
2630// Some PDFs need external cmaps.
2731//
Original file line number Diff line number Diff line change @@ -18,10 +18,14 @@ if (!pdfjsLib.getDocument || !pdfjsViewer.PDFSinglePageViewer) {
1818 alert ( "Please build the pdfjs-dist library using\n `gulp dist-install`" ) ;
1919}
2020
21+ pdfjsLib . GlobalWorkerOptions . workerSrc = new URL (
22+ '../../node_modules/pdfjs-dist/build/pdf.worker.mjs' ,
23+ import . meta. url
24+ ) ;
2125// The workerSrc property shall be specified.
2226//
23- pdfjsLib . GlobalWorkerOptions . workerSrc =
24- "../../node_modules/pdfjs-dist/build/pdf.worker.mjs" ;
27+ // pdfjsLib.GlobalWorkerOptions.workerSrc =
28+ // "../../node_modules/pdfjs-dist/build/pdf.worker.mjs";
2529
2630// Some PDFs need external cmaps.
2731//
Original file line number Diff line number Diff line change @@ -31,11 +31,15 @@ <h1>'Hello, world!' example</h1>
3131 'MDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9v' +
3232 'dCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G' ) ;
3333
34+ pdfjsLib . GlobalWorkerOptions . workerSrc = new URL (
35+ '../../node_modules/pdfjs-dist/build/pdf.worker.mjs' ,
36+ import . meta. url
37+ ) ;
3438 //
3539 // The workerSrc property shall be specified.
3640 //
37- pdfjsLib . GlobalWorkerOptions . workerSrc =
38- '../../node_modules/pdfjs-dist/build/pdf.worker.mjs' ;
41+ // pdfjsLib.GlobalWorkerOptions.workerSrc =
42+ // '../../node_modules/pdfjs-dist/build/pdf.worker.mjs';
3943
4044 // Opening PDF by passing its binary data as a string. It is still preferable
4145 // to use Uint8Array, but string or array-like structure will work too.
Original file line number Diff line number Diff line change @@ -28,13 +28,17 @@ <h1>'Previous/Next' example</h1>
2828 //
2929 var url = '../../web/compressed.tracemonkey-pldi-09.pdf' ;
3030
31+ pdfjsLib . GlobalWorkerOptions . workerSrc = new URL (
32+ '../../node_modules/pdfjs-dist/build/pdf.worker.mjs' ,
33+ import . meta. url
34+ ) ;
3135 //
3236 // In cases when the pdf.worker.js is located at the different folder than the
3337 // PDF.js's one, or the PDF.js is executed via eval(), the workerSrc property
3438 // shall be specified.
3539 //
36- pdfjsLib . GlobalWorkerOptions . workerSrc =
37- '../../node_modules/pdfjs-dist/build/pdf.worker.mjs' ;
40+ // pdfjsLib.GlobalWorkerOptions.workerSrc =
41+ // '../../node_modules/pdfjs-dist/build/pdf.worker.mjs';
3842
3943 var pdfDoc = null ,
4044 pageNum = 1 ,
Original file line number Diff line number Diff line change @@ -24,8 +24,12 @@ const MAX_IMAGE_SIZE = 1024 * 1024;
2424const CMAP_URL = "../../node_modules/pdfjs-dist/cmaps/" ;
2525const CMAP_PACKED = true ;
2626
27- pdfjsLib . GlobalWorkerOptions . workerSrc =
28- "../../node_modules/pdfjs-dist/build/pdf.worker.mjs" ;
27+ pdfjsLib . GlobalWorkerOptions . workerSrc = new URL (
28+ '../../node_modules/pdfjs-dist/build/pdf.worker.mjs' ,
29+ import . meta. url
30+ ) ;
31+ // pdfjsLib.GlobalWorkerOptions.workerSrc =
32+ // "../../node_modules/pdfjs-dist/build/pdf.worker.mjs";
2933
3034const DEFAULT_URL = "../../web/compressed.tracemonkey-pldi-09.pdf" ;
3135const DEFAULT_SCALE_DELTA = 1.1 ;
Original file line number Diff line number Diff line change @@ -18,8 +18,12 @@ const PAGE_NUMBER = 1;
1818const PAGE_SCALE = 1.5 ;
1919const SVG_NS = "http://www.w3.org/2000/svg" ;
2020
21- pdfjsLib . GlobalWorkerOptions . workerSrc =
22- "../../node_modules/pdfjs-dist/build/pdf.worker.mjs" ;
21+ pdfjsLib . GlobalWorkerOptions . workerSrc = new URL (
22+ '../../node_modules/pdfjs-dist/build/pdf.worker.mjs' ,
23+ import . meta. url
24+ ) ;
25+ // pdfjsLib.GlobalWorkerOptions.workerSrc =
26+ // "../../node_modules/pdfjs-dist/build/pdf.worker.mjs";
2327
2428function buildSVG ( viewport , textContent ) {
2529 // Building SVG with size of the viewport (for simplicity)
Original file line number Diff line number Diff line change @@ -7,9 +7,13 @@ import * as pdfjsLib from "pdfjs-dist";
77
88const pdfPath = "../learning/helloworld.pdf" ;
99
10+ pdfjsLib . GlobalWorkerOptions . workerSrc = new URL (
11+ '../../build/webpack/pdf.worker.bundle.js' ,
12+ import . meta. url
13+ ) ;
1014// Setting worker path to worker bundle.
11- pdfjsLib . GlobalWorkerOptions . workerSrc =
12- "../../build/webpack/pdf.worker.bundle.js" ;
15+ // pdfjsLib.GlobalWorkerOptions.workerSrc =
16+ // "../../build/webpack/pdf.worker.bundle.js";
1317
1418// Loading a document.
1519const loadingTask = pdfjsLib . getDocument ( pdfPath ) ;
Original file line number Diff line number Diff line change 11{
2- "version" : " 2.16.105 " ,
2+ "version" : " 4.6.82 " ,
33 "build" : 305 ,
44 "commit" : " eaaa8b4"
55}
You can’t perform that action at this time.
0 commit comments