@swc/anyformat-pdf-wasm32-wasi 0.2.0 → 0.2.2
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.
|
@@ -1449,3 +1449,16 @@ export const isPdf = __napiModule.exports.isPdf
|
|
|
1449
1449
|
export const isPdfFile = __napiModule.exports.isPdfFile
|
|
1450
1450
|
export const isPdfFileSync = __napiModule.exports.isPdfFileSync
|
|
1451
1451
|
export const isPdfSync = __napiModule.exports.isPdfSync
|
|
1452
|
+
export const mergePdfs = __napiModule.exports.mergePdfs
|
|
1453
|
+
export const mergePdfsSync = __napiModule.exports.mergePdfsSync
|
|
1454
|
+
export const parsePageRanges = __napiModule.exports.parsePageRanges
|
|
1455
|
+
export const readPdfInfo = __napiModule.exports.readPdfInfo
|
|
1456
|
+
export const readPdfInfoSync = __napiModule.exports.readPdfInfoSync
|
|
1457
|
+
export const removePages = __napiModule.exports.removePages
|
|
1458
|
+
export const removePagesSync = __napiModule.exports.removePagesSync
|
|
1459
|
+
export const rotatePages = __napiModule.exports.rotatePages
|
|
1460
|
+
export const rotatePagesSync = __napiModule.exports.rotatePagesSync
|
|
1461
|
+
export const selectPages = __napiModule.exports.selectPages
|
|
1462
|
+
export const selectPagesSync = __napiModule.exports.selectPagesSync
|
|
1463
|
+
export const splitPdf = __napiModule.exports.splitPdf
|
|
1464
|
+
export const splitPdfSync = __napiModule.exports.splitPdfSync
|
package/anyformat-pdf.wasi.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// napi-rs-artifact-metadata:{"version":2,"rootEntry":"binding.js","exports":["detectVersion","detectVersionFile","detectVersionFileSync","detectVersionSync","HEADER_PREFIX_LEN","isPdf","isPdfFile","isPdfFileSync","isPdfSync"],"managedRootEntries":["browser.js","binding.js","anyformat-pdf.wasm","anyformat-pdf.debug.wasm"]}
|
|
1
|
+
// napi-rs-artifact-metadata:{"version":2,"rootEntry":"binding.js","exports":["detectVersion","detectVersionFile","detectVersionFileSync","detectVersionSync","HEADER_PREFIX_LEN","isPdf","isPdfFile","isPdfFileSync","isPdfSync","mergePdfs","mergePdfsSync","parsePageRanges","readPdfInfo","readPdfInfoSync","removePages","removePagesSync","rotatePages","rotatePagesSync","selectPages","selectPagesSync","splitPdf","splitPdfSync"],"managedRootEntries":["browser.js","binding.js","anyformat-pdf.wasm","anyformat-pdf.debug.wasm"]}
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/* auto-generated by NAPI-RS */
|
|
4
4
|
|
|
@@ -2306,3 +2306,16 @@ module.exports.isPdf = __napiModule.exports.isPdf
|
|
|
2306
2306
|
module.exports.isPdfFile = __napiModule.exports.isPdfFile
|
|
2307
2307
|
module.exports.isPdfFileSync = __napiModule.exports.isPdfFileSync
|
|
2308
2308
|
module.exports.isPdfSync = __napiModule.exports.isPdfSync
|
|
2309
|
+
module.exports.mergePdfs = __napiModule.exports.mergePdfs
|
|
2310
|
+
module.exports.mergePdfsSync = __napiModule.exports.mergePdfsSync
|
|
2311
|
+
module.exports.parsePageRanges = __napiModule.exports.parsePageRanges
|
|
2312
|
+
module.exports.readPdfInfo = __napiModule.exports.readPdfInfo
|
|
2313
|
+
module.exports.readPdfInfoSync = __napiModule.exports.readPdfInfoSync
|
|
2314
|
+
module.exports.removePages = __napiModule.exports.removePages
|
|
2315
|
+
module.exports.removePagesSync = __napiModule.exports.removePagesSync
|
|
2316
|
+
module.exports.rotatePages = __napiModule.exports.rotatePages
|
|
2317
|
+
module.exports.rotatePagesSync = __napiModule.exports.rotatePagesSync
|
|
2318
|
+
module.exports.selectPages = __napiModule.exports.selectPages
|
|
2319
|
+
module.exports.selectPagesSync = __napiModule.exports.selectPagesSync
|
|
2320
|
+
module.exports.splitPdf = __napiModule.exports.splitPdf
|
|
2321
|
+
module.exports.splitPdfSync = __napiModule.exports.splitPdfSync
|
package/anyformat-pdf.wasi.d.cts
CHANGED
|
@@ -4,6 +4,20 @@
|
|
|
4
4
|
/** The WASI flavor this loader instantiates. */
|
|
5
5
|
export declare const __napiBindingTarget: 'wasm32-wasi'
|
|
6
6
|
|
|
7
|
+
/** The angles of `rotatePages`, after `index.js` checked them. */
|
|
8
|
+
export interface AnglesInput {
|
|
9
|
+
/**
|
|
10
|
+
* 'number': one angle for the pages of `values` (an encoded selection),
|
|
11
|
+
* or for all pages when `values` is not set. 'map': pairs of a page
|
|
12
|
+
* index and an angle. 'list': the angle of each page, NaN for no change.
|
|
13
|
+
*/
|
|
14
|
+
kind: string
|
|
15
|
+
/** The angle of 'number'. */
|
|
16
|
+
angle?: number
|
|
17
|
+
/** The values of the kind. */
|
|
18
|
+
values?: Float64Array
|
|
19
|
+
}
|
|
20
|
+
|
|
7
21
|
/**
|
|
8
22
|
* Reads the version, for example `"1.7"`, from the PDF header of `data`, on
|
|
9
23
|
* the thread pool. Copies only the first 1031 bytes, so the caller can
|
|
@@ -67,3 +81,145 @@ export declare function isPdfFileSync(path: string): boolean
|
|
|
67
81
|
|
|
68
82
|
/** Returns `true` when `data` starts with a PDF file header. */
|
|
69
83
|
export declare function isPdfSync(data: Uint8Array): boolean
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Copies the pages of the parts, in order, to a new PDF file, on the
|
|
87
|
+
* thread pool. Copies each source buffer once before it returns.
|
|
88
|
+
*/
|
|
89
|
+
export declare function mergePdfs(sources: Array<Uint8Array | string>, parts: Array<PartInput>, options?: PageOptions | undefined | null): Promise<Buffer>
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Copies the pages of the parts, in order, to a new PDF file. `sources`
|
|
93
|
+
* are the distinct PDF files, and each part refers to one of them by its
|
|
94
|
+
* index.
|
|
95
|
+
*/
|
|
96
|
+
export declare function mergePdfsSync(sources: Array<Uint8Array | string>, parts: Array<PartInput>, options?: PageOptions | undefined | null): Buffer
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The options of the page functions, after `index.js` checked their types.
|
|
100
|
+
* Each function reads only its own options.
|
|
101
|
+
*/
|
|
102
|
+
export interface PageOptions {
|
|
103
|
+
/** The password of the input. */
|
|
104
|
+
password?: string | Uint8Array
|
|
105
|
+
/** Write object streams and a cross-reference stream. */
|
|
106
|
+
objectStreams?: boolean
|
|
107
|
+
/** The version in the header of the output. */
|
|
108
|
+
version?: string
|
|
109
|
+
/** Copy the outline items. */
|
|
110
|
+
outlines?: boolean
|
|
111
|
+
/** Copy the page labels. */
|
|
112
|
+
pageLabels?: boolean
|
|
113
|
+
/** 'rename' or 'join'. */
|
|
114
|
+
formFields?: string
|
|
115
|
+
/** `mergePdfs`: the index of the base document. */
|
|
116
|
+
base?: number
|
|
117
|
+
/** `splitPdf`: one encoded selection for each output. */
|
|
118
|
+
ranges?: Array<Float64Array>
|
|
119
|
+
/** `splitPdf`: the number of pages of each output. */
|
|
120
|
+
every?: number
|
|
121
|
+
/** `splitPdf`: keep the document-level data in each output. */
|
|
122
|
+
documentData?: boolean
|
|
123
|
+
/** `rotatePages`: 'add' or 'set'. */
|
|
124
|
+
mode?: string
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Parses a page selection that a person typed. Returns the selection
|
|
129
|
+
* encoded as `to_selection` reads it. `index.js` makes the JavaScript
|
|
130
|
+
* values.
|
|
131
|
+
*/
|
|
132
|
+
export declare function parsePageRanges(text: string, pageCount?: number | undefined | null): Float64Array
|
|
133
|
+
|
|
134
|
+
/** An input of `mergePdfs`, after `index.js` checked it. */
|
|
135
|
+
export interface PartInput {
|
|
136
|
+
/** The index of the PDF file in the sources. */
|
|
137
|
+
source: number
|
|
138
|
+
/** The encoded selection of the pages to copy. Default: all pages. */
|
|
139
|
+
pages?: Float64Array
|
|
140
|
+
/** An angle in degrees, a multiple of 90. */
|
|
141
|
+
rotate?: number
|
|
142
|
+
/** 'add' or 'set'. */
|
|
143
|
+
rotateMode?: string
|
|
144
|
+
/** The password of the source. */
|
|
145
|
+
password?: string | Uint8Array
|
|
146
|
+
/** The title of an outline item for the part. */
|
|
147
|
+
outline?: string
|
|
148
|
+
/** Copy the outline items of the source with this part. */
|
|
149
|
+
outlines?: boolean
|
|
150
|
+
/** The part is a separate copy of its source. */
|
|
151
|
+
separate?: boolean
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** The result of `readPdfInfo`. */
|
|
155
|
+
export interface PdfInfo {
|
|
156
|
+
version: string
|
|
157
|
+
pageCount: number
|
|
158
|
+
encrypted: boolean
|
|
159
|
+
repaired: boolean
|
|
160
|
+
pages: Array<PdfPageInfo>
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** The boxes and the rotation of a page. */
|
|
164
|
+
export interface PdfPageInfo {
|
|
165
|
+
width: number
|
|
166
|
+
height: number
|
|
167
|
+
rotation: number
|
|
168
|
+
mediaBox: PdfRect
|
|
169
|
+
cropBox: PdfRect
|
|
170
|
+
bleedBox: PdfRect
|
|
171
|
+
trimBox: PdfRect
|
|
172
|
+
artBox: PdfRect
|
|
173
|
+
userUnit: number
|
|
174
|
+
definedBoxes: Array<string>
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** A rectangle in PDF user space. */
|
|
178
|
+
export interface PdfRect {
|
|
179
|
+
x: number
|
|
180
|
+
y: number
|
|
181
|
+
width: number
|
|
182
|
+
height: number
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Reads the version, the page count, and the boxes and rotations of the
|
|
187
|
+
* pages, on the thread pool.
|
|
188
|
+
*/
|
|
189
|
+
export declare function readPdfInfo(data: Uint8Array | string, options?: PageOptions | undefined | null): Promise<PdfInfo>
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Reads the version, the page count, and the boxes and rotations of the
|
|
193
|
+
* pages.
|
|
194
|
+
*/
|
|
195
|
+
export declare function readPdfInfoSync(data: Uint8Array | string, options?: PageOptions | undefined | null): PdfInfo
|
|
196
|
+
|
|
197
|
+
/** Removes the selected pages, on the thread pool. */
|
|
198
|
+
export declare function removePages(data: Uint8Array | string, pages: Float64Array, options?: PageOptions | undefined | null): Promise<Buffer>
|
|
199
|
+
|
|
200
|
+
/** Removes the selected pages. */
|
|
201
|
+
export declare function removePagesSync(data: Uint8Array | string, pages: Float64Array, options?: PageOptions | undefined | null): Buffer
|
|
202
|
+
|
|
203
|
+
/** Rotates pages clockwise, on the thread pool. */
|
|
204
|
+
export declare function rotatePages(data: Uint8Array | string, angles: AnglesInput, options?: PageOptions | undefined | null): Promise<Buffer>
|
|
205
|
+
|
|
206
|
+
/** Rotates pages clockwise. */
|
|
207
|
+
export declare function rotatePagesSync(data: Uint8Array | string, angles: AnglesInput, options?: PageOptions | undefined | null): Buffer
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Makes a copy of the document with only the selected pages, on the
|
|
211
|
+
* thread pool.
|
|
212
|
+
*/
|
|
213
|
+
export declare function selectPages(data: Uint8Array | string, pages: Float64Array, options?: PageOptions | undefined | null): Promise<Buffer>
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Makes a copy of the document with only the selected pages, in the order
|
|
217
|
+
* of the selection.
|
|
218
|
+
*/
|
|
219
|
+
export declare function selectPagesSync(data: Uint8Array | string, pages: Float64Array, options?: PageOptions | undefined | null): Buffer
|
|
220
|
+
|
|
221
|
+
/** Splits a PDF file into new PDF files, on the thread pool. */
|
|
222
|
+
export declare function splitPdf(data: Uint8Array | string, options?: PageOptions | undefined | null): Promise<Buffer[]>
|
|
223
|
+
|
|
224
|
+
/** Splits a PDF file into new PDF files. */
|
|
225
|
+
export declare function splitPdfSync(data: Uint8Array | string, options?: PageOptions | undefined | null): Array<Buffer>
|
|
Binary file
|