Skip to content

Commit

Permalink
fix: Update documentation to reference 4.x pdf.js worker extension
Browse files Browse the repository at this point in the history
In v4.x of PDF.js the build files have changed from .js to .mjs

This commit updates the example usage in the README from .js to .mjs to closer align to the most common use case for this section
  • Loading branch information
studioromeo authored Sep 15, 2024
1 parent 1af9d33 commit 2659b40
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,9 @@ onFileSelected() {

By default the `worker` is loaded from `cdn.jsdelivr.net`.

In your code update `path` to the worker to be for example `/pdf.worker.js`
In your code update `path` to the worker to be for example `/pdf.worker.mjs`
```typescript
(window as any).pdfWorkerSrc = '/pdf.worker.js';
(window as any).pdfWorkerSrc = '/pdf.worker.mjs';
```

*This should be set before `pdf-viewer` component is rendered.*
Expand All @@ -524,7 +524,7 @@ but using different versions of pdf.worker, support has been added. You can do
above, except that you can append the specific version of pdfjs required and override the
custom path *just for that version*. This way setting the global window var won't conflict.
```typescript
(window as any)["pdfWorkerSrc2.14.305"] = '/pdf.worker.js';
(window as any)["pdfWorkerSrc2.14.305"] = '/pdf.worker.mjs';
```

## Search in the PDF
Expand Down

0 comments on commit 2659b40

Please sign in to comment.