unpdf 0.5.3 → 0.6.0
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 +64 -31
- package/dist/index.node.cjs +8 -9
- package/dist/index.node.d.cts +4 -4
- package/dist/index.node.d.mts +4 -4
- package/dist/index.node.d.ts +4 -4
- package/dist/index.node.mjs +2 -3
- package/dist/index.web.cjs +8 -9
- package/dist/index.web.d.cts +4 -4
- package/dist/index.web.d.mts +4 -4
- package/dist/index.web.d.ts +4 -4
- package/dist/index.web.mjs +2 -3
- package/dist/index.worker.cjs +14 -11
- package/dist/index.worker.d.cts +4 -4
- package/dist/index.worker.d.mts +4 -4
- package/dist/index.worker.d.ts +4 -4
- package/dist/index.worker.mjs +12 -8
- package/dist/pdfjs.d.mts +1 -0
- package/dist/pdfjs.d.ts +1 -0
- package/dist/pdfjs.mjs +1 -0
- package/dist/shared/{unpdf.d3d8f5ac.d.mts → unpdf.3991886a.d.cts} +11 -9
- package/dist/shared/{unpdf.d3d8f5ac.d.cts → unpdf.3991886a.d.mts} +11 -9
- package/dist/shared/{unpdf.d3d8f5ac.d.ts → unpdf.3991886a.d.ts} +11 -9
- package/dist/shared/unpdf.6c0ca5b5.cjs +107 -0
- package/dist/shared/unpdf.ce219a40.mjs +99 -0
- package/dist/types/external/webL10n/l10n.d.ts +0 -0
- package/dist/types/src/display/annotation_layer.d.ts +203 -0
- package/dist/types/src/display/annotation_storage.d.ts +89 -0
- package/dist/types/src/display/api.d.ts +1466 -0
- package/dist/types/src/display/base_factory.d.ts +54 -0
- package/dist/types/src/display/canvas.d.ts +208 -0
- package/dist/types/src/display/display_utils.d.ts +277 -0
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +196 -0
- package/dist/types/src/display/editor/editor.d.ts +325 -0
- package/dist/types/src/display/editor/freetext.d.ts +72 -0
- package/dist/types/src/display/editor/ink.d.ts +95 -0
- package/dist/types/src/display/editor/stamp.d.ts +28 -0
- package/dist/types/src/display/editor/tools.d.ts +349 -0
- package/dist/types/src/display/font_loader.d.ts +43 -0
- package/dist/types/src/display/metadata.d.ts +11 -0
- package/dist/types/src/display/optional_content_config.d.ts +13 -0
- package/dist/types/src/display/pattern_helper.d.ts +73 -0
- package/dist/types/src/display/text_layer.d.ts +151 -0
- package/dist/types/src/display/transport_stream.d.ts +68 -0
- package/dist/types/src/display/worker_options.d.ts +27 -0
- package/dist/types/src/display/xfa_layer.d.ts +46 -0
- package/dist/types/src/display/xfa_text.d.ts +19 -0
- package/dist/types/src/pdf.d.ts +50 -0
- package/dist/types/src/shared/image_utils.d.ts +17 -0
- package/dist/types/src/shared/message_handler.d.ts +43 -0
- package/dist/types/src/shared/murmurhash3.d.ts +7 -0
- package/dist/types/src/shared/scripting_utils.d.ts +16 -0
- package/dist/types/src/shared/util.d.ts +398 -0
- package/dist/types/web/annotation_editor_layer_builder.d.ts +50 -0
- package/dist/types/web/annotation_layer_builder.d.ts +83 -0
- package/dist/types/web/app_options.d.ts +14 -0
- package/dist/types/web/download_manager.d.ts +14 -0
- package/dist/types/web/event_utils.d.ts +75 -0
- package/dist/types/web/generic_scripting.d.ts +8 -0
- package/dist/types/web/genericl10n.d.ts +13 -0
- package/dist/types/web/interfaces.d.ts +163 -0
- package/dist/types/web/l10n_utils.d.ts +7 -0
- package/dist/types/web/pdf_find_controller.d.ts +108 -0
- package/dist/types/web/pdf_find_utils.d.ts +16 -0
- package/dist/types/web/pdf_history.d.ts +168 -0
- package/dist/types/web/pdf_link_service.d.ts +243 -0
- package/dist/types/web/pdf_page_view.d.ts +209 -0
- package/dist/types/web/pdf_rendering_queue.d.ts +53 -0
- package/dist/types/web/pdf_scripting_manager.component.d.ts +5 -0
- package/dist/types/web/pdf_scripting_manager.d.ts +61 -0
- package/dist/types/web/pdf_single_page_viewer.d.ts +7 -0
- package/dist/types/web/pdf_thumbnail_view.d.ts +131 -0
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +104 -0
- package/dist/types/web/pdf_viewer.component.d.ts +24 -0
- package/dist/types/web/pdf_viewer.d.ts +455 -0
- package/dist/types/web/struct_tree_layer_builder.d.ts +7 -0
- package/dist/types/web/text_accessibility.d.ts +42 -0
- package/dist/types/web/text_highlighter.d.ts +63 -0
- package/dist/types/web/text_layer_builder.d.ts +64 -0
- package/dist/types/web/ui_utils.d.ts +288 -0
- package/dist/types/web/xfa_layer_builder.d.ts +41 -0
- package/package.json +67 -41
- package/dist/shared/unpdf.61a2a4e1.cjs +0 -56
- package/dist/shared/unpdf.9511ac30.cjs +0 -52
- package/dist/shared/unpdf.c7f36e56.mjs +0 -50
- package/dist/shared/unpdf.cd67d475.mjs +0 -48
package/README.md
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
# unpdf
|
|
2
2
|
|
|
3
|
-
A collection of utilities to work with PDFs.
|
|
3
|
+
A collection of utilities to work with PDFs. Designed specifically for Deno, workers and other nodeless environments.
|
|
4
4
|
|
|
5
|
-
`unpdf`
|
|
5
|
+
`unpdf` ships with a redistribution of Mozilla's [PDF.js](https://github.com/mozilla/pdf.js) for serverless environments. Apart from some string replacements and mocks, [`unenv`](https://github.com/unjs/unenv) does the heavy lifting by converting Node.js specific code to be platform-agnostic.
|
|
6
6
|
|
|
7
7
|
This library is also intended as a modern alternative to the unmaintained but still popular [`pdf-parse`](https://www.npmjs.com/package/pdf-parse).
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
- 🏗️
|
|
11
|
+
- 🏗️ Works in Node.js, browser and workers
|
|
12
|
+
- 🪭 Includes serverless build of PDF.js ([`unpdf/pdfjs`](./package.json#L45))
|
|
12
13
|
- 💬 Extract text and images from PDFs
|
|
13
14
|
- 🧱 Opt-in to legacy PDF.js build
|
|
15
|
+
- 💨 Zero dependencies
|
|
14
16
|
|
|
15
17
|
## Installation
|
|
16
18
|
|
|
@@ -29,32 +31,37 @@ yarn add unpdf
|
|
|
29
31
|
|
|
30
32
|
## Usage
|
|
31
33
|
|
|
34
|
+
### Extract Text From PDF
|
|
35
|
+
|
|
32
36
|
```ts
|
|
33
|
-
import { extractPDFText } from
|
|
37
|
+
import { extractPDFText } from "unpdf";
|
|
34
38
|
|
|
35
39
|
// Fetch a PDF file from the web
|
|
36
|
-
const pdf = await fetch(
|
|
37
|
-
.
|
|
40
|
+
const pdf = await fetch(
|
|
41
|
+
"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
|
|
42
|
+
).then((res) => res.arrayBuffer());
|
|
38
43
|
|
|
39
44
|
// Or load it from the filesystem
|
|
40
|
-
const pdf = await readFile(
|
|
45
|
+
const pdf = await readFile("./dummy.pdf");
|
|
41
46
|
|
|
42
47
|
// Pass the PDF buffer to the relevant method
|
|
43
|
-
const { totalPages, text } = await extractPDFText(
|
|
44
|
-
|
|
45
|
-
)
|
|
48
|
+
const { totalPages, text } = await extractPDFText(new Uint8Array(pdf), {
|
|
49
|
+
mergePages: true,
|
|
50
|
+
});
|
|
46
51
|
```
|
|
47
52
|
|
|
48
53
|
### Use Legacy Or Custom PDF.js Build
|
|
49
54
|
|
|
55
|
+
Typically, you don't need to worry about the PDF.js build. `unpdf` ships with a serverless build of the latest PDF.js version. However, if you want to use an older version or the legacy build, you can define a custom PDF.js module.
|
|
56
|
+
|
|
50
57
|
```ts
|
|
51
58
|
// Before using any other methods, define the PDF.js module
|
|
52
|
-
import { defineUnPDFConfig } from
|
|
59
|
+
import { defineUnPDFConfig } from "unpdf";
|
|
53
60
|
|
|
54
|
-
// Use the legacy build
|
|
55
61
|
defineUnPDFConfig({
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
// Use the legacy build
|
|
63
|
+
pdfjs: () => import("pdfjs-dist/legacy/build/pdf.js"),
|
|
64
|
+
});
|
|
58
65
|
|
|
59
66
|
// Now, you can use the other methods
|
|
60
67
|
// …
|
|
@@ -62,10 +69,32 @@ defineUnPDFConfig({
|
|
|
62
69
|
|
|
63
70
|
### Access the PDF.js Module
|
|
64
71
|
|
|
72
|
+
This will return the resolved PDF.js module. If no build is defined, the serverless build bundled with `unpdf` will be initialized.
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { getResolvedPDFJS } from "unpdf";
|
|
76
|
+
|
|
77
|
+
const { version } = await getResolvedPDFJS();
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Use Serverless PDF.js Build In 🦕 Deno
|
|
81
|
+
|
|
82
|
+
Instead of using the methods provided by `unpdf`, you can directly import the serverless PDF.js build in Deno. This is useful if you want to use the PDF.js API directly.
|
|
83
|
+
|
|
65
84
|
```ts
|
|
66
|
-
import {
|
|
85
|
+
import { getDocument } from "https://esm.sh/unpdf/pdfjs";
|
|
86
|
+
|
|
87
|
+
const data = Deno.readFileSync("dummy.pdf");
|
|
88
|
+
const doc = await getDocument(data).promise;
|
|
67
89
|
|
|
68
|
-
|
|
90
|
+
console.log(await doc.getMetadata());
|
|
91
|
+
|
|
92
|
+
for (let i = 1; i <= doc.numPages; i++) {
|
|
93
|
+
const page = await doc.getPage(i);
|
|
94
|
+
const textContent = await page.getTextContent();
|
|
95
|
+
const contents = textContent.items.map((item) => item.str).join(" ");
|
|
96
|
+
console.log(contents);
|
|
97
|
+
}
|
|
69
98
|
```
|
|
70
99
|
|
|
71
100
|
## Config
|
|
@@ -80,7 +109,7 @@ interface UnPDFConfiguration {
|
|
|
80
109
|
* @example
|
|
81
110
|
* () => import('pdfjs-dist/legacy/build/pdf.js')
|
|
82
111
|
*/
|
|
83
|
-
pdfjs?: () => Promise<typeof PDFJS
|
|
112
|
+
pdfjs?: () => Promise<typeof PDFJS>;
|
|
84
113
|
}
|
|
85
114
|
```
|
|
86
115
|
|
|
@@ -91,7 +120,7 @@ interface UnPDFConfiguration {
|
|
|
91
120
|
Define a custom PDF.js module, like the legacy build. Make sure to call this method before using any other methods.
|
|
92
121
|
|
|
93
122
|
```ts
|
|
94
|
-
function defineUnPDFConfig(config: UnPDFConfiguration): Promise<void
|
|
123
|
+
function defineUnPDFConfig(config: UnPDFConfiguration): Promise<void>;
|
|
95
124
|
```
|
|
96
125
|
|
|
97
126
|
### `getResolvedPDFJS`
|
|
@@ -99,18 +128,16 @@ function defineUnPDFConfig(config: UnPDFConfiguration): Promise<void>
|
|
|
99
128
|
Returns the resolved PDF.js module. If no build is defined, the latest version will be initialized.
|
|
100
129
|
|
|
101
130
|
```ts
|
|
102
|
-
function getResolvedPDFJS(): Promise<typeof import(
|
|
131
|
+
function getResolvedPDFJS(): Promise<typeof import("pdfjs-dist")>;
|
|
103
132
|
```
|
|
104
133
|
|
|
105
134
|
### `getPDFMeta`
|
|
106
135
|
|
|
107
136
|
```ts
|
|
108
|
-
function getPDFMeta(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
metadata: Record<string, any>
|
|
113
|
-
}>
|
|
137
|
+
function getPDFMeta(data: BinaryData | PDFDocumentProxy): Promise<{
|
|
138
|
+
info: Record<string, any>;
|
|
139
|
+
metadata: Record<string, any>;
|
|
140
|
+
}>;
|
|
114
141
|
```
|
|
115
142
|
|
|
116
143
|
### `extractPDFText`
|
|
@@ -118,11 +145,11 @@ function getPDFMeta(
|
|
|
118
145
|
```ts
|
|
119
146
|
function extractPDFText(
|
|
120
147
|
data: BinaryData | PDFDocumentProxy,
|
|
121
|
-
{ mergePages }?: { mergePages?: boolean }
|
|
148
|
+
{ mergePages }?: { mergePages?: boolean },
|
|
122
149
|
): Promise<{
|
|
123
|
-
totalPages: number
|
|
124
|
-
text: string | string[]
|
|
125
|
-
}
|
|
150
|
+
totalPages: number;
|
|
151
|
+
text: string | string[];
|
|
152
|
+
}>;
|
|
126
153
|
```
|
|
127
154
|
|
|
128
155
|
### `getImagesFromPage`
|
|
@@ -130,10 +157,16 @@ function extractPDFText(
|
|
|
130
157
|
```ts
|
|
131
158
|
function getImagesFromPage(
|
|
132
159
|
data: BinaryData | PDFDocumentProxy,
|
|
133
|
-
pageNumber: number
|
|
134
|
-
): Promise<ArrayBuffer[]
|
|
160
|
+
pageNumber: number,
|
|
161
|
+
): Promise<ArrayBuffer[]>;
|
|
135
162
|
```
|
|
136
163
|
|
|
164
|
+
## FAQ
|
|
165
|
+
|
|
166
|
+
### What About Canvas?
|
|
167
|
+
|
|
168
|
+
The official PDF.js library depends on the optional `canvas` module, which [doesn't work inside worker threads](https://github.com/Automattic/node-canvas/issues/1394). That's why `unpdf` ships with a serverless build of PDF.js that mocks the `canvas` module.
|
|
169
|
+
|
|
137
170
|
## License
|
|
138
171
|
|
|
139
172
|
[MIT](./LICENSE) License © 2023-PRESENT [Johann Schopplich](https://github.com/johannschopplich)
|
package/dist/index.node.cjs
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const image = require('./shared/unpdf.
|
|
4
|
-
const utils = require('./shared/unpdf.61a2a4e1.cjs');
|
|
3
|
+
const image = require('./shared/unpdf.6c0ca5b5.cjs');
|
|
5
4
|
|
|
6
5
|
const getPDFMeta = async (...args) => {
|
|
7
|
-
await
|
|
6
|
+
await image.resolvePDFJSImports();
|
|
8
7
|
return await image.getPDFMeta(...args);
|
|
9
8
|
};
|
|
10
9
|
const extractPDFText = async (...args) => {
|
|
11
|
-
await
|
|
10
|
+
await image.resolvePDFJSImports();
|
|
12
11
|
return await image.extractPDFText(...args);
|
|
13
12
|
};
|
|
14
13
|
const getImagesFromPage = async (...args) => {
|
|
15
|
-
await
|
|
14
|
+
await image.resolvePDFJSImports();
|
|
16
15
|
return await image.getImagesFromPage(...args);
|
|
17
16
|
};
|
|
18
17
|
|
|
19
|
-
exports.defineUnPDFConfig =
|
|
20
|
-
exports.getDocumentProxy =
|
|
21
|
-
exports.getResolvedPDFJS =
|
|
22
|
-
exports.resolvePDFJSImports =
|
|
18
|
+
exports.defineUnPDFConfig = image.defineUnPDFConfig;
|
|
19
|
+
exports.getDocumentProxy = image.getDocumentProxy;
|
|
20
|
+
exports.getResolvedPDFJS = image.getResolvedPDFJS;
|
|
21
|
+
exports.resolvePDFJSImports = image.resolvePDFJSImports;
|
|
23
22
|
exports.extractPDFText = extractPDFText;
|
|
24
23
|
exports.getImagesFromPage = getImagesFromPage;
|
|
25
24
|
exports.getPDFMeta = getPDFMeta;
|
package/dist/index.node.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.
|
|
2
|
-
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
1
|
+
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3991886a.cjs';
|
|
2
|
+
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3991886a.cjs';
|
|
3
|
+
import 'types/src/display/api';
|
|
4
|
+
import 'types/src/pdf';
|
|
5
5
|
|
|
6
6
|
declare const getPDFMeta: typeof getPDFMeta$1;
|
|
7
7
|
declare const extractPDFText: typeof extractPDFText$1;
|
package/dist/index.node.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.
|
|
2
|
-
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
1
|
+
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3991886a.mjs';
|
|
2
|
+
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3991886a.mjs';
|
|
3
|
+
import 'types/src/display/api';
|
|
4
|
+
import 'types/src/pdf';
|
|
5
5
|
|
|
6
6
|
declare const getPDFMeta: typeof getPDFMeta$1;
|
|
7
7
|
declare const extractPDFText: typeof extractPDFText$1;
|
package/dist/index.node.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.
|
|
2
|
-
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
1
|
+
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3991886a.js';
|
|
2
|
+
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3991886a.js';
|
|
3
|
+
import 'types/src/display/api';
|
|
4
|
+
import 'types/src/pdf';
|
|
5
5
|
|
|
6
6
|
declare const getPDFMeta: typeof getPDFMeta$1;
|
|
7
7
|
declare const extractPDFText: typeof extractPDFText$1;
|
package/dist/index.node.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.
|
|
2
|
-
|
|
3
|
-
export { d as defineUnPDFConfig, g as getDocumentProxy, a as getResolvedPDFJS } from './shared/unpdf.c7f36e56.mjs';
|
|
1
|
+
import { r as resolvePDFJSImports, g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.ce219a40.mjs';
|
|
2
|
+
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS } from './shared/unpdf.ce219a40.mjs';
|
|
4
3
|
|
|
5
4
|
const getPDFMeta = async (...args) => {
|
|
6
5
|
await resolvePDFJSImports();
|
package/dist/index.web.cjs
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const image = require('./shared/unpdf.
|
|
4
|
-
const utils = require('./shared/unpdf.61a2a4e1.cjs');
|
|
3
|
+
const image = require('./shared/unpdf.6c0ca5b5.cjs');
|
|
5
4
|
|
|
6
5
|
const getPDFMeta = async (...args) => {
|
|
7
|
-
await
|
|
6
|
+
await image.resolvePDFJSImports();
|
|
8
7
|
return await image.getPDFMeta(...args);
|
|
9
8
|
};
|
|
10
9
|
const extractPDFText = async (...args) => {
|
|
11
|
-
await
|
|
10
|
+
await image.resolvePDFJSImports();
|
|
12
11
|
return await image.extractPDFText(...args);
|
|
13
12
|
};
|
|
14
13
|
const getImagesFromPage = async (...args) => {
|
|
15
|
-
await
|
|
14
|
+
await image.resolvePDFJSImports();
|
|
16
15
|
return await image.getImagesFromPage(...args);
|
|
17
16
|
};
|
|
18
17
|
|
|
19
|
-
exports.defineUnPDFConfig =
|
|
20
|
-
exports.getDocumentProxy =
|
|
21
|
-
exports.getResolvedPDFJS =
|
|
22
|
-
exports.resolvePDFJSImports =
|
|
18
|
+
exports.defineUnPDFConfig = image.defineUnPDFConfig;
|
|
19
|
+
exports.getDocumentProxy = image.getDocumentProxy;
|
|
20
|
+
exports.getResolvedPDFJS = image.getResolvedPDFJS;
|
|
21
|
+
exports.resolvePDFJSImports = image.resolvePDFJSImports;
|
|
23
22
|
exports.extractPDFText = extractPDFText;
|
|
24
23
|
exports.getImagesFromPage = getImagesFromPage;
|
|
25
24
|
exports.getPDFMeta = getPDFMeta;
|
package/dist/index.web.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.
|
|
2
|
-
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
1
|
+
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3991886a.cjs';
|
|
2
|
+
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3991886a.cjs';
|
|
3
|
+
import 'types/src/display/api';
|
|
4
|
+
import 'types/src/pdf';
|
|
5
5
|
|
|
6
6
|
declare const getPDFMeta: typeof getPDFMeta$1;
|
|
7
7
|
declare const extractPDFText: typeof extractPDFText$1;
|
package/dist/index.web.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.
|
|
2
|
-
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
1
|
+
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3991886a.mjs';
|
|
2
|
+
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3991886a.mjs';
|
|
3
|
+
import 'types/src/display/api';
|
|
4
|
+
import 'types/src/pdf';
|
|
5
5
|
|
|
6
6
|
declare const getPDFMeta: typeof getPDFMeta$1;
|
|
7
7
|
declare const extractPDFText: typeof extractPDFText$1;
|
package/dist/index.web.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.
|
|
2
|
-
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
1
|
+
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3991886a.js';
|
|
2
|
+
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3991886a.js';
|
|
3
|
+
import 'types/src/display/api';
|
|
4
|
+
import 'types/src/pdf';
|
|
5
5
|
|
|
6
6
|
declare const getPDFMeta: typeof getPDFMeta$1;
|
|
7
7
|
declare const extractPDFText: typeof extractPDFText$1;
|
package/dist/index.web.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.
|
|
2
|
-
|
|
3
|
-
export { d as defineUnPDFConfig, g as getDocumentProxy, a as getResolvedPDFJS } from './shared/unpdf.c7f36e56.mjs';
|
|
1
|
+
import { r as resolvePDFJSImports, g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.ce219a40.mjs';
|
|
2
|
+
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS } from './shared/unpdf.ce219a40.mjs';
|
|
4
3
|
|
|
5
4
|
const getPDFMeta = async (...args) => {
|
|
6
5
|
await resolvePDFJSImports();
|
package/dist/index.worker.cjs
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const image = require('./shared/unpdf.6c0ca5b5.cjs');
|
|
4
4
|
|
|
5
|
-
const getPDFMeta = async () => {
|
|
6
|
-
|
|
5
|
+
const getPDFMeta = async (...args) => {
|
|
6
|
+
await image.resolvePDFJSImports();
|
|
7
|
+
return await image.getPDFMeta(...args);
|
|
7
8
|
};
|
|
8
|
-
const extractPDFText = async () => {
|
|
9
|
-
|
|
9
|
+
const extractPDFText = async (...args) => {
|
|
10
|
+
await image.resolvePDFJSImports();
|
|
11
|
+
return await image.extractPDFText(...args);
|
|
10
12
|
};
|
|
11
|
-
const getImagesFromPage = async () => {
|
|
12
|
-
|
|
13
|
+
const getImagesFromPage = async (...args) => {
|
|
14
|
+
await image.resolvePDFJSImports();
|
|
15
|
+
return await image.getImagesFromPage(...args);
|
|
13
16
|
};
|
|
14
17
|
|
|
15
|
-
exports.defineUnPDFConfig =
|
|
16
|
-
exports.getDocumentProxy =
|
|
17
|
-
exports.getResolvedPDFJS =
|
|
18
|
-
exports.resolvePDFJSImports =
|
|
18
|
+
exports.defineUnPDFConfig = image.defineUnPDFConfig;
|
|
19
|
+
exports.getDocumentProxy = image.getDocumentProxy;
|
|
20
|
+
exports.getResolvedPDFJS = image.getResolvedPDFJS;
|
|
21
|
+
exports.resolvePDFJSImports = image.resolvePDFJSImports;
|
|
19
22
|
exports.extractPDFText = extractPDFText;
|
|
20
23
|
exports.getImagesFromPage = getImagesFromPage;
|
|
21
24
|
exports.getPDFMeta = getPDFMeta;
|
package/dist/index.worker.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.
|
|
2
|
-
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
1
|
+
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3991886a.cjs';
|
|
2
|
+
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3991886a.cjs';
|
|
3
|
+
import 'types/src/display/api';
|
|
4
|
+
import 'types/src/pdf';
|
|
5
5
|
|
|
6
6
|
declare const getPDFMeta: typeof getPDFMeta$1;
|
|
7
7
|
declare const extractPDFText: typeof extractPDFText$1;
|
package/dist/index.worker.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.
|
|
2
|
-
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
1
|
+
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3991886a.mjs';
|
|
2
|
+
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3991886a.mjs';
|
|
3
|
+
import 'types/src/display/api';
|
|
4
|
+
import 'types/src/pdf';
|
|
5
5
|
|
|
6
6
|
declare const getPDFMeta: typeof getPDFMeta$1;
|
|
7
7
|
declare const extractPDFText: typeof extractPDFText$1;
|
package/dist/index.worker.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.
|
|
2
|
-
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
1
|
+
import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3991886a.js';
|
|
2
|
+
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3991886a.js';
|
|
3
|
+
import 'types/src/display/api';
|
|
4
|
+
import 'types/src/pdf';
|
|
5
5
|
|
|
6
6
|
declare const getPDFMeta: typeof getPDFMeta$1;
|
|
7
7
|
declare const extractPDFText: typeof extractPDFText$1;
|
package/dist/index.worker.mjs
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { r as resolvePDFJSImports, g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.ce219a40.mjs';
|
|
2
|
+
export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS } from './shared/unpdf.ce219a40.mjs';
|
|
2
3
|
|
|
3
|
-
const getPDFMeta = async () => {
|
|
4
|
-
|
|
4
|
+
const getPDFMeta = async (...args) => {
|
|
5
|
+
await resolvePDFJSImports();
|
|
6
|
+
return await getPDFMeta$1(...args);
|
|
5
7
|
};
|
|
6
|
-
const extractPDFText = async () => {
|
|
7
|
-
|
|
8
|
+
const extractPDFText = async (...args) => {
|
|
9
|
+
await resolvePDFJSImports();
|
|
10
|
+
return await extractPDFText$1(...args);
|
|
8
11
|
};
|
|
9
|
-
const getImagesFromPage = async () => {
|
|
10
|
-
|
|
12
|
+
const getImagesFromPage = async (...args) => {
|
|
13
|
+
await resolvePDFJSImports();
|
|
14
|
+
return await getImagesFromPage$1(...args);
|
|
11
15
|
};
|
|
12
16
|
|
|
13
|
-
export { extractPDFText, getImagesFromPage, getPDFMeta };
|
|
17
|
+
export { extractPDFText, getImagesFromPage, getPDFMeta, resolvePDFJSImports };
|
package/dist/pdfjs.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types/src/pdf.d.ts'
|
package/dist/pdfjs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types/src/pdf.d.ts'
|