unpdf 0.5.4 → 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.
Files changed (85) hide show
  1. package/README.md +64 -31
  2. package/dist/index.node.cjs +8 -9
  3. package/dist/index.node.d.cts +4 -4
  4. package/dist/index.node.d.mts +4 -4
  5. package/dist/index.node.d.ts +4 -4
  6. package/dist/index.node.mjs +2 -3
  7. package/dist/index.web.cjs +8 -9
  8. package/dist/index.web.d.cts +4 -4
  9. package/dist/index.web.d.mts +4 -4
  10. package/dist/index.web.d.ts +4 -4
  11. package/dist/index.web.mjs +2 -3
  12. package/dist/index.worker.cjs +14 -11
  13. package/dist/index.worker.d.cts +4 -4
  14. package/dist/index.worker.d.mts +4 -4
  15. package/dist/index.worker.d.ts +4 -4
  16. package/dist/index.worker.mjs +12 -8
  17. package/dist/pdfjs.d.mts +1 -0
  18. package/dist/pdfjs.d.ts +1 -0
  19. package/dist/pdfjs.mjs +1 -0
  20. package/dist/shared/{unpdf.6363738c.d.ts → unpdf.3991886a.d.cts} +9 -7
  21. package/dist/shared/{unpdf.6363738c.d.cts → unpdf.3991886a.d.mts} +9 -7
  22. package/dist/shared/{unpdf.6363738c.d.mts → unpdf.3991886a.d.ts} +9 -7
  23. package/dist/shared/unpdf.6c0ca5b5.cjs +107 -0
  24. package/dist/shared/unpdf.ce219a40.mjs +99 -0
  25. package/dist/types/external/webL10n/l10n.d.ts +0 -0
  26. package/dist/types/src/display/annotation_layer.d.ts +203 -0
  27. package/dist/types/src/display/annotation_storage.d.ts +89 -0
  28. package/dist/types/src/display/api.d.ts +1466 -0
  29. package/dist/types/src/display/base_factory.d.ts +54 -0
  30. package/dist/types/src/display/canvas.d.ts +208 -0
  31. package/dist/types/src/display/display_utils.d.ts +277 -0
  32. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +196 -0
  33. package/dist/types/src/display/editor/editor.d.ts +325 -0
  34. package/dist/types/src/display/editor/freetext.d.ts +72 -0
  35. package/dist/types/src/display/editor/ink.d.ts +95 -0
  36. package/dist/types/src/display/editor/stamp.d.ts +28 -0
  37. package/dist/types/src/display/editor/tools.d.ts +349 -0
  38. package/dist/types/src/display/font_loader.d.ts +43 -0
  39. package/dist/types/src/display/metadata.d.ts +11 -0
  40. package/dist/types/src/display/optional_content_config.d.ts +13 -0
  41. package/dist/types/src/display/pattern_helper.d.ts +73 -0
  42. package/dist/types/src/display/text_layer.d.ts +151 -0
  43. package/dist/types/src/display/transport_stream.d.ts +68 -0
  44. package/dist/types/src/display/worker_options.d.ts +27 -0
  45. package/dist/types/src/display/xfa_layer.d.ts +46 -0
  46. package/dist/types/src/display/xfa_text.d.ts +19 -0
  47. package/dist/types/src/pdf.d.ts +50 -0
  48. package/dist/types/src/shared/image_utils.d.ts +17 -0
  49. package/dist/types/src/shared/message_handler.d.ts +43 -0
  50. package/dist/types/src/shared/murmurhash3.d.ts +7 -0
  51. package/dist/types/src/shared/scripting_utils.d.ts +16 -0
  52. package/dist/types/src/shared/util.d.ts +398 -0
  53. package/dist/types/web/annotation_editor_layer_builder.d.ts +50 -0
  54. package/dist/types/web/annotation_layer_builder.d.ts +83 -0
  55. package/dist/types/web/app_options.d.ts +14 -0
  56. package/dist/types/web/download_manager.d.ts +14 -0
  57. package/dist/types/web/event_utils.d.ts +75 -0
  58. package/dist/types/web/generic_scripting.d.ts +8 -0
  59. package/dist/types/web/genericl10n.d.ts +13 -0
  60. package/dist/types/web/interfaces.d.ts +163 -0
  61. package/dist/types/web/l10n_utils.d.ts +7 -0
  62. package/dist/types/web/pdf_find_controller.d.ts +108 -0
  63. package/dist/types/web/pdf_find_utils.d.ts +16 -0
  64. package/dist/types/web/pdf_history.d.ts +168 -0
  65. package/dist/types/web/pdf_link_service.d.ts +243 -0
  66. package/dist/types/web/pdf_page_view.d.ts +209 -0
  67. package/dist/types/web/pdf_rendering_queue.d.ts +53 -0
  68. package/dist/types/web/pdf_scripting_manager.component.d.ts +5 -0
  69. package/dist/types/web/pdf_scripting_manager.d.ts +61 -0
  70. package/dist/types/web/pdf_single_page_viewer.d.ts +7 -0
  71. package/dist/types/web/pdf_thumbnail_view.d.ts +131 -0
  72. package/dist/types/web/pdf_thumbnail_viewer.d.ts +104 -0
  73. package/dist/types/web/pdf_viewer.component.d.ts +24 -0
  74. package/dist/types/web/pdf_viewer.d.ts +455 -0
  75. package/dist/types/web/struct_tree_layer_builder.d.ts +7 -0
  76. package/dist/types/web/text_accessibility.d.ts +42 -0
  77. package/dist/types/web/text_highlighter.d.ts +63 -0
  78. package/dist/types/web/text_layer_builder.d.ts +64 -0
  79. package/dist/types/web/ui_utils.d.ts +288 -0
  80. package/dist/types/web/xfa_layer_builder.d.ts +41 -0
  81. package/package.json +67 -41
  82. package/dist/shared/unpdf.3dcacb97.mjs +0 -49
  83. package/dist/shared/unpdf.42987ff1.cjs +0 -52
  84. package/dist/shared/unpdf.ab6a2535.mjs +0 -46
  85. package/dist/shared/unpdf.eba9a3dc.cjs +0 -53
