unpdf 0.5.0 → 0.5.1

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 CHANGED
@@ -1,10 +1,10 @@
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.
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.
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. 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` 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).
6
6
 
7
- This library is also intended as a modern alternative to the unmaintained [`pdf-parse`](https://www.npmjs.com/package/pdf-parse).
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
 
@@ -18,13 +18,13 @@ Run the following command to add `unpdf` to your project.
18
18
 
19
19
  ```bash
20
20
  # pnpm
21
- pnpm add -D unpdf
21
+ pnpm add unpdf
22
22
 
23
23
  # npm
24
- npm install -D unpdf
24
+ npm install unpdf
25
25
 
26
26
  # yarn
27
- yarn add -D unpdf
27
+ yarn add unpdf
28
28
  ```
29
29
 
30
30
  ## Usage
@@ -55,6 +55,14 @@ defineUnPDFConfig({
55
55
  // …
56
56
  ```
57
57
 
58
+ ### Access the PDF.js Module
59
+
60
+ ```ts
61
+ import { getResolvedPDFJS } from 'unpdf'
62
+
63
+ const { version } = await getResolvedPDFJS()
64
+ ```
65
+
58
66
  ## Config
59
67
 
60
68
  ```ts
@@ -75,16 +83,26 @@ interface UnPDFConfiguration {
75
83
 
76
84
  ### `defineUnPDFConfig`
77
85
 
86
+ Define a custom PDF.js module, like the legacy build.
87
+
78
88
  ```ts
79
89
  function defineUnPDFConfig({ pdfjs }: UnPDFConfiguration): Promise<void>
80
90
  ```
81
91
 
92
+ ### `getResolvedPDFJS`
93
+
94
+ Returns the resolved PDF.js module.
95
+
96
+ ```ts
97
+ function getResolvedPDFJS(): Promise<typeof import('pdfjs-dist')>
98
+ ```
99
+
82
100
  ### `getPDFMeta`
83
101
 
84
102
  ```ts
85
103
  function getPDFMeta(data: ArrayBuffer): Promise<{
86
104
  info: Record<string, any>
87
- metadata: any
105
+ metadata: Record<string, any>
88
106
  }>
