@embedpdf/models 1.0.13 → 1.0.14
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/color.d.ts +42 -1
- package/dist/color.test.d.ts +1 -0
- package/dist/helpers/blend-mode.d.ts +53 -0
- package/dist/helpers/font.d.ts +63 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/text-alignment.d.ts +21 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +379 -70
- package/dist/index.js.map +1 -1
- package/dist/pdf.d.ts +84 -62
- package/package.json +1 -1
package/dist/pdf.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WebAlphaColor } from './color';
|
|
2
1
|
import { Size, Rect, Position, Rotation } from './geometry';
|
|
3
2
|
import { Task, TaskError } from './task';
|
|
4
3
|
/**
|
|
@@ -171,6 +170,42 @@ export declare enum PdfZoomMode {
|
|
|
171
170
|
*/
|
|
172
171
|
FitRectangle = 5
|
|
173
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* 12 default fonts for PDF
|
|
175
|
+
*/
|
|
176
|
+
export declare enum PdfStandardFont {
|
|
177
|
+
Unknown = -1,
|
|
178
|
+
Courier = 0,
|
|
179
|
+
Courier_Bold = 1,
|
|
180
|
+
Courier_BoldOblique = 2,
|
|
181
|
+
Courier_Oblique = 3,
|
|
182
|
+
Helvetica = 4,
|
|
183
|
+
Helvetica_Bold = 5,
|
|
184
|
+
Helvetica_BoldOblique = 6,
|
|
185
|
+
Helvetica_Oblique = 7,
|
|
186
|
+
Times_Roman = 8,
|
|
187
|
+
Times_Bold = 9,
|
|
188
|
+
Times_BoldItalic = 10,
|
|
189
|
+
Times_Italic = 11,
|
|
190
|
+
Symbol = 12,
|
|
191
|
+
ZapfDingbats = 13
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Text alignment
|
|
195
|
+
*/
|
|
196
|
+
export declare enum PdfTextAlignment {
|
|
197
|
+
Left = 0,
|
|
198
|
+
Center = 1,
|
|
199
|
+
Right = 2
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Vertical alignment
|
|
203
|
+
*/
|
|
204
|
+
export declare enum PdfVerticalAlignment {
|
|
205
|
+
Top = 0,
|
|
206
|
+
Middle = 1,
|
|
207
|
+
Bottom = 2
|
|
208
|
+
}
|
|
174
209
|
/**
|
|
175
210
|
* Blend mode
|
|
176
211
|
*
|
|
@@ -194,57 +229,6 @@ export declare enum PdfBlendMode {
|
|
|
194
229
|
Color = 14,
|
|
195
230
|
Luminosity = 15
|
|
196
231
|
}
|
|
197
|
-
/** Extra UI sentinel for “multiple different values selected”. */
|
|
198
|
-
export declare const MixedBlendMode: unique symbol;
|
|
199
|
-
export type UiBlendModeValue = PdfBlendMode | typeof MixedBlendMode;
|
|
200
|
-
export type CssBlendMode = 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity';
|
|
201
|
-
interface BlendModeInfo {
|
|
202
|
-
/** Pdf enum value */
|
|
203
|
-
id: PdfBlendMode;
|
|
204
|
-
/** Human label for UI */
|
|
205
|
-
label: string;
|
|
206
|
-
/** CSS mix-blend-mode token */
|
|
207
|
-
css: CssBlendMode;
|
|
208
|
-
}
|
|
209
|
-
/** Get descriptor (falls back to Normal if unknown number sneaks in).
|
|
210
|
-
*
|
|
211
|
-
* @public
|
|
212
|
-
*/
|
|
213
|
-
export declare function getBlendModeInfo(mode: PdfBlendMode): BlendModeInfo;
|
|
214
|
-
/** Convert enum → CSS value for `mix-blend-mode`.
|
|
215
|
-
*
|
|
216
|
-
* @public
|
|
217
|
-
*/
|
|
218
|
-
export declare function blendModeToCss(mode: PdfBlendMode): CssBlendMode;
|
|
219
|
-
/** Convert CSS token → enum (returns undefined if not recognized).
|
|
220
|
-
*
|
|
221
|
-
* @public
|
|
222
|
-
*/
|
|
223
|
-
export declare function cssToBlendMode(value: CssBlendMode): PdfBlendMode | undefined;
|
|
224
|
-
/** Enum → UI label.
|
|
225
|
-
*
|
|
226
|
-
* @public
|
|
227
|
-
*/
|
|
228
|
-
export declare function blendModeLabel(mode: PdfBlendMode): string;
|
|
229
|
-
/**
|
|
230
|
-
* For a selection of annotations: returns the common enum value, or Mixed sentinel.
|
|
231
|
-
*
|
|
232
|
-
* @public
|
|
233
|
-
*/
|
|
234
|
-
export declare function reduceBlendModes(modes: readonly PdfBlendMode[]): UiBlendModeValue;
|
|
235
|
-
/** Options for a <select>.
|
|
236
|
-
*
|
|
237
|
-
* @public
|
|
238
|
-
*/
|
|
239
|
-
export declare const blendModeSelectOptions: {
|
|
240
|
-
value: PdfBlendMode;
|
|
241
|
-
label: string;
|
|
242
|
-
}[];
|
|
243
|
-
/** Provide a label when Mixed sentinel used (UI convenience).
|
|
244
|
-
*
|
|
245
|
-
* @public
|
|
246
|
-
*/
|
|
247
|
-
export declare function uiBlendModeDisplay(value: UiBlendModeValue): string;
|
|
248
232
|
/**
|
|
249
233
|
* Representation of the linked destination
|
|
250
234
|
*
|
|
@@ -448,6 +432,16 @@ export interface PdfAlphaColor {
|
|
|
448
432
|
*/
|
|
449
433
|
alpha: number;
|
|
450
434
|
}
|
|
435
|
+
/**
|
|
436
|
+
* Color
|
|
437
|
+
*
|
|
438
|
+
* @public
|
|
439
|
+
*/
|
|
440
|
+
export interface PdfColor {
|
|
441
|
+
red: number;
|
|
442
|
+
green: number;
|
|
443
|
+
blue: number;
|
|
444
|
+
}
|
|
451
445
|
/**
|
|
452
446
|
* Annotation type
|
|
453
447
|
*
|
|
@@ -1458,7 +1452,45 @@ export interface PdfCaretAnnoObject extends PdfAnnotationObjectBase {
|
|
|
1458
1452
|
export interface PdfFreeTextAnnoObject extends PdfAnnotationObjectBase {
|
|
1459
1453
|
/** {@inheritDoc PdfAnnotationObjectBase.type} */
|
|
1460
1454
|
type: PdfAnnotationSubtype.FREETEXT;
|
|
1455
|
+
/**
|
|
1456
|
+
* Text contents of the free text annotation
|
|
1457
|
+
*/
|
|
1461
1458
|
contents: string;
|
|
1459
|
+
/**
|
|
1460
|
+
* Font family of the free text annotation
|
|
1461
|
+
*/
|
|
1462
|
+
fontFamily: PdfStandardFont;
|
|
1463
|
+
/**
|
|
1464
|
+
* Font size of the free text annotation
|
|
1465
|
+
*/
|
|
1466
|
+
fontSize: number;
|
|
1467
|
+
/**
|
|
1468
|
+
* Font color of the free text annotation
|
|
1469
|
+
*/
|
|
1470
|
+
fontColor: string;
|
|
1471
|
+
/**
|
|
1472
|
+
* Text alignment of the free text annotation
|
|
1473
|
+
*/
|
|
1474
|
+
textAlign: PdfTextAlignment;
|
|
1475
|
+
/**
|
|
1476
|
+
* Vertical alignment of the free text annotation
|
|
1477
|
+
*/
|
|
1478
|
+
verticalAlign: PdfVerticalAlignment;
|
|
1479
|
+
/**
|
|
1480
|
+
* Opacity of the free text annotation
|
|
1481
|
+
*/
|
|
1482
|
+
opacity: number;
|
|
1483
|
+
/**
|
|
1484
|
+
* Background color of the free text annotation
|
|
1485
|
+
*/
|
|
1486
|
+
backgroundColor?: string;
|
|
1487
|
+
/**
|
|
1488
|
+
* Default style of the free text annotation
|
|
1489
|
+
*/
|
|
1490
|
+
defaultStyle?: string;
|
|
1491
|
+
/**
|
|
1492
|
+
* Rich content of the free text annotation
|
|
1493
|
+
*/
|
|
1462
1494
|
richContent?: string;
|
|
1463
1495
|
}
|
|
1464
1496
|
/**
|
|
@@ -2010,16 +2042,6 @@ export interface PdfEngine<T = Blob> {
|
|
|
2010
2042
|
* @returns task contains the annotations or error
|
|
2011
2043
|
*/
|
|
2012
2044
|
getPageAnnotations: (doc: PdfDocumentObject, page: PdfPageObject) => PdfTask<PdfAnnotationObject[]>;
|
|
2013
|
-
/**
|
|
2014
|
-
* Change the visible colour (and opacity) of an existing annotation.
|
|
2015
|
-
* @param doc - pdf document
|
|
2016
|
-
* @param page - pdf page
|
|
2017
|
-
* @param annotation - the annotation to recolour
|
|
2018
|
-
* @param colour - RGBA color values (0-255 per channel)
|
|
2019
|
-
* @param which - 0 = stroke/fill colour (PDFium's "colourType" param)
|
|
2020
|
-
* @returns task that indicates whether the operation succeeded
|
|
2021
|
-
*/
|
|
2022
|
-
updateAnnotationColor: (doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObjectBase, color: WebAlphaColor, which?: number) => PdfTask<boolean>;
|
|
2023
2045
|
/**
|
|
2024
2046
|
* Create a annotation on specified page
|
|
2025
2047
|
* @param doc - pdf document
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/models",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
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",
|