package/README.md CHANGED
@@ -1,16 +1,18 @@
1
1
  # unpdf
2
2
 
3
- A collection of utilities to work with PDFs. Uses Mozilla's [PDF.js](https://github.com/mozilla/pdf.js) under the hood and lazily initializes the library.
3
+ A collection of utilities to work with PDFs. Designed specifically for Deno, workers and other nodeless environments.
4
4
 
5
- `unpdf` takes advantage of [export conditions](https://nodejs.org/api/packages.html#packages_conditional_exports) to circumvent build issues in serverless environments. For example, PDF.js depends on the optional `canvas` module, which [doesn't work inside worker threads](https://github.com/Automattic/node-canvas/issues/1394).
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
- - 🏗️ Conditional exports for Browser, Node and worker environments
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 'unpdf'
37
+ import { extractPDFText } from "unpdf";
34
38
 
35
39
  // Fetch a PDF file from the web
36
- const pdf = await fetch('https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf')
37
- .then(res => res.arrayBuffer())
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('./dummy.pdf')
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
- new Uint8Array(pdf), { mergePages: true }
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 'unpdf'
59
+ import { defineUnPDFConfig } from "unpdf";
53
60
 
54
- // Use the legacy build
55
61
  defineUnPDFConfig({
56
- pdfjs: () => import('pdfjs-dist/legacy/build/pdf.js')
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 { getResolvedPDFJS } from 'unpdf'
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
- const { version } = await getResolvedPDFJS()
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('pdfjs-dist')>
131
+ function getResolvedPDFJS(): Promise<typeof import("pdfjs-dist")>;
103
132
  ```
104
133
 
105
134
  ### `getPDFMeta`
106
135
 
107
136
  ```ts
108
- function getPDFMeta(
109
- data: BinaryData | PDFDocumentProxy
110
- ): Promise<{
111
- info: Record<string, any>
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)
@@ -1,25 +1,24 @@
1
1
  'use strict';
2
2
 
3
- const image = require('./shared/unpdf.eba9a3dc.cjs');
4
- const utils = require('./shared/unpdf.42987ff1.cjs');
3
+ const image = require('./shared/unpdf.6c0ca5b5.cjs');
5
4
 
6
5
  const getPDFMeta = async (...args) => {
7
- await utils.resolvePDFJSImports();
6
+ await image.resolvePDFJSImports();
8
7
  return await image.getPDFMeta(...args);
9
8
  };
10
9
  const extractPDFText = async (...args) => {
11
- await utils.resolvePDFJSImports();
10
+ await image.resolvePDFJSImports();
12
11
  return await image.extractPDFText(...args);
13
12
  };
14
13
  const getImagesFromPage = async (...args) => {
15
- await utils.resolvePDFJSImports();
14
+ await image.resolvePDFJSImports();
16
15
  return await image.getImagesFromPage(...args);
17
16
  };
18
17
 
19
- exports.defineUnPDFConfig = utils.defineUnPDFConfig;
20
- exports.getDocumentProxy = utils.getDocumentProxy;
21
- exports.getResolvedPDFJS = utils.getResolvedPDFJS;
22
- exports.resolvePDFJSImports = utils.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;
@@ -1,7 +1,7 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.6363738c.cjs';
2
- export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.6363738c.cjs';
3
- import 'pdfjs-dist/types/src/display/api';
4
- import 'pdfjs-dist';
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;
@@ -1,7 +1,7 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.6363738c.mjs';
2
- export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.6363738c.mjs';
3
- import 'pdfjs-dist/types/src/display/api';
4
- import 'pdfjs-dist';
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;
@@ -1,7 +1,7 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.6363738c.js';
2
- export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.6363738c.js';
3
- import 'pdfjs-dist/types/src/display/api';
4
- import 'pdfjs-dist';
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;
@@ -1,6 +1,5 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3dcacb97.mjs';
2
- import { r as resolvePDFJSImports } from './shared/unpdf.ab6a2535.mjs';
3
- export { d as defineUnPDFConfig, g as getDocumentProxy, a as getResolvedPDFJS } from './shared/unpdf.ab6a2535.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();
@@ -1,25 +1,24 @@
1
1
  'use strict';
2
2
 
3
- const image = require('./shared/unpdf.eba9a3dc.cjs');
4
- const utils = require('./shared/unpdf.42987ff1.cjs');
3
+ const image = require('./shared/unpdf.6c0ca5b5.cjs');
5
4
 
6
5
  const getPDFMeta = async (...args) => {
7
- await utils.resolvePDFJSImports();
6
+ await image.resolvePDFJSImports();
8
7
  return await image.getPDFMeta(...args);
9
8
  };
10
9
  const extractPDFText = async (...args) => {
11
- await utils.resolvePDFJSImports();
10
+ await image.resolvePDFJSImports();
12
11
  return await image.extractPDFText(...args);
13
12
  };
14
13
  const getImagesFromPage = async (...args) => {
15
- await utils.resolvePDFJSImports();
14
+ await image.resolvePDFJSImports();
16
15
  return await image.getImagesFromPage(...args);
17
16
  };
18
17
 
19
- exports.defineUnPDFConfig = utils.defineUnPDFConfig;
20
- exports.getDocumentProxy = utils.getDocumentProxy;
21
- exports.getResolvedPDFJS = utils.getResolvedPDFJS;
22
- exports.resolvePDFJSImports = utils.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;
@@ -1,7 +1,7 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.6363738c.cjs';
2
- export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.6363738c.cjs';
3
- import 'pdfjs-dist/types/src/display/api';
4
- import 'pdfjs-dist';
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;
@@ -1,7 +1,7 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.6363738c.mjs';
2
- export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.6363738c.mjs';
3
- import 'pdfjs-dist/types/src/display/api';
4
- import 'pdfjs-dist';
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;
@@ -1,7 +1,7 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.6363738c.js';
2
- export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.6363738c.js';
3
- import 'pdfjs-dist/types/src/display/api';
4
- import 'pdfjs-dist';
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;
@@ -1,6 +1,5 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3dcacb97.mjs';
2
- import { r as resolvePDFJSImports } from './shared/unpdf.ab6a2535.mjs';
3
- export { d as defineUnPDFConfig, g as getDocumentProxy, a as getResolvedPDFJS } from './shared/unpdf.ab6a2535.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();
@@ -1,21 +1,24 @@
1
1
  'use strict';
2
2
 
3
- const utils = require('./shared/unpdf.42987ff1.cjs');
3
+ const image = require('./shared/unpdf.6c0ca5b5.cjs');
4
4
 
5
- const getPDFMeta = async () => {
6
- throw new Error("Not implemented in worker context yet");
5
+ const getPDFMeta = async (...args) => {
6
+ await image.resolvePDFJSImports();
7
+ return await image.getPDFMeta(...args);
7
8
  };
8
- const extractPDFText = async () => {
9
- throw new Error("Not implemented in worker context yet");
9
+ const extractPDFText = async (...args) => {
10
+ await image.resolvePDFJSImports();
11
+ return await image.extractPDFText(...args);
10
12
  };
11
- const getImagesFromPage = async () => {
12
- throw new Error("Not implemented in worker context yet");
13
+ const getImagesFromPage = async (...args) => {
14
+ await image.resolvePDFJSImports();
15
+ return await image.getImagesFromPage(...args);
13
16
  };
14
17
 
15
- exports.defineUnPDFConfig = utils.defineUnPDFConfig;
16
- exports.getDocumentProxy = utils.getDocumentProxy;
17
- exports.getResolvedPDFJS = utils.getResolvedPDFJS;
18
- exports.resolvePDFJSImports = utils.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;
@@ -1,7 +1,7 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.6363738c.cjs';
2
- export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.6363738c.cjs';
3
- import 'pdfjs-dist/types/src/display/api';
4
- import 'pdfjs-dist';
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;
@@ -1,7 +1,7 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.6363738c.mjs';
2
- export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.6363738c.mjs';
3
- import 'pdfjs-dist/types/src/display/api';
4
- import 'pdfjs-dist';
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;
@@ -1,7 +1,7 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.6363738c.js';
2
- export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.6363738c.js';
3
- import 'pdfjs-dist/types/src/display/api';
4
- import 'pdfjs-dist';
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;
@@ -1,13 +1,17 @@
1
- export { d as defineUnPDFConfig, g as getDocumentProxy, a as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.ab6a2535.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';
2
3
 
3
- const getPDFMeta = async () => {
4
- throw new Error("Not implemented in worker context yet");
4
+ const getPDFMeta = async (...args) => {
5
+ await resolvePDFJSImports();
6
+ return await getPDFMeta$1(...args);
5
7
  };
6
- const extractPDFText = async () => {
7
- throw new Error("Not implemented in worker context yet");
8
+ const extractPDFText = async (...args) => {
9
+ await resolvePDFJSImports();
10
+ return await extractPDFText$1(...args);
8
11
  };
9
- const getImagesFromPage = async () => {
10
- throw new Error("Not implemented in worker context yet");
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 };
@@ -0,0 +1 @@
1
+ export * from './types/src/pdf.d.ts'
@@ -0,0 +1 @@
1
+ export * from './types/src/pdf.d.ts'