unpdf 0.6.0 → 0.7.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A collection of utilities to work with PDFs. Designed specifically for Deno, workers and other nodeless environments.
4
4
 
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.
5
+ `unpdf` ships with a serverless build/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. See [`pdfjs.rollup.config.ts`](./pdfjs.rollup.config.ts) for all the details.
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
 
@@ -34,25 +34,25 @@ yarn add unpdf
34
34
  ### Extract Text From PDF
35
35
 
36
36
  ```ts
37
- import { extractPDFText } from "unpdf";
37
+ import { extractText, getDocumentProxy } from "unpdf";
38
38
 
39
39
  // Fetch a PDF file from the web
40
- const pdf = await fetch(
40
+ const buffer = await fetch(
41
41
  "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
42
42
  ).then((res) => res.arrayBuffer());
43
43
 
44
44
  // Or load it from the filesystem
45
- const pdf = await readFile("./dummy.pdf");
45
+ const buffer = await readFile("./dummy.pdf");
46
46
 
47
- // Pass the PDF buffer to the relevant method
48
- const { totalPages, text } = await extractPDFText(new Uint8Array(pdf), {
49
- mergePages: true,
50
- });
47
+ // Load PDF from buffer
48
+ const pdf = await getDocumentProxy(new Uint8Array(pdf));
49
+ // Extract text from PDF
50
+ const { totalPages, text } = await extractText(pdf, { mergePages: true });
51
51
  ```
52
52
 
53
53
  ### Use Legacy Or Custom PDF.js Build
54
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.
55
+ Generally, 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 the official PDF.js version or the legacy build, you can define a custom PDF.js module.
56
56
 
57
57
  ```ts
58
58
  // Before using any other methods, define the PDF.js module
@@ -107,9 +107,10 @@ interface UnPDFConfiguration {
107
107
  * the PDF.js module.
108
108
  *
109
109
  * @example
110
+ * // Use the legacy build
110
111
  * () => import('pdfjs-dist/legacy/build/pdf.js')
111
112
  */
112
- pdfjs?: () => Promise<typeof PDFJS>;
113
+ pdfjs?: () => Promise<PDFJS>;
113
114
  }
114
115
  ```
115
116
 
@@ -128,22 +129,24 @@ function defineUnPDFConfig(config: UnPDFConfiguration): Promise<void>;
128
129
  Returns the resolved PDF.js module. If no build is defined, the latest version will be initialized.
129
130
 
130
131
  ```ts
131
- function getResolvedPDFJS(): Promise<typeof import("pdfjs-dist")>;
132
+ function getResolvedPDFJS(): Promise<PDFJS>;
132
133
  ```
133
134
 
134
- ### `getPDFMeta`
135
+ ### `getMeta`
135
136
 
136
137
  ```ts
137
- function getPDFMeta(data: BinaryData | PDFDocumentProxy): Promise<{
138
+ function getMeta(data: BinaryData | PDFDocumentProxy): Promise<{
138
139
  info: Record<string, any>;
139
140
  metadata: Record<string, any>;
140
141
  }>;
141
142
  ```
142
143
 
143
- ### `extractPDFText`
144
+ ### `extractText`
145
+
146
+ Extracts all text from a PDF. If `mergePages` is set to `true`, the text of all pages will be merged into a single string. Otherwise, an array of strings for each page will be returned.
144
147
 
145
148
  ```ts
146
- function extractPDFText(
149
+ function extractText(
147
150
  data: BinaryData | PDFDocumentProxy,
148
151
  { mergePages }?: { mergePages?: boolean },
149
152
  ): Promise<{
@@ -152,13 +155,57 @@ function extractPDFText(
152
155
  }>;
153
156
  ```
154
157
 
