pdfjs-serverless 0.4.0 → 0.4.2
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.
- package/README.md +11 -4
- package/dist/index.mjs +1 -1
- package/dist/types/src/display/api.d.ts +8 -7
- package/dist/types/src/display/display_utils.d.ts +3 -2
- package/dist/types/src/display/draw_layer.d.ts +40 -0
- package/dist/types/src/display/editor/alt_text.d.ts +21 -0
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +23 -2
- package/dist/types/src/display/editor/color_picker.d.ts +19 -0
- package/dist/types/src/display/editor/editor.d.ts +29 -15
- package/dist/types/src/display/editor/highlight.d.ts +54 -0
- package/dist/types/src/display/editor/ink.d.ts +3 -3
- package/dist/types/src/display/editor/outliner.d.ts +26 -0
- package/dist/types/src/display/editor/toolbar.d.ts +11 -0
- package/dist/types/src/display/editor/tools.d.ts +3 -1
- package/dist/types/src/pdf.d.ts +5 -1
- package/dist/types/src/shared/util.d.ts +5 -1
- package/dist/types/web/annotation_editor_layer_builder.d.ts +4 -0
- package/dist/types/web/draw_layer_builder.d.ts +23 -0
- package/dist/types/web/genericl10n.d.ts +3 -3
- package/dist/types/web/interfaces.d.ts +3 -3
- package/dist/types/web/l10n.d.ts +4 -2
- package/dist/types/web/pdf_link_service.d.ts +5 -5
- package/dist/types/web/pdf_page_view.d.ts +2 -1
- package/dist/types/web/pdf_scripting_manager.d.ts +6 -6
- package/dist/types/web/pdf_single_page_viewer.d.ts +2 -2
- package/dist/types/web/pdf_thumbnail_view.d.ts +1 -1
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +1 -1
- package/dist/types/web/pdf_viewer.d.ts +52 -13
- package/dist/types/web/ui_utils.d.ts +1 -1
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ A redistribution of Mozilla's [PDF.js](https://github.com/mozilla/pdf.js) for se
|
|
|
5
5
|
## PDF.js Compatibility
|
|
6
6
|
|
|
7
7
|
> [!NOTE]
|
|
8
|
-
> This package is currently using PDF.js v4.0.
|
|
8
|
+
> This package is currently using PDF.js v4.0.379.
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -33,6 +33,7 @@ declare function resolvePDFJS(): Promise<typeof PDFJS>
|
|
|
33
33
|
So, instead of importing the named exports directly:
|
|
34
34
|
|
|
35
35
|
```ts
|
|
36
|
+
// This will NOT work at the moment
|
|
36
37
|
import { getDocument } from 'pdfjs-serverless'
|
|
37
38
|
```
|
|
38
39
|
|
|
@@ -45,7 +46,7 @@ const { getDocument } = await resolvePDFJS()
|
|
|
45
46
|
```
|
|
46
47
|
|
|
47
48
|
> [!NOTE]
|
|
48
|
-
> Once Cloudflare workers support top-level await, we can remove this wrapper and
|
|
49
|
+
> Once Cloudflare workers support top-level await, we can remove this wrapper and re-export all PDF.js named exports directly again.
|
|
49
50
|
|
|
50
51
|
### 🦕 Deno
|
|
51
52
|
|
|
@@ -55,7 +56,10 @@ import { resolvePDFJS } from 'https://esm.sh/pdfjs-serverless'
|
|
|
55
56
|
// Initialize PDF.js
|
|
56
57
|
const { getDocument } = await resolvePDFJS()
|
|
57
58
|
const data = Deno.readFileSync('sample.pdf')
|
|
58
|
-
const doc = await getDocument(
|
|
59
|
+
const doc = await getDocument({
|
|
60
|
+
data,
|
|
61
|
+
useSystemFonts: true,
|
|
62
|
+
}).promise
|
|
59
63
|
|
|
60
64
|
console.log(await doc.getMetadata())
|
|
61
65
|
|
|
@@ -86,7 +90,10 @@ async function handleRequest(request) {
|
|
|
86
90
|
|
|
87
91
|
// Initialize PDF.js
|
|
88
92
|
const { getDocument } = await resolvePDFJS()
|
|
89
|
-
const doc = await getDocument(
|
|
93
|
+
const doc = await getDocument({
|
|
94
|
+
data,
|
|
95
|
+
useSystemFonts: true,
|
|
96
|
+
}).promise
|
|
90
97
|
|
|
91
98
|
// Get metadata and initialize output object
|
|
92
99
|
const metadata = await doc.getMetadata()
|