unpdf 0.2.0 → 0.2.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 +28 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A collection of utilities to work with PDFs.
|
|
|
6
6
|
|
|
7
7
|
**Why this package then?**
|
|
8
8
|
|
|
9
|
-
- To circumvent build issues in serverless environments, where the `canvas` package
|
|
9
|
+
- To circumvent build issues in serverless environments, where the `canvas` package used by `PDF.js` is not supported.
|
|
10
10
|
- WIP and more to come.
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
@@ -36,6 +36,33 @@ const { totalPages, info, metadata, text } = await decodePDFText(
|
|
|
36
36
|
)
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
## Methods
|
|
40
|
+
|
|
41
|
+
### `decodePDFText`
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
interface PDFContent {
|
|
45
|
+
totalPages: number
|
|
46
|
+
info?: Record<string, any>
|
|
47
|
+
metadata?: any
|
|
48
|
+
text: string | string[]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function decodePDFText(
|
|
52
|
+
data: ArrayBuffer,
|
|
53
|
+
{ mergePages }?: { mergePages?: boolean }
|
|
54
|
+
): Promise<PDFContent>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### `getImagesFromPage`
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
function getImagesFromPage(
|
|
61
|
+
data: ArrayBuffer,
|
|
62
|
+
pageNumber: number
|
|
63
|
+
): Promise<ArrayBuffer[]>
|
|
64
|
+
```
|
|
65
|
+
|
|
39
66
|
## License
|
|
40
67
|
|
|
41
68
|
[MIT](./LICENSE) License © 2023-PRESENT [Johann Schopplich](https://github.com/johannschopplich)
|