@papyrus-sdk/engine-pdfjs 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +6 -5
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -5,17 +5,18 @@ Web engine for PDF documents, powered by PDF.js.
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install @papyrus-sdk/engine-pdfjs
8
+ npm install @papyrus-sdk/engine-pdfjs pdfjs-dist
9
9
  ```
10
10
 
11
11
  ## Usage
12
12
 
13
13
  ```ts
14
- import { PDFJSEngine } from '@papyrus-sdk/engine-pdfjs';
15
- import * as pdfjsLib from 'pdfjs-dist';
14
+ import { PDFJSEngine, setPdfjsLib, configurePdfjsWorker } from '@papyrus-sdk/engine-pdfjs';
15
+ import * as pdfjsLib from 'pdfjs-dist/legacy/build/pdf';
16
+ import workerUrl from 'pdfjs-dist/build/pdf.worker?url';
16
17
 
17
- // pdfjsLib is expected as a global in the engine
18
- (globalThis as any).pdfjsLib = pdfjsLib;
18
+ setPdfjsLib(pdfjsLib);
19
+ configurePdfjsWorker(workerUrl, pdfjsLib);
19
20
 
20
21
  const engine = new PDFJSEngine();
21
22
  await engine.load({ type: 'pdf', source: { uri: 'https://example.com/book.pdf' } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papyrus-sdk/engine-pdfjs",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "papyrus",