89
107
  ```
90
108
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const image = require('./shared/unpdf.e023f326.cjs');
4
- const utils = require('./shared/unpdf.54007d6f.cjs');
3
+ const image = require('./shared/unpdf.3a651ae7.cjs');
4
+ const utils = require('./shared/unpdf.15eec1ee.cjs');
5
5
 
6
6
  const getPDFMeta = async (...args) => {
7
7
  await utils.resolvePDFJSImports();
@@ -17,6 +17,9 @@ const getImagesFromPage = async (...args) => {
17
17
  };
18
18
 
19
19
  exports.defineUnPDFConfig = utils.defineUnPDFConfig;
20
+ exports.getDocumentProxy = utils.getDocumentProxy;
21
+ exports.getResolvedPDFJS = utils.getResolvedPDFJS;
22
+ exports.resolvePDFJSImports = utils.resolvePDFJSImports;
20
23
  exports.extractPDFText = extractPDFText;
21
24
  exports.getImagesFromPage = getImagesFromPage;
22
25
  exports.getPDFMeta = getPDFMeta;
@@ -1,5 +1,6 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.842960e8.cjs';
2
- export { d as defineUnPDFConfig } from './shared/unpdf.842960e8.cjs';
1
+ import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3a0402b0.cjs';
2
+ export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3a0402b0.cjs';
3
+ import 'pdfjs-dist/types/src/display/api';
3
4
  import 'pdfjs-dist';
4
5
 
5
6
  declare const getPDFMeta: typeof getPDFMeta$1;
@@ -1,5 +1,6 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.842960e8.mjs';
2
- export { d as defineUnPDFConfig } from './shared/unpdf.842960e8.mjs';
1
+ import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3a0402b0.mjs';
2
+ export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3a0402b0.mjs';
3
+ import 'pdfjs-dist/types/src/display/api';
3
4
  import 'pdfjs-dist';
4
5
 
5
6
  declare const getPDFMeta: typeof getPDFMeta$1;
@@ -1,5 +1,6 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.842960e8.js';
2
- export { d as defineUnPDFConfig } from './shared/unpdf.842960e8.js';
1
+ import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3a0402b0.js';
2
+ export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3a0402b0.js';
3
+ import 'pdfjs-dist/types/src/display/api';
3
4
  import 'pdfjs-dist';
4
5
 
5
6
  declare const getPDFMeta: typeof getPDFMeta$1;
@@ -1,6 +1,6 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.0db47641.mjs';
2
- import { r as resolvePDFJSImports } from './shared/unpdf.5b4a24ed.mjs';
3
- export { d as defineUnPDFConfig } from './shared/unpdf.5b4a24ed.mjs';
1
+ import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.d5a4740d.mjs';
2
+ import { r as resolvePDFJSImports } from './shared/unpdf.9db6f9f8.mjs';
3
+ export { d as defineUnPDFConfig, g as getDocumentProxy, a as getResolvedPDFJS } from './shared/unpdf.9db6f9f8.mjs';
4
4
 
5
5
  const getPDFMeta = async (...args) => {
6
6
  await resolvePDFJSImports();
@@ -15,4 +15,4 @@ const getImagesFromPage = async (...args) => {
15
15
  return await getImagesFromPage$1(...args);
16
16
  };
17
17
 
18
- export { extractPDFText, getImagesFromPage, getPDFMeta };
18
+ export { extractPDFText, getImagesFromPage, getPDFMeta, resolvePDFJSImports };
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const image = require('./shared/unpdf.e023f326.cjs');
4
- const utils = require('./shared/unpdf.54007d6f.cjs');
3
+ const image = require('./shared/unpdf.3a651ae7.cjs');
4
+ const utils = require('./shared/unpdf.15eec1ee.cjs');
5
5
 
6
6
  const getPDFMeta = async (...args) => {
7
7
  await utils.resolvePDFJSImports();
@@ -17,6 +17,9 @@ const getImagesFromPage = async (...args) => {
17
17
  };
18
18
 
19
19
  exports.defineUnPDFConfig = utils.defineUnPDFConfig;
20
+ exports.getDocumentProxy = utils.getDocumentProxy;
21
+ exports.getResolvedPDFJS = utils.getResolvedPDFJS;
22
+ exports.resolvePDFJSImports = utils.resolvePDFJSImports;
20
23
  exports.extractPDFText = extractPDFText;
21
24
  exports.getImagesFromPage = getImagesFromPage;
22
25
  exports.getPDFMeta = getPDFMeta;
@@ -1,5 +1,6 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.842960e8.cjs';
2
- export { d as defineUnPDFConfig } from './shared/unpdf.842960e8.cjs';
1
+ import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3a0402b0.cjs';
2
+ export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3a0402b0.cjs';
3
+ import 'pdfjs-dist/types/src/display/api';
3
4
  import 'pdfjs-dist';
4
5
 
5
6
  declare const getPDFMeta: typeof getPDFMeta$1;
@@ -1,5 +1,6 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.842960e8.mjs';
2
- export { d as defineUnPDFConfig } from './shared/unpdf.842960e8.mjs';
1
+ import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3a0402b0.mjs';
2
+ export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3a0402b0.mjs';
3
+ import 'pdfjs-dist/types/src/display/api';
3
4
  import 'pdfjs-dist';
4
5
 
5
6
  declare const getPDFMeta: typeof getPDFMeta$1;
@@ -1,5 +1,6 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.842960e8.js';
2
- export { d as defineUnPDFConfig } from './shared/unpdf.842960e8.js';
1
+ import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3a0402b0.js';
2
+ export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3a0402b0.js';
3
+ import 'pdfjs-dist/types/src/display/api';
3
4
  import 'pdfjs-dist';
4
5
 
5
6
  declare const getPDFMeta: typeof getPDFMeta$1;
@@ -1,6 +1,6 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.0db47641.mjs';
2
- import { r as resolvePDFJSImports } from './shared/unpdf.5b4a24ed.mjs';
3
- export { d as defineUnPDFConfig } from './shared/unpdf.5b4a24ed.mjs';
1
+ import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.d5a4740d.mjs';
2
+ import { r as resolvePDFJSImports } from './shared/unpdf.9db6f9f8.mjs';
3
+ export { d as defineUnPDFConfig, g as getDocumentProxy, a as getResolvedPDFJS } from './shared/unpdf.9db6f9f8.mjs';
4
4
 
5
5
  const getPDFMeta = async (...args) => {
6
6
  await resolvePDFJSImports();
@@ -15,4 +15,4 @@ const getImagesFromPage = async (...args) => {
15
15
  return await getImagesFromPage$1(...args);
16
16
  };
17
17
 
18
- export { extractPDFText, getImagesFromPage, getPDFMeta };
18
+ export { extractPDFText, getImagesFromPage, getPDFMeta, resolvePDFJSImports };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const utils = require('./shared/unpdf.54007d6f.cjs');
3
+ const utils = require('./shared/unpdf.15eec1ee.cjs');
4
4
 
5
5
  const getPDFMeta = async () => {
6
6
  throw new Error("Not implemented in worker context yet");
@@ -13,6 +13,9 @@ const getImagesFromPage = async () => {
13
13
  };
14
14
 
15
15
  exports.defineUnPDFConfig = utils.defineUnPDFConfig;
16
+ exports.getDocumentProxy = utils.getDocumentProxy;
17
+ exports.getResolvedPDFJS = utils.getResolvedPDFJS;
18
+ exports.resolvePDFJSImports = utils.resolvePDFJSImports;
16
19
  exports.extractPDFText = extractPDFText;
17
20
  exports.getImagesFromPage = getImagesFromPage;
18
21
  exports.getPDFMeta = getPDFMeta;
@@ -1,5 +1,6 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.842960e8.cjs';
2
- export { d as defineUnPDFConfig } from './shared/unpdf.842960e8.cjs';
1
+ import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3a0402b0.cjs';
2
+ export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3a0402b0.cjs';
3
+ import 'pdfjs-dist/types/src/display/api';
3
4
  import 'pdfjs-dist';
4
5
 
5
6
  declare const getPDFMeta: typeof getPDFMeta$1;
@@ -1,5 +1,6 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.842960e8.mjs';
2
- export { d as defineUnPDFConfig } from './shared/unpdf.842960e8.mjs';
1
+ import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3a0402b0.mjs';
2
+ export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3a0402b0.mjs';
3
+ import 'pdfjs-dist/types/src/display/api';
3
4
  import 'pdfjs-dist';
4
5
 
5
6
  declare const getPDFMeta: typeof getPDFMeta$1;
@@ -1,5 +1,6 @@
1
- import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.842960e8.js';
2
- export { d as defineUnPDFConfig } from './shared/unpdf.842960e8.js';
1
+ import { g as getPDFMeta$1, e as extractPDFText$1, a as getImagesFromPage$1 } from './shared/unpdf.3a0402b0.js';
2
+ export { d as defineUnPDFConfig, b as getDocumentProxy, c as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.3a0402b0.js';
3
+ import 'pdfjs-dist/types/src/display/api';
3
4
  import 'pdfjs-dist';
4
5
 
5
6
  declare const getPDFMeta: typeof getPDFMeta$1;
@@ -1,4 +1,4 @@
1
- export { d as defineUnPDFConfig } from './shared/unpdf.5b4a24ed.mjs';
1
+ export { d as defineUnPDFConfig, g as getDocumentProxy, a as getResolvedPDFJS, r as resolvePDFJSImports } from './shared/unpdf.9db6f9f8.mjs';
2
2
 
3
3
  const getPDFMeta = async () => {
4
4
  throw new Error("Not implemented in worker context yet");
@@ -2,7 +2,7 @@
2
2
 
3
3
  let resolvedModule;
4
4
  async function getDocumentProxy(data) {
5
- const { getDocument } = getResolvedPDFJS();
5
+ const { getDocument } = await getResolvedPDFJS();
6
6
  const pdf = await getDocument({
7
7
  data,
8
8
  useWorkerFetch: false,
@@ -21,7 +21,9 @@ async function defineUnPDFConfig({ pdfjs }) {
21
21
  }
22
22
  }
23
23
  }
24
- function getResolvedPDFJS() {
24
+ async function getResolvedPDFJS() {
25
+ if (!resolvedModule)
26
+ await resolvePDFJSImports();
25
27
  return resolvedModule;
26
28
  }
27
29
  async function resolvePDFJSImports() {
@@ -1,8 +1,9 @@
1
+ import * as pdfjs_dist_types_src_display_api from 'pdfjs-dist/types/src/display/api';
1
2
  import PDFJS from 'pdfjs-dist';
2
3
 
3
4
  declare function getPDFMeta(data: ArrayBuffer): Promise<{
4
5
  info: Record<string, any>;
5
- metadata: any;
6
+ metadata: Record<string, any>;
6
7
  }>;
7
8
 
8
9
  declare function extractPDFText(data: ArrayBuffer, { mergePages }?: {
@@ -26,6 +27,9 @@ interface UnPDFConfiguration {
26
27
  pdfjs?: () => Promise<typeof PDFJS>;
27
28
  }
28
29
 
30
+ declare function getDocumentProxy(data: ArrayBuffer): Promise<pdfjs_dist_types_src_display_api.PDFDocumentProxy>;
29
31
  declare function defineUnPDFConfig({ pdfjs }: UnPDFConfiguration): Promise<void>;
32
+ declare function getResolvedPDFJS(): Promise<typeof PDFJS>;
33
+ declare function resolvePDFJSImports(): Promise<void>;
30
34
 
31
- export { getImagesFromPage as a, defineUnPDFConfig as d, extractPDFText as e, getPDFMeta as g };
35
+ export { getImagesFromPage as a, getDocumentProxy as b, getResolvedPDFJS as c, defineUnPDFConfig as d, extractPDFText as e, getPDFMeta as g, resolvePDFJSImports as r };
@@ -1,8 +1,9 @@
1
+ import * as pdfjs_dist_types_src_display_api from 'pdfjs-dist/types/src/display/api';
1
2
  import PDFJS from 'pdfjs-dist';
2
3
 
3
4
  declare function getPDFMeta(data: ArrayBuffer): Promise<{
4
5
  info: Record<string, any>;
5
- metadata: any;
6
+ metadata: Record<string, any>;
6
7
  }>;
7
8
 
8
9
  declare function extractPDFText(data: ArrayBuffer, { mergePages }?: {
@@ -26,6 +27,9 @@ interface UnPDFConfiguration {
26
27
  pdfjs?: () => Promise<typeof PDFJS>;
27
28
  }
28
29
 
30
+ declare function getDocumentProxy(data: ArrayBuffer): Promise<pdfjs_dist_types_src_display_api.PDFDocumentProxy>;
29
31
  declare function defineUnPDFConfig({ pdfjs }: UnPDFConfiguration): Promise<void>;
32
+ declare function getResolvedPDFJS(): Promise<typeof PDFJS>;
33
+ declare function resolvePDFJSImports(): Promise<void>;
30
34
 
31
- export { getImagesFromPage as a, defineUnPDFConfig as d, extractPDFText as e, getPDFMeta as g };
35
+ export { getImagesFromPage as a, getDocumentProxy as b, getResolvedPDFJS as c, defineUnPDFConfig as d, extractPDFText as e, getPDFMeta as g, resolvePDFJSImports as r };
@@ -1,8 +1,9 @@
1
+ import * as pdfjs_dist_types_src_display_api from 'pdfjs-dist/types/src/display/api';
1
2
  import PDFJS from 'pdfjs-dist';
2
3
 
3
4
  declare function getPDFMeta(data: ArrayBuffer): Promise<{
4
5
  info: Record<string, any>;
5
- metadata: any;
6
+ metadata: Record<string, any>;
6
7
  }>;
7
8
 
8
9
  declare function extractPDFText(data: ArrayBuffer, { mergePages }?: {
@@ -26,6 +27,9 @@ interface UnPDFConfiguration {
26
27
  pdfjs?: () => Promise<typeof PDFJS>;
27
28
  }
28
29
 
30
+ declare function getDocumentProxy(data: ArrayBuffer): Promise<pdfjs_dist_types_src_display_api.PDFDocumentProxy>;
29
31
  declare function defineUnPDFConfig({ pdfjs }: UnPDFConfiguration): Promise<void>;
32
+ declare function getResolvedPDFJS(): Promise<typeof PDFJS>;
33
+ declare function resolvePDFJSImports(): Promise<void>;
30
34
 
31
- export { getImagesFromPage as a, defineUnPDFConfig as d, extractPDFText as e, getPDFMeta as g };
35
+ export { getImagesFromPage as a, getDocumentProxy as b, getResolvedPDFJS as c, defineUnPDFConfig as d, extractPDFText as e, getPDFMeta as g, resolvePDFJSImports as r };
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- const utils = require('./unpdf.54007d6f.cjs');
3
+ const utils = require('./unpdf.15eec1ee.cjs');
4
4
 
5
5
  async function getPDFMeta(data) {
6
6
  const pdf = await utils.getDocumentProxy(data);
7
7
  const meta = await pdf.getMetadata().catch(() => null);
8
8
  return {
9
- info: meta?.info,
10
- metadata: meta?.metadata?.getAll()
9
+ info: meta?.info ?? {},
10
+ metadata: meta?.metadata?.getAll() ?? {}
11
11
  };
12
12
  }
13
13
 
@@ -35,7 +35,7 @@ async function getImagesFromPage(data, pageNumber) {
35
35
  const pdf = await utils.getDocumentProxy(data);
36
36
  const page = await pdf.getPage(pageNumber);
37
37
  const operatorList = await page.getOperatorList();
38
- const { OPS } = utils.getResolvedPDFJS();
38
+ const { OPS } = await utils.getResolvedPDFJS();
39
39
  const images = [];
40
40
  for (const op of operatorList.fnArray) {
41
41
  if (op !== OPS.paintImageXObject)
@@ -1,6 +1,6 @@
1
1
  let resolvedModule;
2
2
  async function getDocumentProxy(data) {
3
- const { getDocument } = getResolvedPDFJS();
3
+ const { getDocument } = await getResolvedPDFJS();
4
4
  const pdf = await getDocument({
5
5
  data,
6
6
  useWorkerFetch: false,
@@ -19,7 +19,9 @@ async function defineUnPDFConfig({ pdfjs }) {
19
19
  }
20
20
  }
21
21
  }
22
- function getResolvedPDFJS() {
22
+ async function getResolvedPDFJS() {
23
+ if (!resolvedModule)
24
+ await resolvePDFJSImports();
23
25
  return resolvedModule;
24
26
  }
25
27
  async function resolvePDFJSImports() {
@@ -1,11 +1,11 @@
1
- import { g as getDocumentProxy, a as getResolvedPDFJS } from './unpdf.5b4a24ed.mjs';
1
+ import { g as getDocumentProxy, a as getResolvedPDFJS } from './unpdf.9db6f9f8.mjs';
2
2
 
3
3
  async function getPDFMeta(data) {
4
4
  const pdf = await getDocumentProxy(data);
5
5
  const meta = await pdf.getMetadata().catch(() => null);
6
6
  return {
7
- info: meta?.info,
8
- metadata: meta?.metadata?.getAll()
7
+ info: meta?.info ?? {},
8
+ metadata: meta?.metadata?.getAll() ?? {}
9
9
  };
10
10
  }
11
11
 
@@ -33,7 +33,7 @@ async function getImagesFromPage(data, pageNumber) {
33
33
  const pdf = await getDocumentProxy(data);
34
34
  const page = await pdf.getPage(pageNumber);
35
35
  const operatorList = await page.getOperatorList();
36
- const { OPS } = getResolvedPDFJS();
36
+ const { OPS } = await getResolvedPDFJS();
37
37
  const images = [];
38
38
  for (const op of operatorList.fnArray) {
39
39
  if (op !== OPS.paintImageXObject)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unpdf",
3
3
  "type": "module",
4
- "version": "0.5.0",
4
+ "version": "0.5.1",
5
5
  "packageManager": "pnpm@8.6.12",
6
6
  "description": "Utilities to work with PDFs, like extracting text",
7
7
  "author": "Johann Schopplich <pkg@johannschopplich.com>",