155
- ### `getImagesFromPage`
158
+ ### `renderPageAsImage`
159
+
160
+ > [!NOTE]
161
+ > This method will only work in Node.js and browser environments.
162
+
163
+ To render a PDF page as an image, you can use the `renderPageAsImage` method. This method will return an `ArrayBuffer` of the rendered image.
164
+
165
+ In order to use this method, you have to meet the following requirements:
166
+
167
+ - Use the official PDF.js build
168
+ - Install the [`canvas`](https://www.npmjs.com/package/canvas) package in Node.js environments
169
+
170
+ **Example**
171
+
172
+ ```ts
173
+ import { defineUnPDFConfig, renderPageAsImage } from "unpdf";
174
+
175
+ defineUnPDFConfig({
176
+ // Use the official PDF.js build
177
+ pdfjs: () => import("pdfjs-dist"),
178
+ });
179
+
180
+ const pdf = await readFile("./dummy.pdf");
181
+ const buffer = new Uint8Array(pdf);
182
+
183
+ const result = await renderPageAsImage(buffer, 1);
184
+ await writeFile("dummy-page-1.png", Buffer.from(result));
185
+ ```
186
+
187
+ **Type Declaration**
188
+
189
+ ```ts
190
+ declare function renderPageAsImage(
191
+ data: BinaryData | PDFDocumentProxy,
192
+ pageNumber: number,
193
+ options?: {
194
+ /** @default 1 */
195
+ scale?: number;
196
+ width?: number;
197
+ height?: number;
198
+ },
199
+ ): Promise<ArrayBuffer>;
200
+ ```
201
+
202
+ ### `extractImages`
156
203
 
157
204
  ```ts
158
- function getImagesFromPage(
205
+ function extractImages(
159
206
  data: BinaryData | PDFDocumentProxy,
160
207
  pageNumber: number,
161
- ): Promise<ArrayBuffer[]>;
208
+ ): Promise<Uint8ClampedArray[]>;
162
209
  ```
163
210
 
164
211
  ## FAQ
package/dist/index.cjs ADDED
@@ -0,0 +1,212 @@
1
+ 'use strict';
2
+
3
+ let resolvedModule;
4
+ const isNode = globalThis.process?.release?.name === "node";
5
+ const isBrowser = typeof window !== "undefined";
6
+ async function getDocumentProxy(data, options = {}) {
7
+ const { getDocument } = await getResolvedPDFJS();
8
+ const pdf = await getDocument({
9
+ data,
10
+ isEvalSupported: false,
11
+ ...options
12
+ }).promise;
13
+ return pdf;
14
+ }
15
+ async function getResolvedPDFJS() {
16
+ if (!resolvedModule) {
17
+ await resolvePDFJSImports();
18
+ }
19
+ return resolvedModule;
20
+ }
21
+ async function resolvePDFJSImports(pdfjsResolver, { force = false } = {}) {
22
+ if (resolvedModule && !force) {
23
+ return;
24
+ }
25
+ if (pdfjsResolver) {
26
+ try {
27
+ const _import = await pdfjsResolver();
28
+ resolvedModule = _import.default || _import;
29
+ return;
30
+ } catch {
31
+ throw new Error(
32
+ "Resolving failed. Please check the provided configuration."
33
+ );
34
+ }
35
+ }
36
+ try {
37
+ resolvedModule = await import('unpdf/pdfjs');
38
+ } catch {
39
+ throw new Error(
40
+ "PDF.js is not available. Please add the package as a dependency."
41
+ );
42
+ }
43
+ }
44
+ function isPDFDocumentProxy(data) {
45
+ return typeof data === "object" && data !== null && "_pdfInfo" in data;
46
+ }
47
+
48
+ async function getMeta$1(data) {
49
+ const pdf = isPDFDocumentProxy(data) ? data : await getDocumentProxy(data);
50
+ const meta = await pdf.getMetadata();
51
+ return {
52
+ info: meta?.info ?? {},
53
+ metadata: meta?.metadata?.getAll() ?? {}
54
+ };
55
+ }
56
+
57
+ async function extractText$1(data, options = {}) {
58
+ const { mergePages = false } = { ...options };
59
+ const pdf = isPDFDocumentProxy(data) ? data : await getDocumentProxy(data);
60
+ const texts = await Promise.all(
61
+ Array.from({ length: pdf.numPages }, (_, i) => getPageText(pdf, i + 1))
62
+ );
63
+ const filteredTexts = texts.filter(Boolean);
64
+ return {
65
+ totalPages: pdf.numPages,
66
+ text: mergePages ? filteredTexts.join("\n\n") : filteredTexts
67
+ };
68
+ }
69
+ async function getPageText(pdf, pageNumber) {
70
+ const page = await pdf.getPage(pageNumber);
71
+ const content = await page.getTextContent();
72
+ const items = content.items;
73
+ if (items.length === 0) {
74
+ return;
75
+ }
76
+ return items.map(({ str }) => str).join("\n");
77
+ }
78
+
79
+ async function extractImages$1(data, pageNumber) {
80
+ const pdf = isPDFDocumentProxy(data) ? data : await getDocumentProxy(data);
81
+ const page = await pdf.getPage(pageNumber);
82
+ if (pageNumber < 1 || pageNumber > pdf.numPages) {
83
+ throw new Error(
84
+ `Invalid page number. Must be between 1 and ${pdf.numPages}.`
85
+ );
86
+ }
87
+ const operatorList = await page.getOperatorList();
88
+ const { OPS } = await getResolvedPDFJS();
89
+ const images = [];
90
+ for (let i = 0; i < operatorList.fnArray.length; i++) {
91
+ const op = operatorList.fnArray[i];
92
+ if (op !== OPS.paintImageXObject) {
93
+ continue;
94
+ }
95
+ const imageKey = operatorList.argsArray[i][0];
96
+ const image = await page.objs.get(imageKey);
97
+ images.push(image.data);
98
+ }
99
+ return images;
100
+ }
101
+ async function renderPageAsImage$1(data, pageNumber, options = {}) {
102
+ const pdf = isPDFDocumentProxy(data) ? data : await getDocumentProxy(data);
103
+ const page = await pdf.getPage(pageNumber);
104
+ if (pageNumber < 1 || pageNumber > pdf.numPages) {
105
+ throw new Error(
106
+ `Invalid page number. Must be between 1 and ${pdf.numPages}.`
107
+ );
108
+ }
109
+ let outputScale = options.scale || 1;
110
+ let viewport = page.getViewport({ scale: outputScale });
111
+ if (options.width) {
112
+ outputScale = options.width / viewport.width;
113
+ } else if (options.height) {
114
+ outputScale = options.height / viewport.height;
115
+ }
116
+ if (outputScale !== 1 && outputScale > 0) {
117
+ viewport = page.getViewport({ scale: outputScale });
118
+ }
119
+ const canvasFactory = await createIsomorphicCanvasFactory();
120
+ const ctx = canvasFactory.create(viewport.width, viewport.height);
121
+ await page.render({
122
+ canvasContext: ctx.context,
123
+ viewport
124
+ }).promise;
125
+ const dataUrl = isBrowser ? ctx.canvas.toDataURL() : ctx.canvas.toDataURL();
126
+ const response = await fetch(dataUrl);
127
+ return await response.arrayBuffer();
128
+ }
129
+ async function createIsomorphicCanvasFactory() {
130
+ let _canvas;
131
+ if (isNode) {
132
+ try {
133
+ _canvas = await import('canvas');
134
+ } catch {
135
+ throw new Error(
136
+ 'The "canvas" package is required when running in Node.js.'
137
+ );
138
+ }
139
+ }
140
+ return {
141
+ _createCanvas(width, height) {
142
+ if (isBrowser) {
143
+ const canvas = document.createElement("canvas");
144
+ canvas.width = width;
145
+ canvas.height = height;
146
+ return canvas;
147
+ } else if (isNode) {
148
+ return _canvas.createCanvas(width, height);
149
+ }
150
+ throw new Error("Unsupported environment for canvas creation.");
151
+ },
152
+ create(width, height) {
153
+ const _canvas2 = this._createCanvas(width, height);
154
+ const context = _canvas2.getContext(
155
+ "2d"
156
+ );
157
+ return {
158
+ canvas: _canvas2,
159
+ context
160
+ };
161
+ },
162
+ reset(ctx, width, height) {
163
+ if (ctx.canvas) {
164
+ ctx.canvas.width = width;
165
+ ctx.canvas.height = height;
166
+ }
167
+ },
168
+ destroy(ctx) {
169
+ if (ctx.canvas) {
170
+ ctx.canvas.width = 0;
171
+ ctx.canvas.height = 0;
172
+ }
173
+ ctx.canvas = void 0;
174
+ ctx.context = void 0;
175
+ }
176
+ };
177
+ }
178
+
179
+ async function defineUnPDFConfig(options) {
180
+ const { pdfjs } = { ...options };
181
+ if (pdfjs) {
182
+ await resolvePDFJSImports(pdfjs, { force: true });
183
+ }
184
+ }
185
+
186
+ const getMeta = async (...args) => {
187
+ await resolvePDFJSImports();
188
+ return await getMeta$1(...args);
189
+ };
190
+ const extractText = async (...args) => {
191
+ await resolvePDFJSImports();
192
+ return await extractText$1(...args);
193
+ };
194
+ const extractPDFText = extractText;
195
+ const extractImages = async (...args) => {
196
+ await resolvePDFJSImports();
197
+ return await extractImages$1(...args);
198
+ };
199
+ const renderPageAsImage = async (...args) => {
200
+ await resolvePDFJSImports();
201
+ return await renderPageAsImage$1(...args);
202
+ };
203
+
204
+ exports.defineUnPDFConfig = defineUnPDFConfig;
205
+ exports.extractImages = extractImages;
206
+ exports.extractPDFText = extractPDFText;
207
+ exports.extractText = extractText;
208
+ exports.getDocumentProxy = getDocumentProxy;
209
+ exports.getMeta = getMeta;
210
+ exports.getResolvedPDFJS = getResolvedPDFJS;
211
+ exports.renderPageAsImage = renderPageAsImage;
212
+ exports.resolvePDFJSImports = resolvePDFJSImports;
@@ -1,19 +1,25 @@
1
- import { BinaryData, PDFDocumentProxy, DocumentInitParameters } from '../types/src/display/api';
2
- import _PDFJS from '../types/src/pdf';
1
+ import { BinaryData, PDFDocumentProxy, DocumentInitParameters } from './types/src/display/api';
2
+ import * as _PDFJS from './types/src/pdf';
3
3
 
4
- declare function getPDFMeta(data: BinaryData | PDFDocumentProxy): Promise<{
4
+ declare function getMeta$1(data: BinaryData | PDFDocumentProxy): Promise<{
5
5
  info: Record<string, any>;
6
6
  metadata: Record<string, any>;
7
7
  }>;
8
8
 
9
- declare function extractPDFText(data: BinaryData | PDFDocumentProxy, options?: {
9
+ declare function extractText$1(data: BinaryData | PDFDocumentProxy, options?: {
10
10
  mergePages?: boolean;
11
11
  }): Promise<{
12
12
  totalPages: number;
13
13
  text: string | string[];
14
14
  }>;
15
15
 
16
- declare function getImagesFromPage(data: BinaryData | PDFDocumentProxy, pageNumber: number): Promise<ArrayBuffer[]>;
16
+ declare function extractImages$1(data: BinaryData | PDFDocumentProxy, pageNumber: number): Promise<Uint8ClampedArray[]>;
17
+ declare function renderPageAsImage$1(data: BinaryData | PDFDocumentProxy, pageNumber: number, options?: {
18
+ /** @default 1 */
19
+ scale?: number;
20
+ width?: number;
21
+ height?: number;
22
+ }): Promise<ArrayBuffer>;
17
23
 
18
24
  type PDFJS = typeof _PDFJS;
19
25
  interface UnPDFConfiguration {
@@ -26,9 +32,11 @@ interface UnPDFConfiguration {
26
32
  * // Use the legacy build
27
33
  * () => import('pdfjs-dist/legacy/build/pdf.js')
28
34
  */
29
- pdfjs?: () => Promise<PDFJS>;
35
+ pdfjs?: () => Promise<any>;
30
36
  }
31
37
 
38
+ declare function defineUnPDFConfig(options: UnPDFConfiguration): Promise<void>;
39
+
32
40
  /**
33
41
  * Returns a PDFDocumentProxy instance from a given binary data.
34
42
  *
@@ -36,10 +44,16 @@ interface UnPDFConfiguration {
36
44
  * - `isEvalSupported: false`
37
45
  */
38
46
  declare function getDocumentProxy(data: BinaryData, options?: DocumentInitParameters): Promise<PDFDocumentProxy>;
39
- declare function defineUnPDFConfig(options: UnPDFConfiguration): Promise<void>;
40
47
  declare function getResolvedPDFJS(): Promise<PDFJS>;
41
- declare function resolvePDFJSImports(pdfjsResolver?: () => Promise<PDFJS>, { force }?: {
48
+ declare function resolvePDFJSImports(pdfjsResolver?: () => Promise<any>, { force }?: {
42
49
  force?: boolean | undefined;
43
50
  }): Promise<void>;
44
51
 
45
- export { getImagesFromPage as a, getDocumentProxy as b, getResolvedPDFJS as c, defineUnPDFConfig as d, extractPDFText as e, getPDFMeta as g, resolvePDFJSImports as r };
52
+ declare const getMeta: typeof getMeta$1;
53
+ declare const extractText: typeof extractText$1;
54
+ /** @deprecated Use `extractText` instead. */
55
+ declare const extractPDFText: typeof extractText$1;
56
+ declare const extractImages: typeof extractImages$1;
57
+ declare const renderPageAsImage: typeof renderPageAsImage$1;
58
+
59
+ export { defineUnPDFConfig, extractImages, extractPDFText, extractText, getDocumentProxy, getMeta, getResolvedPDFJS, renderPageAsImage, resolvePDFJSImports };
@@ -1,19 +1,25 @@
1
- import { BinaryData, PDFDocumentProxy, DocumentInitParameters } from '../types/src/display/api';
2
- import _PDFJS from '../types/src/pdf';
1
+ import { BinaryData, PDFDocumentProxy, DocumentInitParameters } from './types/src/display/api';
2
+ import * as _PDFJS from './types/src/pdf';
3
3
 
4
- declare function getPDFMeta(data: BinaryData | PDFDocumentProxy): Promise<{
4
+ declare function getMeta$1(data: BinaryData | PDFDocumentProxy): Promise<{
5
5
  info: Record<string, any>;
6
6
  metadata: Record<string, any>;
7
7
  }>;
8
8
 
9
- declare function extractPDFText(data: BinaryData | PDFDocumentProxy, options?: {
9
+ declare function extractText$1(data: BinaryData | PDFDocumentProxy, options?: {
10
10
  mergePages?: boolean;
11
11
  }): Promise<{
12
12
  totalPages: number;
13
13
  text: string | string[];
14
14
  }>;
15
15
 
16
- declare function getImagesFromPage(data: BinaryData | PDFDocumentProxy, pageNumber: number): Promise<ArrayBuffer[]>;
16
+ declare function extractImages$1(data: BinaryData | PDFDocumentProxy, pageNumber: number): Promise<Uint8ClampedArray[]>;
17
+ declare function renderPageAsImage$1(data: BinaryData | PDFDocumentProxy, pageNumber: number, options?: {
18
+ /** @default 1 */
19
+ scale?: number;
20
+ width?: number;
21
+ height?: number;
22
+ }): Promise<ArrayBuffer>;
17
23
 
18
24
  type PDFJS = typeof _PDFJS;
19
25
  interface UnPDFConfiguration {
@@ -26,9 +32,11 @@ interface UnPDFConfiguration {
26
32
  * // Use the legacy build
27
33
  * () => import('pdfjs-dist/legacy/build/pdf.js')
28
34
  */
29
- pdfjs?: () => Promise<PDFJS>;
35
+ pdfjs?: () => Promise<any>;
30
36
  }
31
37
 
38
+ declare function defineUnPDFConfig(options: UnPDFConfiguration): Promise<void>;
39
+
32
40
  /**
33
41
  * Returns a PDFDocumentProxy instance from a given binary data.
34
42
  *
@@ -36,10 +44,16 @@ interface UnPDFConfiguration {
36
44
  * - `isEvalSupported: false`
37
45
  */
38
46
  declare function getDocumentProxy(data: BinaryData, options?: DocumentInitParameters): Promise<PDFDocumentProxy>;
39
- declare function defineUnPDFConfig(options: UnPDFConfiguration): Promise<void>;
40
47
  declare function getResolvedPDFJS(): Promise<PDFJS>;
41
- declare function resolvePDFJSImports(pdfjsResolver?: () => Promise<PDFJS>, { force }?: {
48
+ declare function resolvePDFJSImports(pdfjsResolver?: () => Promise<any>, { force }?: {
42
49
  force?: boolean | undefined;
43
50
  }): Promise<void>;
44
51
 
45
- export { getImagesFromPage as a, getDocumentProxy as b, getResolvedPDFJS as c, defineUnPDFConfig as d, extractPDFText as e, getPDFMeta as g, resolvePDFJSImports as r };
52
+ declare const getMeta: typeof getMeta$1;
53
+ declare const extractText: typeof extractText$1;
54
+ /** @deprecated Use `extractText` instead. */
55
+ declare const extractPDFText: typeof extractText$1;
56
+ declare const extractImages: typeof extractImages$1;
57
+ declare const renderPageAsImage: typeof renderPageAsImage$1;
58
+
59
+ export { defineUnPDFConfig, extractImages, extractPDFText, extractText, getDocumentProxy, getMeta, getResolvedPDFJS, renderPageAsImage, resolvePDFJSImports };
@@ -1,19 +1,25 @@
1
- import { BinaryData, PDFDocumentProxy, DocumentInitParameters } from '../types/src/display/api';
2
- import _PDFJS from '../types/src/pdf';
1
+ import { BinaryData, PDFDocumentProxy, DocumentInitParameters } from './types/src/display/api';
2
+ import * as _PDFJS from './types/src/pdf';
3
3
 
4
- declare function getPDFMeta(data: BinaryData | PDFDocumentProxy): Promise<{
4
+ declare function getMeta$1(data: BinaryData | PDFDocumentProxy): Promise<{
5
5
  info: Record<string, any>;
6
6
  metadata: Record<string, any>;
7
7
  }>;
8
8
 
9
- declare function extractPDFText(data: BinaryData | PDFDocumentProxy, options?: {
9
+ declare function extractText$1(data: BinaryData | PDFDocumentProxy, options?: {
10
10
  mergePages?: boolean;
11
11
  }): Promise<{
12
12
  totalPages: number;
13
13
  text: string | string[];
14
14
  }>;
15
15
 
16
- declare function getImagesFromPage(data: BinaryData | PDFDocumentProxy, pageNumber: number): Promise<ArrayBuffer[]>;
16
+ declare function extractImages$1(data: BinaryData | PDFDocumentProxy, pageNumber: number): Promise<Uint8ClampedArray[]>;
17
+ declare function renderPageAsImage$1(data: BinaryData | PDFDocumentProxy, pageNumber: number, options?: {
18
+ /** @default 1 */
19
+ scale?: number;
20
+ width?: number;
21
+ height?: number;
22
+ }): Promise<ArrayBuffer>;
17
23
 
18
24
  type PDFJS = typeof _PDFJS;
19
25
  interface UnPDFConfiguration {
@@ -26,9 +32,11 @@ interface UnPDFConfiguration {
26
32
  * // Use the legacy build
27
33
  * () => import('pdfjs-dist/legacy/build/pdf.js')
28
34
  */
29
- pdfjs?: () => Promise<PDFJS>;
35
+ pdfjs?: () => Promise<any>;
30
36
  }
31
37
 
38
+ declare function defineUnPDFConfig(options: UnPDFConfiguration): Promise<void>;
39
+
32
40
  /**
33
41
  * Returns a PDFDocumentProxy instance from a given binary data.
34
42
  *
@@ -36,10 +44,16 @@ interface UnPDFConfiguration {
36
44
  * - `isEvalSupported: false`
37
45
  */
38
46
  declare function getDocumentProxy(data: BinaryData, options?: DocumentInitParameters): Promise<PDFDocumentProxy>;
39
- declare function defineUnPDFConfig(options: UnPDFConfiguration): Promise<void>;
40
47
  declare function getResolvedPDFJS(): Promise<PDFJS>;
41
- declare function resolvePDFJSImports(pdfjsResolver?: () => Promise<PDFJS>, { force }?: {
48
+ declare function resolvePDFJSImports(pdfjsResolver?: () => Promise<any>, { force }?: {
42
49
  force?: boolean | undefined;
43
50
  }): Promise<void>;
44
51
 
45
- export { getImagesFromPage as a, getDocumentProxy as b, getResolvedPDFJS as c, defineUnPDFConfig as d, extractPDFText as e, getPDFMeta as g, resolvePDFJSImports as r };
52
+ declare const getMeta: typeof getMeta$1;
53
+ declare const extractText: typeof extractText$1;
54
+ /** @deprecated Use `extractText` instead. */
55
+ declare const extractPDFText: typeof extractText$1;
56
+ declare const extractImages: typeof extractImages$1;
57
+ declare const renderPageAsImage: typeof renderPageAsImage$1;
58
+
59
+ export { defineUnPDFConfig, extractImages, extractPDFText, extractText, getDocumentProxy, getMeta, getResolvedPDFJS, renderPageAsImage, resolvePDFJSImports };