@embedpdf/models 1.2.1 → 1.3.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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/pdf.d.ts +76 -5
- package/package.json +2 -2
package/dist/pdf.d.ts
CHANGED
|
@@ -155,7 +155,7 @@ export declare const PdfUnwantedTextRegex: RegExp;
|
|
|
155
155
|
*/
|
|
156
156
|
export declare function stripPdfUnwantedMarkers(text: string): string;
|
|
157
157
|
/**
|
|
158
|
-
*
|
|
158
|
+
* Zoom mode
|
|
159
159
|
*
|
|
160
160
|
* @public
|
|
161
161
|
*/
|
|
@@ -170,17 +170,29 @@ export declare enum PdfZoomMode {
|
|
|
170
170
|
*/
|
|
171
171
|
FitPage = 2,
|
|
172
172
|
/**
|
|
173
|
-
* Fit the page width.
|
|
173
|
+
* Fit the entire page width to the window.
|
|
174
174
|
*/
|
|
175
175
|
FitHorizontal = 3,
|
|
176
176
|
/**
|
|
177
|
-
* Fit the page height.
|
|
177
|
+
* Fit the entire page height to the window.
|
|
178
178
|
*/
|
|
179
179
|
FitVertical = 4,
|
|
180
180
|
/**
|
|
181
181
|
* Fit a specific rectangle area within the window.
|
|
182
182
|
*/
|
|
183
|
-
FitRectangle = 5
|
|
183
|
+
FitRectangle = 5,
|
|
184
|
+
/**
|
|
185
|
+
* Fit bounding box of the entire page (including annotations).
|
|
186
|
+
*/
|
|
187
|
+
FitBoundingBox = 6,
|
|
188
|
+
/**
|
|
189
|
+
* Fit the bounding box width of the page.
|
|
190
|
+
*/
|
|
191
|
+
FitBoundingBoxHorizontal = 7,
|
|
192
|
+
/**
|
|
193
|
+
* Fit the bounding box height of the page.
|
|
194
|
+
*/
|
|
195
|
+
FitBoundingBoxVertical = 8
|
|
184
196
|
}
|
|
185
197
|
/**
|
|
186
198
|
* Trapped status of the document.
|
|
@@ -302,6 +314,12 @@ export interface PdfDestinationObject {
|
|
|
302
314
|
mode: PdfZoomMode.FitVertical;
|
|
303
315
|
} | {
|
|
304
316
|
mode: PdfZoomMode.FitRectangle;
|
|
317
|
+
} | {
|
|
318
|
+
mode: PdfZoomMode.FitBoundingBox;
|
|
319
|
+
} | {
|
|
320
|
+
mode: PdfZoomMode.FitBoundingBoxHorizontal;
|
|
321
|
+
} | {
|
|
322
|
+
mode: PdfZoomMode.FitBoundingBoxVertical;
|
|
305
323
|
};
|
|
306
324
|
view: number[];
|
|
307
325
|
}
|
|
@@ -1717,7 +1735,10 @@ export type PdfAnnotationObject = PdfSupportedAnnoObject | PdfUnsupportedAnnoObj
|
|
|
1717
1735
|
export interface PdfAttachmentObject {
|
|
1718
1736
|
index: number;
|
|
1719
1737
|
name: string;
|
|
1720
|
-
|
|
1738
|
+
description: string;
|
|
1739
|
+
mimeType: string;
|
|
1740
|
+
size?: number;
|
|
1741
|
+
creationDate?: Date;
|
|
1721
1742
|
checksum: string;
|
|
1722
1743
|
}
|
|
1723
1744
|
/**
|
|
@@ -2227,6 +2248,27 @@ export interface PdfPrintOptions {
|
|
|
2227
2248
|
*/
|
|
2228
2249
|
pageRange?: string;
|
|
2229
2250
|
}
|
|
2251
|
+
/**
|
|
2252
|
+
* Parameters for adding an attachment to a PDF document
|
|
2253
|
+
*/
|
|
2254
|
+
export interface PdfAddAttachmentParams {
|
|
2255
|
+
/**
|
|
2256
|
+
* Name of the attachment
|
|
2257
|
+
*/
|
|
2258
|
+
name: string;
|
|
2259
|
+
/**
|
|
2260
|
+
* Description of the attachment
|
|
2261
|
+
*/
|
|
2262
|
+
description: string;
|
|
2263
|
+
/**
|
|
2264
|
+
* MIME type of the attachment
|
|
2265
|
+
*/
|
|
2266
|
+
mimeType: string;
|
|
2267
|
+
/**
|
|
2268
|
+
* Data of the attachment
|
|
2269
|
+
*/
|
|
2270
|
+
data: ArrayBuffer | Uint8Array;
|
|
2271
|
+
}
|
|
2230
2272
|
/**
|
|
2231
2273
|
* Pdf engine
|
|
2232
2274
|
*
|
|
@@ -2300,6 +2342,19 @@ export interface PdfEngine<T = Blob> {
|
|
|
2300
2342
|
* @returns task that contains the bookmarks or error
|
|
2301
2343
|
*/
|
|
2302
2344
|
getBookmarks: (doc: PdfDocumentObject) => PdfTask<PdfBookmarksObject>;
|
|
2345
|
+
/**
|
|
2346
|
+
* Set the bookmarks of the file
|
|
2347
|
+
* @param doc - pdf document
|
|
2348
|
+
* @param payload - bookmarks to set
|
|
2349
|
+
* @returns task that contains whether the bookmarks are set successfully or not
|
|
2350
|
+
*/
|
|
2351
|
+
setBookmarks: (doc: PdfDocumentObject, payload: PdfBookmarkObject[]) => PdfTask<boolean>;
|
|
2352
|
+
/**
|
|
2353
|
+
* Remove all bookmarks from the document.
|
|
2354
|
+
* @param doc - pdf document
|
|
2355
|
+
* @returns task that contains whether the bookmarks are removed successfully or not
|
|
2356
|
+
*/
|
|
2357
|
+
deleteBookmarks: (doc: PdfDocumentObject) => PdfTask<boolean>;
|
|
2303
2358
|
/**
|
|
2304
2359
|
* Render the specified pdf page
|
|
2305
2360
|
* @param doc - pdf document
|
|
@@ -2396,6 +2451,22 @@ export interface PdfEngine<T = Blob> {
|
|
|
2396
2451
|
* @returns task that contains the attachments or error
|
|
2397
2452
|
*/
|
|
2398
2453
|
getAttachments: (doc: PdfDocumentObject) => PdfTask<PdfAttachmentObject[]>;
|
|
2454
|
+
/**
|
|
2455
|
+
* Add a attachment to the file
|
|
2456
|
+
/**
|
|
2457
|
+
* @param doc - pdf document
|
|
2458
|
+
* @param attachment - pdf attachment
|
|
2459
|
+
* @returns task that contains the attachment or error
|
|
2460
|
+
*/
|
|
2461
|
+
addAttachment: (doc: PdfDocumentObject, params: PdfAddAttachmentParams) => PdfTask<boolean>;
|
|
2462
|
+
/**
|
|
2463
|
+
* Remove a attachment from the file
|
|
2464
|
+
/**
|
|
2465
|
+
* @param doc - pdf document
|
|
2466
|
+
* @param attachment - pdf attachment
|
|
2467
|
+
* @returns task that contains the attachment or error
|
|
2468
|
+
*/
|
|
2469
|
+
removeAttachment: (doc: PdfDocumentObject, attachment: PdfAttachmentObject) => PdfTask<boolean>;
|
|
2399
2470
|
/**
|
|
2400
2471
|
* Read content of pdf attachment
|
|
2401
2472
|
* @param doc - pdf document
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/models",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared type definitions, data models, and utility helpers (geometry, tasks, logging, PDF primitives) that underpin every package in the EmbedPDF ecosystem.",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"typescript": "^5.0.0",
|
|
34
34
|
"@types/jest": "^29.5.14",
|
|
35
35
|
"jest": "^29.7.0",
|
|
36
|
-
"@embedpdf/build": "1.0.
|
|
36
|
+
"@embedpdf/build": "1.0.1"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|