@embedpdf/models 1.0.11 → 1.0.12

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.
@@ -1,656 +1,12 @@
1
- /**
2
- * Clockwise direction
3
- * @public
4
- */
5
- declare enum Rotation {
6
- Degree0 = 0,
7
- Degree90 = 1,
8
- Degree180 = 2,
9
- Degree270 = 3
10
- }
11
- /** Clamp a Position to device-pixel integers (floor) */
12
- declare function toIntPos(p: Position): Position;
13
- /** Clamp a Size so it never truncates right / bottom (ceil) */
14
- declare function toIntSize(s: Size): Size;
15
- /** Apply both rules to a Rect */
16
- declare function toIntRect(r: Rect): Rect;
17
- /**
18
- * Calculate degree that match the rotation type
19
- * @param rotation - type of rotation
20
- * @returns rotated degree
21
- *
22
- * @public
23
- */
24
- declare function calculateDegree(rotation: Rotation): 0 | 90 | 180 | 270;
25
- /**
26
- * Calculate angle that match the rotation type
27
- * @param rotation - type of rotation
28
- * @returns rotated angle
29
- *
30
- * @public
31
- */
32
- declare function calculateAngle(rotation: Rotation): number;
33
- /**
34
- * Represent the size of object
35
- *
36
- * @public
37
- */
38
- interface Size {
39
- /**
40
- * width of the object
41
- */
42
- width: number;
43
- /**
44
- * height of the object
45
- */
46
- height: number;
47
- }
48
- /**
49
- * Represents a rectangle defined by its left, top, right, and bottom edges
50
- *
51
- * @public
52
- */
53
- interface Box {
54
- /**
55
- * The x-coordinate of the left edge
56
- */
57
- left: number;
58
- /**
59
- * The y-coordinate of the top edge
60
- */
61
- top: number;
62
- /**
63
- * The x-coordinate of the right edge
64
- */
65
- right: number;
66
- /**
67
- * The y-coordinate of the bottom edge
68
- */
69
- bottom: number;
70
- }
71
- /**
72
- * Swap the width and height of the size object
73
- * @param size - the original size
74
- * @returns swapped size
75
- *
76
- * @public
77
- */
78
- declare function swap(size: Size): Size;
79
- /**
80
- * Transform size with specified rotation angle and scale factor
81
- * @param size - orignal size of rect
82
- * @param rotation - rotation angle
83
- * @param scaleFactor - - scale factor
84
- * @returns size that has been transformed
85
- *
86
- * @public
87
- */
88
- declare function transformSize(size: Size, rotation: Rotation, scaleFactor: number): Size;
89
- /**
90
- * position of point
91
- *
92
- * @public
93
- */
94
- interface Position {
95
- /**
96
- * x coordinate
97
- */
98
- x: number;
99
- /**
100
- * y coordinate
101
- */
102
- y: number;
103
- }
104
- /**
105
- * Quadrilateral
106
- *
107
- * @public
108
- */
109
- interface Quad {
110
- p1: Position;
111
- p2: Position;
112
- p3: Position;
113
- p4: Position;
114
- }
115
- /**
116
- * Convert quadrilateral to rectangle
117
- * @param q - quadrilateral
118
- * @returns rectangle
119
- *
120
- * @public
121
- */
122
- declare function quadToRect(q: Quad): Rect;
123
- /**
124
- * Convert rectangle to quadrilateral
125
- * @param r - rectangle
126
- * @returns quadrilateral
127
- *
128
- * @public
129
- */
130
- declare function rectToQuad(r: Rect): Quad;
131
- /**
132
- * Rotate the container and calculate the new position for a point
133
- * in specified position
134
- * @param containerSize - size of the container
135
- * @param position - position of the point
136
- * @param rotation - rotated angle
137
- * @returns new position of the point
138
- *
139
- * @public
140
- */
141
- declare function rotatePosition(containerSize: Size, position: Position, rotation: Rotation): Position;
142
- /**
143
- * Calculate the position of point by scaling the container
144
- * @param position - position of the point
145
- * @param scaleFactor - factor of scaling
146
- * @returns new position of point
147
- *
148
- * @public
149
- */
150
- declare function scalePosition(position: Position, scaleFactor: number): Position;
151
- /**
152
- * Calculate the position of the point by applying the specified transformation
153
- * @param containerSize - size of container
154
- * @param position - position of the point
155
- * @param rotation - rotated angle
156
- * @param scaleFactor - factor of scaling
157
- * @returns new position of point
158
- *
159
- * @public
160
- */
161
- declare function transformPosition(containerSize: Size, position: Position, rotation: Rotation, scaleFactor: number): Position;
162
- /**
163
- * Restore the position in a transformed cotainer
164
- * @param containerSize - size of the container
165
- * @param position - position of the point
166
- * @param rotation - rotated angle
167
- * @param scaleFactor - factor of scaling
168
- * @returns the original position of the point
169
- *
170
- * @public
171
- */
172
- declare function restorePosition(containerSize: Size, position: Position, rotation: Rotation, scaleFactor: number): Position;
173
- /**
174
- * representation of rectangle
175
- *
176
- * @public
177
- */
178
- interface Rect {
179
- /**
180
- * origin of the rectangle
181
- */
182
- origin: Position;
183
- /**
184
- * size of the rectangle
185
- */
186
- size: Size;
187
- }
188
- /**
189
- * Calculate the rect after rotated the container
190
- * @param containerSize - size of container
191
- * @param rect - target rect
192
- * @param rotation - rotation angle
193
- * @returns rotated rect
194
- *
195
- * @public
196
- */
197
- declare function rotateRect(containerSize: Size, rect: Rect, rotation: Rotation): Rect;
198
- /**
199
- * Scale the rectangle
200
- * @param rect - rectangle
201
- * @param scaleFactor - factor of scaling
202
- * @returns new rectangle
203
- *
204
- * @public
205
- */
206
- declare function scaleRect(rect: Rect, scaleFactor: number): Rect;
207
- /**
208
- * Calculate new rectangle after transforming the container
209
- * @param containerSize - size of the container
210
- * @param rect - the target rectangle
211
- * @param rotation - rotated angle
212
- * @param scaleFactor - factor of scaling
213
- * @returns new rectangle after transformation
214
- *
215
- * @public
216
- */
217
- declare function transformRect(containerSize: Size, rect: Rect, rotation: Rotation, scaleFactor: number): Rect;
218
- /**
219
- * Calculate new rectangle before transforming the container
220
- * @param containerSize - size of the container
221
- * @param rect - the target rectangle
222
- * @param rotation - rotated angle
223
- * @param scaleFactor - factor of scaling
224
- * @returns original rectangle before transformation
225
- *
226
- * @public
227
- */
228
- declare function restoreRect(containerSize: Size, rect: Rect, rotation: Rotation, scaleFactor: number): Rect;
229
- /**
230
- * Calculate the original offset in a transformed container
231
- * @param offset - position of the point
232
- * @param rotation - rotated angle
233
- * @param scaleFactor - factor of scaling
234
- * @returns original position of the point
235
- *
236
- * @public
237
- */
238
- declare function restoreOffset(offset: Position, rotation: Rotation, scaleFactor: number): Position;
239
- /**
240
- * Return the smallest rectangle that encloses *all* `rects`.
241
- * If the array is empty, returns `null`.
242
- *
243
- * @param rects - array of rectangles
244
- * @returns smallest rectangle that encloses all the rectangles
245
- *
246
- * @public
247
- */
248
- declare function boundingRect(rects: Rect[]): Rect | null;
249
- interface Matrix {
250
- a: number;
251
- b: number;
252
- c: number;
253
- d: number;
254
- e: number;
255
- f: number;
256
- }
257
- /**
258
- * Build a CTM that maps *PDF-space* inside the annotation
259
- * → *device-space* inside the bitmap, honouring
260
- * zoom (scaleFactor × dpr) **and** page-rotation.
261
- */
262
- /** build the CTM for any page-rotation */
263
- declare const makeMatrix: (rectangle: Rect, rotation: Rotation, scaleFactor: number) => Matrix;
264
-
265
- /**
266
- * logger for logging
267
- *
268
- * @public
269
- */
270
- interface Logger {
271
- /**
272
- * Log debug message
273
- * @param source - source of log
274
- * @param category - category of log
275
- * @param args - parameters of log
276
- * @returns
277
- *
278
- * @public
279
- */
280
- debug: (source: string, category: string, ...args: any) => void;
281
- /**
282
- * Log infor message
283
- * @param source - source of log
284
- * @param category - category of log
285
- * @param args - parameters of log
286
- * @returns
287
- *
288
- * @public
289
- */
290
- info: (source: string, category: string, ...args: any) => void;
291
- /**
292
- * Log warning message
293
- * @param source - source of log
294
- * @param category - category of log
295
- * @param args - parameters of log
296
- * @returns
297
- *
298
- * @public
299
- */
300
- warn: (source: string, category: string, ...args: any) => void;
301
- /**
302
- * Log error message
303
- * @param source - source of log
304
- * @param category - category of log
305
- * @param args - parameters of log
306
- * @returns
307
- *
308
- * @public
309
- */
310
- error: (source: string, category: string, ...args: any) => void;
311
- /**
312
- * Log performance log
313
- * @param source - source of log
314
- * @param category - category of log
315
- * @param event - event of log
316
- * @param phase - event phase of log
317
- * @param args - parameters of log
318
- * @returns
319
- *
320
- * @public
321
- */
322
- perf: (source: string, category: string, event: string, phase: 'Begin' | 'End', ...args: any) => void;
323
- }
324
- /**
325
- * Logger that log nothing, it will ignore all the logs
326
- *
327
- * @public
328
- */
329
- declare class NoopLogger implements Logger {
330
- /** {@inheritDoc Logger.debug} */
331
- debug(): void;
332
- /** {@inheritDoc Logger.info} */
333
- info(): void;
334
- /** {@inheritDoc Logger.warn} */
335
- warn(): void;
336
- /** {@inheritDoc Logger.error} */
337
- error(): void;
338
- /** {@inheritDoc Logger.perf} */
339
- perf(): void;
340
- }
341
- /**
342
- * Logger that use console as the output
343
- *
344
- * @public
345
- */
346
- declare class ConsoleLogger implements Logger {
347
- /** {@inheritDoc Logger.debug} */
348
- debug(source: string, category: string, ...args: any): void;
349
- /** {@inheritDoc Logger.info} */
350
- info(source: string, category: string, ...args: any): void;
351
- /** {@inheritDoc Logger.warn} */
352
- warn(source: string, category: string, ...args: any): void;
353
- /** {@inheritDoc Logger.error} */
354
- error(source: string, category: string, ...args: any): void;
355
- /** {@inheritDoc Logger.perf} */
356
- perf(source: string, category: string, event: string, phase: 'Begin' | 'End', ...args: any): void;
357
- }
358
- /**
359
- * Level of log
360
- *
361
- * @public
362
- */
363
- declare enum LogLevel {
364
- Debug = 0,
365
- Info = 1,
366
- Warn = 2,
367
- Error = 3
368
- }
369
- /**
370
- * Logger that support filtering by log level
371
- *
372
- * @public
373
- */
374
- declare class LevelLogger implements Logger {
375
- private logger;
376
- private level;
377
- /**
378
- * create new LevelLogger
379
- * @param logger - the original logger
380
- * @param level - log level that used for filtering, all logs lower than this level will be filtered out
381
- */
382
- constructor(logger: Logger, level: LogLevel);
383
- /** {@inheritDoc Logger.debug} */
384
- debug(source: string, category: string, ...args: any): void;
385
- /** {@inheritDoc Logger.info} */
386
- info(source: string, category: string, ...args: any): void;
387
- /** {@inheritDoc Logger.warn} */
388
- warn(source: string, category: string, ...args: any): void;
389
- /** {@inheritDoc Logger.error} */
390
- error(source: string, category: string, ...args: any): void;
391
- /** {@inheritDoc Logger.perf} */
392
- perf(source: string, category: string, event: string, phase: 'Begin' | 'End', ...args: any): void;
393
- }
394
- /**
395
- * Logger for performance tracking
396
- *
397
- * @public
398
- */
399
- declare class PerfLogger implements Logger {
400
- /**
401
- * create new PerfLogger
402
- */
403
- constructor();
404
- /** {@inheritDoc Logger.debug} */
405
- debug(source: string, category: string, ...args: any): void;
406
- /** {@inheritDoc Logger.info} */
407
- info(source: string, category: string, ...args: any): void;
408
- /** {@inheritDoc Logger.warn} */
409
- warn(source: string, category: string, ...args: any): void;
410
- /** {@inheritDoc Logger.error} */
411
- error(source: string, category: string, ...args: any): void;
412
- /** {@inheritDoc Logger.perf} */
413
- perf(source: string, category: string, event: string, phase: 'Begin' | 'End', identifier: string, ...args: any): void;
414
- }
415
- /**
416
- * Logger that will track and call child loggers
417
- *
418
- * @public
419
- */
420
- declare class AllLogger implements Logger {
421
- private loggers;
422
- /**
423
- * create new PerfLogger
424
- */
425
- constructor(loggers: Logger[]);
426
- /** {@inheritDoc Logger.debug} */
427
- debug(source: string, category: string, ...args: any): void;
428
- /** {@inheritDoc Logger.info} */
429
- info(source: string, category: string, ...args: any): void;
430
- /** {@inheritDoc Logger.warn} */
431
- warn(source: string, category: string, ...args: any): void;
432
- /** {@inheritDoc Logger.error} */
433
- error(source: string, category: string, ...args: any): void;
434
- /** {@inheritDoc Logger.perf} */
435
- perf(source: string, category: string, event: string, phase: 'Begin' | 'End', ...args: any): void;
436
- }
437
-
438
- interface WebAlphaColor {
439
- color: string;
440
- opacity: number;
441
- }
442
- /**
443
- * Convert a {@link PdfAlphaColor} to a CSS-style colour definition.
444
- *
445
- * @param c - the colour coming from PDFium (0-255 per channel)
446
- * @returns
447
- * hex – #RRGGBB (no alpha channel)
448
- * opacity – 0-1 float suitable for CSS `opacity`/`rgba()`
449
- */
450
- declare function pdfAlphaColorToWebAlphaColor(c: PdfAlphaColor): WebAlphaColor;
451
- /**
452
- * Convert a CSS hex colour + opacity back into {@link PdfAlphaColor}
453
- *
454
- * @param hex - #RGB, #RRGGBB, or #rrggbb
455
- * @param opacity - 0-1 float (values outside clamp automatically)
456
- */
457
- declare function webAlphaColorToPdfAlphaColor({ color, opacity }: WebAlphaColor): PdfAlphaColor;
458
-
459
- /**
460
- * Stage of task
461
- *
462
- * @public
463
- */
464
- declare enum TaskStage {
465
- /**
466
- * Task is pending, means it just start executing
467
- */
468
- Pending = 0,
469
- /**
470
- * Task is succeed
471
- */
472
- Resolved = 1,
473
- /**
474
- * Task is failed
475
- */
476
- Rejected = 2,
477
- /**
478
- * Task is aborted
479
- */
480
- Aborted = 3
481
- }
482
- interface TaskError<D> {
483
- /**
484
- * task error type
485
- */
486
- type: 'reject' | 'abort';
487
- /**
488
- * task error
489
- */
490
- reason: D;
491
- }
492
- /**
493
- * callback that will be called when task is resolved
494
- *
495
- * @public
496
- */
497
- type ResolvedCallback<R> = (r: R) => void;
498
- /**
499
- * callback that will be called when task is rejected
500
- *
501
- * @public
502
- */
503
- type RejectedCallback<D> = (e: TaskError<D>) => void;
504
- /**
505
- * Task state in different stage
506
- *
507
- * @public
508
- */
509
- type TaskState<R, D> = {
510
- stage: TaskStage.Pending;
511
- } | {
512
- stage: TaskStage.Resolved;
513
- result: R;
514
- } | {
515
- stage: TaskStage.Rejected;
516
- reason: D;
517
- } | {
518
- stage: TaskStage.Aborted;
519
- reason: D;
520
- };
521
- /**
522
- * Result type for allSettled
523
- *
524
- * @public
525
- */
526
- type TaskSettledResult<R, D> = {
527
- status: 'resolved';
528
- value: R;
529
- } | {
530
- status: 'rejected';
531
- reason: D;
532
- } | {
533
- status: 'aborted';
534
- reason: D;
535
- };
536
- declare class TaskAbortedError<D> extends Error {
537
- constructor(reason: D);
538
- }
539
- declare class TaskRejectedError<D> extends Error {
540
- constructor(reason: D);
541
- }
542
- /**
543
- * Base class of task
544
- *
545
- * @public
546
- */
547
- declare class Task<R, D> {
548
- state: TaskState<R, D>;
549
- /**
550
- * callbacks that will be executed when task is resolved
551
- */
552
- resolvedCallbacks: ResolvedCallback<R>[];
553
- /**
554
- * callbacks that will be executed when task is rejected
555
- */
556
- rejectedCallbacks: RejectedCallback<D>[];
557
- /**
558
- * Promise that will be resolved when task is settled
559
- */
560
- private _promise;
561
- /**
562
- * Convert task to promise
563
- * @returns promise that will be resolved when task is settled
564
- */
565
- toPromise(): Promise<R>;
566
- /**
567
- * wait for task to be settled
568
- * @param resolvedCallback - callback for resolved value
569
- * @param rejectedCallback - callback for rejected value
570
- */
571
- wait(resolvedCallback: ResolvedCallback<R>, rejectedCallback: RejectedCallback<D>): void;
572
- /**
573
- * resolve task with specific result
574
- * @param result - result value
575
- */
576
- resolve(result: R): void;
577
- /**
578
- * reject task with specific reason
579
- * @param reason - abort reason
580
- *
581
- */
582
- reject(reason: D): void;
583
- /**
584
- * abort task with specific reason
585
- * @param reason - abort reason
586
- */
587
- abort(reason: D): void;
588
- /**
589
- * fail task with a TaskError from another task
590
- * This is a convenience method for error propagation between tasks
591
- * @param error - TaskError from another task
592
- */
593
- fail(error: TaskError<D>): void;
594
- /**
595
- * Static method to wait for all tasks to resolve
596
- * Returns a new task that resolves with an array of all results
597
- * Rejects immediately if any task fails
598
- *
599
- * @param tasks - array of tasks to wait for
600
- * @returns new task that resolves when all input tasks resolve
601
- * @public
602
- */
603
- static all<R extends readonly Task<any, any>[]>(tasks: R): Task<{
604
- [K in keyof R]: R[K] extends Task<infer U, any> ? U : never;
605
- }, any>;
606
- /**
607
- * Static method to wait for all tasks to settle (resolve, reject, or abort)
608
- * Always resolves with an array of settlement results
609
- *
610
- * @param tasks - array of tasks to wait for
611
- * @returns new task that resolves when all input tasks settle
612
- * @public
613
- */
614
- static allSettled<R extends readonly Task<any, any>[]>(tasks: R): Task<{
615
- [K in keyof R]: R[K] extends Task<infer U, infer E> ? TaskSettledResult<U, E> : never;
616
- }, never>;
617
- /**
618
- * Static method that resolves/rejects with the first task that settles
619
- *
620
- * @param tasks - array of tasks to race
621
- * @returns new task that settles with the first input task that settles
622
- * @public
623
- */
624
- static race<R extends readonly Task<any, any>[]>(tasks: R): Task<R[number] extends Task<infer U, any> ? U : never, R[number] extends Task<any, infer E> ? E : never>;
625
- /**
626
- * Utility to track progress of multiple tasks
627
- *
628
- * @param tasks - array of tasks to track
629
- * @param onProgress - callback called when any task completes
630
- * @returns new task that resolves when all input tasks resolve
631
- * @public
632
- */
633
- static withProgress<R extends readonly Task<any, any>[]>(tasks: R, onProgress?: (completed: number, total: number) => void): Task<{
634
- [K in keyof R]: R[K] extends Task<infer U, any> ? U : never;
635
- }, any>;
636
- }
637
- /**
638
- * Type that represent the result of executing task
639
- */
640
- type TaskReturn<T extends Task<any, any>> = T extends Task<infer R, infer E> ? {
641
- type: 'result';
642
- value: R;
643
- } | {
644
- type: 'error';
645
- value: TaskError<E>;
646
- } : never;
647
-
1
+ import { WebAlphaColor } from './color';
2
+ import { Size, Rect, Position, Rotation } from './geometry';
3
+ import { Task, TaskError } from './task';
648
4
  /**
649
5
  * Representation of pdf page
650
6
  *
651
7
  * @public
652
8
  */
653
- interface PdfPageObject {
9
+ export interface PdfPageObject {
654
10
  /**
655
11
  * Index of this page, starts from 0
656
12
  */
@@ -665,7 +21,7 @@ interface PdfPageObject {
665
21
  *
666
22
  * @public
667
23
  */
668
- interface PdfPageObjectWithRotatedSize extends PdfPageObject {
24
+ export interface PdfPageObjectWithRotatedSize extends PdfPageObject {
669
25
  /**
670
26
  * Rotated size of this page
671
27
  */
@@ -676,7 +32,7 @@ interface PdfPageObjectWithRotatedSize extends PdfPageObject {
676
32
  *
677
33
  * @public
678
34
  */
679
- interface PdfDocumentObject {
35
+ export interface PdfDocumentObject {
680
36
  /**
681
37
  * Identity of document
682
38
  */
@@ -695,7 +51,7 @@ interface PdfDocumentObject {
695
51
  *
696
52
  * @public
697
53
  */
698
- interface PdfMetadataObject {
54
+ export interface PdfMetadataObject {
699
55
  /**
700
56
  * title of the document
701
57
  */
@@ -735,49 +91,49 @@ interface PdfMetadataObject {
735
91
  *
736
92
  * @public
737
93
  */
738
- declare const PdfSoftHyphenMarker = "\u00AD";
94
+ export declare const PdfSoftHyphenMarker = "\u00AD";
739
95
  /**
740
96
  * Unicode **zero-width space** (`U+200B`).
741
97
  *
742
98
  * @public
743
99
  */
744
- declare const PdfZeroWidthSpace = "\u200B";
100
+ export declare const PdfZeroWidthSpace = "\u200B";
745
101
  /**
746
102
  * Unicode **word-joiner** (`U+2060`) – zero-width no-break.
747
103
  *
748
104
  * @public
749
105
  */
750
- declare const PdfWordJoiner = "\u2060";
106
+ export declare const PdfWordJoiner = "\u2060";
751
107
  /**
752
108
  * Unicode **byte-order mark / zero-width&nbsp;no-break space** (`U+FEFF`).
753
109
  *
754
110
  * @public
755
111
  */
756
- declare const PdfBomOrZwnbsp = "\uFEFF";
112
+ export declare const PdfBomOrZwnbsp = "\uFEFF";
757
113
  /**
758
114
  * Unicode non-character `U+FFFE`.
759
115
  *
760
116
  * @public
761
117
  */
762
- declare const PdfNonCharacterFFFE = "\uFFFE";
118
+ export declare const PdfNonCharacterFFFE = "\uFFFE";
763
119
  /**
764
120
  * Unicode non-character `U+FFFF`.
765
121
  *
766
122
  * @public
767
123
  */
768
- declare const PdfNonCharacterFFFF = "\uFFFF";
124
+ export declare const PdfNonCharacterFFFF = "\uFFFF";
769
125
  /**
770
126
  * **Frozen list** of all unwanted markers in canonical order.
771
127
  *
772
128
  * @public
773
129
  */
774
- declare const PdfUnwantedTextMarkers: readonly ["­", "​", "⁠", "", "￾", "￿"];
130
+ export declare const PdfUnwantedTextMarkers: readonly ["­", "​", "⁠", "", "￾", "￿"];
775
131
  /**
776
132
  * Compiled regular expression that matches any unwanted marker.
777
133
  *
778
134
  * @public
779
135
  */
780
- declare const PdfUnwantedTextRegex: RegExp;
136
+ export declare const PdfUnwantedTextRegex: RegExp;
781
137
  /**
782
138
  * Remove all {@link PdfUnwantedTextMarkers | unwanted markers} from *text*.
783
139
  *
@@ -786,13 +142,13 @@ declare const PdfUnwantedTextRegex: RegExp;
786
142
  *
787
143
  * @public
788
144
  */
789
- declare function stripPdfUnwantedMarkers(text: string): string;
145
+ export declare function stripPdfUnwantedMarkers(text: string): string;
790
146
  /**
791
147
  * zoom mode
792
148
  *
793
149
  * @public
794
150
  */
795
- declare enum PdfZoomMode {
151
+ export declare enum PdfZoomMode {
796
152
  Unknown = 0,
797
153
  /**
798
154
  * Zoom level with specified offset.
@@ -815,12 +171,86 @@ declare enum PdfZoomMode {
815
171
  */
816
172
  FitRectangle = 5
817
173
  }
174
+ /**
175
+ * Blend mode
176
+ *
177
+ * @public
178
+ */
179
+ export declare enum PdfBlendMode {
180
+ Normal = 0,
181
+ Multiply = 1,
182
+ Screen = 2,
183
+ Overlay = 3,
184
+ Darken = 4,
185
+ Lighten = 5,
186
+ ColorDodge = 6,
187
+ ColorBurn = 7,
188
+ HardLight = 8,
189
+ SoftLight = 9,
190
+ Difference = 10,
191
+ Exclusion = 11,
192
+ Hue = 12,
193
+ Saturation = 13,
194
+ Color = 14,
195
+ Luminosity = 15
196
+ }
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;
818
248
  /**
819
249
  * Representation of the linked destination
820
250
  *
821
251
  * @public
822
252
  */
823
- interface PdfDestinationObject {
253
+ export interface PdfDestinationObject {
824
254
  /**
825
255
  * Index of target page
826
256
  */
@@ -853,7 +283,7 @@ interface PdfDestinationObject {
853
283
  *
854
284
  * @public
855
285
  */
856
- declare enum PdfActionType {
286
+ export declare enum PdfActionType {
857
287
  Unsupported = 0,
858
288
  /**
859
289
  * Goto specified position in this document
@@ -872,7 +302,7 @@ declare enum PdfActionType {
872
302
  */
873
303
  LaunchAppOrOpenFile = 4
874
304
  }
875
- type PdfImage = {
305
+ export type PdfImage = {
876
306
  data: Uint8ClampedArray;
877
307
  width: number;
878
308
  height: number;
@@ -882,7 +312,7 @@ type PdfImage = {
882
312
  *
883
313
  * @public
884
314
  */
885
- type PdfActionObject = {
315
+ export type PdfActionObject = {
886
316
  type: PdfActionType.Unsupported;
887
317
  } | {
888
318
  type: PdfActionType.Goto;
@@ -902,7 +332,7 @@ type PdfActionObject = {
902
332
  *
903
333
  * @public
904
334
  */
905
- type PdfLinkTarget = {
335
+ export type PdfLinkTarget = {
906
336
  type: 'action';
907
337
  action: PdfActionObject;
908
338
  } | {
@@ -914,7 +344,7 @@ type PdfLinkTarget = {
914
344
  *
915
345
  * @public
916
346
  */
917
- interface PdfBookmarkObject {
347
+ export interface PdfBookmarkObject {
918
348
  /**
919
349
  * title of bookmark
920
350
  */
@@ -933,7 +363,7 @@ interface PdfBookmarkObject {
933
363
  *
934
364
  * @public
935
365
  */
936
- interface PdfSignatureObject {
366
+ export interface PdfSignatureObject {
937
367
  /**
938
368
  * contents of signature
939
369
  */
@@ -964,7 +394,7 @@ interface PdfSignatureObject {
964
394
  *
965
395
  * @public
966
396
  */
967
- interface PdfBookmarksObject {
397
+ export interface PdfBookmarksObject {
968
398
  bookmarks: PdfBookmarkObject[];
969
399
  }
970
400
  /**
@@ -972,7 +402,7 @@ interface PdfBookmarksObject {
972
402
  *
973
403
  * @public
974
404
  */
975
- interface PdfTextRectObject {
405
+ export interface PdfTextRectObject {
976
406
  /**
977
407
  * Font of the text
978
408
  */
@@ -1000,7 +430,7 @@ interface PdfTextRectObject {
1000
430
  *
1001
431
  * @public
1002
432
  */
1003
- interface PdfAlphaColor {
433
+ export interface PdfAlphaColor {
1004
434
  /**
1005
435
  * red
1006
436
  */
@@ -1023,7 +453,7 @@ interface PdfAlphaColor {
1023
453
  *
1024
454
  * @public
1025
455
  */
1026
- declare enum PdfAnnotationSubtype {
456
+ export declare enum PdfAnnotationSubtype {
1027
457
  UNKNOWN = 0,
1028
458
  TEXT = 1,
1029
459
  LINK = 2,
@@ -1059,13 +489,13 @@ declare enum PdfAnnotationSubtype {
1059
489
  *
1060
490
  * @public
1061
491
  */
1062
- declare const PdfAnnotationSubtypeName: Record<PdfAnnotationSubtype, string>;
492
+ export declare const PdfAnnotationSubtypeName: Record<PdfAnnotationSubtype, string>;
1063
493
  /**
1064
494
  * Status of pdf annotation
1065
495
  *
1066
496
  * @public
1067
497
  */
1068
- declare enum PdfAnnotationObjectStatus {
498
+ export declare enum PdfAnnotationObjectStatus {
1069
499
  /**
1070
500
  * Annotation is created
1071
501
  */
@@ -1080,7 +510,7 @@ declare enum PdfAnnotationObjectStatus {
1080
510
  *
1081
511
  * @public
1082
512
  */
1083
- declare enum AppearanceMode {
513
+ export declare enum AppearanceMode {
1084
514
  Normal = 0,
1085
515
  Rollover = 1,
1086
516
  Down = 2
@@ -1090,7 +520,7 @@ declare enum AppearanceMode {
1090
520
  *
1091
521
  * @public
1092
522
  */
1093
- declare enum PdfAnnotationState {
523
+ export declare enum PdfAnnotationState {
1094
524
  /**
1095
525
  * Annotation is active
1096
526
  */
@@ -1125,7 +555,7 @@ declare enum PdfAnnotationState {
1125
555
  *
1126
556
  * @public
1127
557
  */
1128
- declare enum PdfAnnotationStateModel {
558
+ export declare enum PdfAnnotationStateModel {
1129
559
  /**
1130
560
  * Annotation is marked
1131
561
  */
@@ -1140,7 +570,7 @@ declare enum PdfAnnotationStateModel {
1140
570
  *
1141
571
  * @public
1142
572
  */
1143
- interface PdfAnnotationObjectBase {
573
+ export interface PdfAnnotationObjectBase {
1144
574
  /**
1145
575
  * Author of the annotation
1146
576
  */
@@ -1149,6 +579,14 @@ interface PdfAnnotationObjectBase {
1149
579
  * Modified date of the annotation
1150
580
  */
1151
581
  modified?: Date;
582
+ /**
583
+ * blend mode of annotation
584
+ */
585
+ blendMode?: PdfBlendMode;
586
+ /**
587
+ * intent of annotation
588
+ */
589
+ intent?: string;
1152
590
  /**
1153
591
  * Sub type of annotation
1154
592
  */
@@ -1171,7 +609,7 @@ interface PdfAnnotationObjectBase {
1171
609
  *
1172
610
  * @public
1173
611
  */
1174
- interface PdfPopupAnnoObject extends PdfAnnotationObjectBase {
612
+ export interface PdfPopupAnnoObject extends PdfAnnotationObjectBase {
1175
613
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1176
614
  type: PdfAnnotationSubtype.POPUP;
1177
615
  /**
@@ -1192,7 +630,7 @@ interface PdfPopupAnnoObject extends PdfAnnotationObjectBase {
1192
630
  *
1193
631
  * @public
1194
632
  */
1195
- interface PdfLinkAnnoObject extends PdfAnnotationObjectBase {
633
+ export interface PdfLinkAnnoObject extends PdfAnnotationObjectBase {
1196
634
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1197
635
  type: PdfAnnotationSubtype.LINK;
1198
636
  /**
@@ -1209,7 +647,7 @@ interface PdfLinkAnnoObject extends PdfAnnotationObjectBase {
1209
647
  *
1210
648
  * @public
1211
649
  */
1212
- interface PdfTextAnnoObject extends PdfAnnotationObjectBase {
650
+ export interface PdfTextAnnoObject extends PdfAnnotationObjectBase {
1213
651
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1214
652
  type: PdfAnnotationSubtype.TEXT;
1215
653
  /**
@@ -1242,7 +680,7 @@ interface PdfTextAnnoObject extends PdfAnnotationObjectBase {
1242
680
  *
1243
681
  * @public
1244
682
  */
1245
- declare enum PDF_FORM_FIELD_TYPE {
683
+ export declare enum PDF_FORM_FIELD_TYPE {
1246
684
  /**
1247
685
  * Unknow
1248
686
  */
@@ -1308,7 +746,7 @@ declare enum PDF_FORM_FIELD_TYPE {
1308
746
  */
1309
747
  XFA_TEXTFIELD = 15
1310
748
  }
1311
- declare enum PdfAnnotationColorType {
749
+ export declare enum PdfAnnotationColorType {
1312
750
  Color = 0,
1313
751
  InteriorColor = 1
1314
752
  }
@@ -1317,7 +755,7 @@ declare enum PdfAnnotationColorType {
1317
755
  *
1318
756
  * @public
1319
757
  */
1320
- declare enum PdfAnnotationBorderStyle {
758
+ export declare enum PdfAnnotationBorderStyle {
1321
759
  UNKNOWN = 0,
1322
760
  SOLID = 1,
1323
761
  DASHED = 2,
@@ -1331,7 +769,7 @@ declare enum PdfAnnotationBorderStyle {
1331
769
  *
1332
770
  * @public
1333
771
  */
1334
- declare enum PdfAnnotationFlags {
772
+ export declare enum PdfAnnotationFlags {
1335
773
  NONE = 0,
1336
774
  INVISIBLE = 1,
1337
775
  HIDDEN = 2,
@@ -1348,7 +786,7 @@ declare enum PdfAnnotationFlags {
1348
786
  *
1349
787
  * @public
1350
788
  */
1351
- declare enum PDF_FORM_FIELD_FLAG {
789
+ export declare enum PDF_FORM_FIELD_FLAG {
1352
790
  NONE = 0,
1353
791
  READONLY = 1,
1354
792
  REQUIRED = 2,
@@ -1364,7 +802,7 @@ declare enum PDF_FORM_FIELD_FLAG {
1364
802
  *
1365
803
  * @public
1366
804
  */
1367
- declare enum PdfPageObjectType {
805
+ export declare enum PdfPageObjectType {
1368
806
  UNKNOWN = 0,
1369
807
  TEXT = 1,
1370
808
  PATH = 2,
@@ -1377,29 +815,29 @@ declare enum PdfPageObjectType {
1377
815
  *
1378
816
  * @public
1379
817
  */
1380
- interface PdfWidgetAnnoOption {
818
+ export interface PdfWidgetAnnoOption {
1381
819
  label: string;
1382
820
  isSelected: boolean;
1383
821
  }
822
+ export type PdfAnnotationFlagName = 'invisible' | 'hidden' | 'print' | 'noZoom' | 'noRotate' | 'noView' | 'readOnly' | 'locked' | 'toggleNoView';
1384
823
  type FlagMap = Partial<Record<Exclude<PdfAnnotationFlags, PdfAnnotationFlags.NONE>, PdfAnnotationFlagName>>;
1385
- type PdfAnnotationFlagName = 'invisible' | 'hidden' | 'print' | 'noZoom' | 'noRotate' | 'noView' | 'readOnly' | 'locked' | 'toggleNoView';
1386
- declare const PdfAnnotationFlagName: Readonly<FlagMap>;
824
+ export declare const PdfAnnotationFlagName: Readonly<FlagMap>;
1387
825
  /**
1388
826
  * Convert the raw bit-mask coming from `FPDFAnnot_GetFlags()` into
1389
827
  * an array of human-readable flag names (“invisible”, “print”…).
1390
828
  */
1391
- declare function flagsToNames(raw: number): PdfAnnotationFlagName[];
829
+ export declare function flagsToNames(raw: number): PdfAnnotationFlagName[];
1392
830
  /**
1393
831
  * Convert an array of flag-names back into the numeric mask that
1394
832
  * PDFium expects for `FPDFAnnot_SetFlags()`.
1395
833
  */
1396
- declare function namesToFlags(names: readonly PdfAnnotationFlagName[]): PdfAnnotationFlags;
834
+ export declare function namesToFlags(names: readonly PdfAnnotationFlagName[]): PdfAnnotationFlags;
1397
835
  /**
1398
836
  * Field of PDF widget annotation
1399
837
  *
1400
838
  * @public
1401
839
  */
1402
- interface PdfWidgetAnnoField {
840
+ export interface PdfWidgetAnnoField {
1403
841
  /**
1404
842
  * flag of field
1405
843
  */
@@ -1434,7 +872,7 @@ interface PdfWidgetAnnoField {
1434
872
  *
1435
873
  * @public
1436
874
  */
1437
- interface PdfWidgetAnnoObject extends PdfAnnotationObjectBase {
875
+ export interface PdfWidgetAnnoObject extends PdfAnnotationObjectBase {
1438
876
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1439
877
  type: PdfAnnotationSubtype.WIDGET;
1440
878
  /**
@@ -1447,7 +885,7 @@ interface PdfWidgetAnnoObject extends PdfAnnotationObjectBase {
1447
885
  *
1448
886
  * @public
1449
887
  */
1450
- interface PdfFileAttachmentAnnoObject extends PdfAnnotationObjectBase {
888
+ export interface PdfFileAttachmentAnnoObject extends PdfAnnotationObjectBase {
1451
889
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1452
890
  type: PdfAnnotationSubtype.FILEATTACHMENT;
1453
891
  }
@@ -1456,7 +894,7 @@ interface PdfFileAttachmentAnnoObject extends PdfAnnotationObjectBase {
1456
894
  *
1457
895
  * @public
1458
896
  */
1459
- interface PdfInkListObject {
897
+ export interface PdfInkListObject {
1460
898
  points: Position[];
1461
899
  }
1462
900
  /**
@@ -1464,7 +902,7 @@ interface PdfInkListObject {
1464
902
  *
1465
903
  * @public
1466
904
  */
1467
- interface PdfInkAnnoObject extends PdfAnnotationObjectBase {
905
+ export interface PdfInkAnnoObject extends PdfAnnotationObjectBase {
1468
906
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1469
907
  type: PdfAnnotationSubtype.INK;
1470
908
  /**
@@ -1489,7 +927,7 @@ interface PdfInkAnnoObject extends PdfAnnotationObjectBase {
1489
927
  *
1490
928
  * @public
1491
929
  */
1492
- interface PdfPolygonAnnoObject extends PdfAnnotationObjectBase {
930
+ export interface PdfPolygonAnnoObject extends PdfAnnotationObjectBase {
1493
931
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1494
932
  type: PdfAnnotationSubtype.POLYGON;
1495
933
  /**
@@ -1502,7 +940,7 @@ interface PdfPolygonAnnoObject extends PdfAnnotationObjectBase {
1502
940
  *
1503
941
  * @public
1504
942
  */
1505
- interface PdfPolylineAnnoObject extends PdfAnnotationObjectBase {
943
+ export interface PdfPolylineAnnoObject extends PdfAnnotationObjectBase {
1506
944
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1507
945
  type: PdfAnnotationSubtype.POLYLINE;
1508
946
  /**
@@ -1515,7 +953,7 @@ interface PdfPolylineAnnoObject extends PdfAnnotationObjectBase {
1515
953
  *
1516
954
  * @public
1517
955
  */
1518
- interface PdfLineAnnoObject extends PdfAnnotationObjectBase {
956
+ export interface PdfLineAnnoObject extends PdfAnnotationObjectBase {
1519
957
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1520
958
  type: PdfAnnotationSubtype.LINE;
1521
959
  /**
@@ -1532,7 +970,7 @@ interface PdfLineAnnoObject extends PdfAnnotationObjectBase {
1532
970
  *
1533
971
  * @public
1534
972
  */
1535
- interface PdfHighlightAnnoObject extends PdfAnnotationObjectBase {
973
+ export interface PdfHighlightAnnoObject extends PdfAnnotationObjectBase {
1536
974
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1537
975
  type: PdfAnnotationSubtype.HIGHLIGHT;
1538
976
  /**
@@ -1562,7 +1000,7 @@ interface PdfHighlightAnnoObject extends PdfAnnotationObjectBase {
1562
1000
  * Scaling is performed with [sx 0 0 sy 0 0].
1563
1001
  * See PDF Reference 1.7, 4.2.2 Common Transformations for more.
1564
1002
  */
1565
- interface PdfTransformMatrix {
1003
+ export interface PdfTransformMatrix {
1566
1004
  a: number;
1567
1005
  b: number;
1568
1006
  c: number;
@@ -1575,7 +1013,7 @@ interface PdfTransformMatrix {
1575
1013
  *
1576
1014
  * @public
1577
1015
  */
1578
- declare enum PdfSegmentObjectType {
1016
+ export declare enum PdfSegmentObjectType {
1579
1017
  UNKNOWN = -1,
1580
1018
  LINETO = 0,
1581
1019
  BEZIERTO = 1,
@@ -1586,7 +1024,7 @@ declare enum PdfSegmentObjectType {
1586
1024
  *
1587
1025
  * @public
1588
1026
  */
1589
- interface PdfSegmentObject {
1027
+ export interface PdfSegmentObject {
1590
1028
  type: PdfSegmentObjectType;
1591
1029
  /**
1592
1030
  * point of the segment
@@ -1602,7 +1040,7 @@ interface PdfSegmentObject {
1602
1040
  *
1603
1041
  * @public
1604
1042
  */
1605
- interface PdfPathObject {
1043
+ export interface PdfPathObject {
1606
1044
  type: PdfPageObjectType.PATH;
1607
1045
  /**
1608
1046
  * bound that contains the path
@@ -1627,7 +1065,7 @@ interface PdfPathObject {
1627
1065
  *
1628
1066
  * @public
1629
1067
  */
1630
- interface PdfImageObject {
1068
+ export interface PdfImageObject {
1631
1069
  type: PdfPageObjectType.IMAGE;
1632
1070
  /**
1633
1071
  * data of the image
@@ -1643,7 +1081,7 @@ interface PdfImageObject {
1643
1081
  *
1644
1082
  * @public
1645
1083
  */
1646
- interface PdfFormObject {
1084
+ export interface PdfFormObject {
1647
1085
  type: PdfPageObjectType.FORM;
1648
1086
  /**
1649
1087
  * objects that in this form object
@@ -1659,13 +1097,13 @@ interface PdfFormObject {
1659
1097
  *
1660
1098
  * @public
1661
1099
  */
1662
- type PdfStampAnnoObjectContents = Array<PdfPathObject | PdfImageObject | PdfFormObject>;
1100
+ export type PdfStampAnnoObjectContents = Array<PdfPathObject | PdfImageObject | PdfFormObject>;
1663
1101
  /**
1664
1102
  * Pdf stamp annotation
1665
1103
  *
1666
1104
  * @public
1667
1105
  */
1668
- interface PdfStampAnnoObject extends PdfAnnotationObjectBase {
1106
+ export interface PdfStampAnnoObject extends PdfAnnotationObjectBase {
1669
1107
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1670
1108
  type: PdfAnnotationSubtype.STAMP;
1671
1109
  /**
@@ -1678,7 +1116,7 @@ interface PdfStampAnnoObject extends PdfAnnotationObjectBase {
1678
1116
  *
1679
1117
  * @public
1680
1118
  */
1681
- interface PdfCircleAnnoObject extends PdfAnnotationObjectBase {
1119
+ export interface PdfCircleAnnoObject extends PdfAnnotationObjectBase {
1682
1120
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1683
1121
  type: PdfAnnotationSubtype.CIRCLE;
1684
1122
  /**
@@ -1723,7 +1161,7 @@ interface PdfCircleAnnoObject extends PdfAnnotationObjectBase {
1723
1161
  *
1724
1162
  * @public
1725
1163
  */
1726
- interface PdfSquareAnnoObject extends PdfAnnotationObjectBase {
1164
+ export interface PdfSquareAnnoObject extends PdfAnnotationObjectBase {
1727
1165
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1728
1166
  type: PdfAnnotationSubtype.SQUARE;
1729
1167
  /**
@@ -1768,7 +1206,7 @@ interface PdfSquareAnnoObject extends PdfAnnotationObjectBase {
1768
1206
  *
1769
1207
  * @public
1770
1208
  */
1771
- interface PdfSquigglyAnnoObject extends PdfAnnotationObjectBase {
1209
+ export interface PdfSquigglyAnnoObject extends PdfAnnotationObjectBase {
1772
1210
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1773
1211
  type: PdfAnnotationSubtype.SQUIGGLY;
1774
1212
  /**
@@ -1793,7 +1231,7 @@ interface PdfSquigglyAnnoObject extends PdfAnnotationObjectBase {
1793
1231
  *
1794
1232
  * @public
1795
1233
  */
1796
- interface PdfUnderlineAnnoObject extends PdfAnnotationObjectBase {
1234
+ export interface PdfUnderlineAnnoObject extends PdfAnnotationObjectBase {
1797
1235
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1798
1236
  type: PdfAnnotationSubtype.UNDERLINE;
1799
1237
  /**
@@ -1818,7 +1256,7 @@ interface PdfUnderlineAnnoObject extends PdfAnnotationObjectBase {
1818
1256
  *
1819
1257
  * @public
1820
1258
  */
1821
- interface PdfStrikeOutAnnoObject extends PdfAnnotationObjectBase {
1259
+ export interface PdfStrikeOutAnnoObject extends PdfAnnotationObjectBase {
1822
1260
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1823
1261
  type: PdfAnnotationSubtype.STRIKEOUT;
1824
1262
  /**
@@ -1843,7 +1281,7 @@ interface PdfStrikeOutAnnoObject extends PdfAnnotationObjectBase {
1843
1281
  *
1844
1282
  * @public
1845
1283
  */
1846
- interface PdfCaretAnnoObject extends PdfAnnotationObjectBase {
1284
+ export interface PdfCaretAnnoObject extends PdfAnnotationObjectBase {
1847
1285
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1848
1286
  type: PdfAnnotationSubtype.CARET;
1849
1287
  }
@@ -1852,23 +1290,24 @@ interface PdfCaretAnnoObject extends PdfAnnotationObjectBase {
1852
1290
  *
1853
1291
  * @public
1854
1292
  */
1855
- interface PdfFreeTextAnnoObject extends PdfAnnotationObjectBase {
1293
+ export interface PdfFreeTextAnnoObject extends PdfAnnotationObjectBase {
1856
1294
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1857
1295
  type: PdfAnnotationSubtype.FREETEXT;
1858
1296
  contents: string;
1297
+ richContent?: string;
1859
1298
  }
1860
1299
  /**
1861
1300
  * All annotation that support
1862
1301
  *
1863
1302
  * @public
1864
1303
  */
1865
- type PdfSupportedAnnoObject = PdfInkAnnoObject | PdfTextAnnoObject | PdfLinkAnnoObject | PdfPolygonAnnoObject | PdfPolylineAnnoObject | PdfHighlightAnnoObject | PdfLineAnnoObject | PdfWidgetAnnoObject | PdfFileAttachmentAnnoObject | PdfStampAnnoObject | PdfSquareAnnoObject | PdfCircleAnnoObject | PdfSquigglyAnnoObject | PdfUnderlineAnnoObject | PdfStrikeOutAnnoObject | PdfCaretAnnoObject | PdfFreeTextAnnoObject;
1304
+ export type PdfSupportedAnnoObject = PdfInkAnnoObject | PdfTextAnnoObject | PdfLinkAnnoObject | PdfPolygonAnnoObject | PdfPolylineAnnoObject | PdfHighlightAnnoObject | PdfLineAnnoObject | PdfWidgetAnnoObject | PdfFileAttachmentAnnoObject | PdfStampAnnoObject | PdfSquareAnnoObject | PdfCircleAnnoObject | PdfSquigglyAnnoObject | PdfUnderlineAnnoObject | PdfStrikeOutAnnoObject | PdfCaretAnnoObject | PdfFreeTextAnnoObject;
1866
1305
  /**
1867
1306
  * Pdf annotation that does not support
1868
1307
  *
1869
1308
  * @public
1870
1309
  */
1871
- interface PdfUnsupportedAnnoObject extends PdfAnnotationObjectBase {
1310
+ export interface PdfUnsupportedAnnoObject extends PdfAnnotationObjectBase {
1872
1311
  type: Exclude<PdfAnnotationSubtype, PdfSupportedAnnoObject['type']>;
1873
1312
  }
1874
1313
  /**
@@ -1876,13 +1315,13 @@ interface PdfUnsupportedAnnoObject extends PdfAnnotationObjectBase {
1876
1315
  *
1877
1316
  * @public
1878
1317
  */
1879
- type PdfAnnotationObject = PdfSupportedAnnoObject | PdfUnsupportedAnnoObject;
1318
+ export type PdfAnnotationObject = PdfSupportedAnnoObject | PdfUnsupportedAnnoObject;
1880
1319
  /**
1881
1320
  * Pdf attachment
1882
1321
  *
1883
1322
  * @public
1884
1323
  */
1885
- interface PdfAttachmentObject {
1324
+ export interface PdfAttachmentObject {
1886
1325
  index: number;
1887
1326
  name: string;
1888
1327
  creationDate: string;
@@ -1893,7 +1332,7 @@ interface PdfAttachmentObject {
1893
1332
  *
1894
1333
  * @public
1895
1334
  */
1896
- declare enum PdfEngineFeature {
1335
+ export declare enum PdfEngineFeature {
1897
1336
  RenderPage = 0,
1898
1337
  RenderPageRect = 1,
1899
1338
  Thumbnails = 2,
@@ -1905,7 +1344,7 @@ declare enum PdfEngineFeature {
1905
1344
  *
1906
1345
  * @public
1907
1346
  */
1908
- declare enum PdfEngineOperation {
1347
+ export declare enum PdfEngineOperation {
1909
1348
  Create = 0,
1910
1349
  Read = 1,
1911
1350
  Update = 2,
@@ -1916,7 +1355,7 @@ declare enum PdfEngineOperation {
1916
1355
  *
1917
1356
  * @public
1918
1357
  */
1919
- declare enum MatchFlag {
1358
+ export declare enum MatchFlag {
1920
1359
  None = 0,
1921
1360
  MatchCase = 1,
1922
1361
  MatchWholeWord = 2,
@@ -1929,19 +1368,19 @@ declare enum MatchFlag {
1929
1368
  *
1930
1369
  * @public
1931
1370
  */
1932
- declare function unionFlags(flags: MatchFlag[]): MatchFlag;
1371
+ export declare function unionFlags(flags: MatchFlag[]): MatchFlag;
1933
1372
  /**
1934
1373
  * Image conversion types
1935
1374
  *
1936
1375
  * @public
1937
1376
  */
1938
- type ImageConversionTypes = 'image/webp' | 'image/png' | 'image/jpeg';
1377
+ export type ImageConversionTypes = 'image/webp' | 'image/png' | 'image/jpeg';
1939
1378
  /**
1940
1379
  * Targe for searching
1941
1380
  *
1942
1381
  * @public
1943
1382
  */
1944
- interface SearchTarget {
1383
+ export interface SearchTarget {
1945
1384
  keyword: string;
1946
1385
  flags: MatchFlag[];
1947
1386
  }
@@ -1953,9 +1392,9 @@ interface SearchTarget {
1953
1392
  *
1954
1393
  * @public
1955
1394
  */
1956
- declare function compareSearchTarget(targetA: SearchTarget, targetB: SearchTarget): boolean;
1395
+ export declare function compareSearchTarget(targetA: SearchTarget, targetB: SearchTarget): boolean;
1957
1396
  /** Context of one hit */
1958
- interface TextContext {
1397
+ export interface TextContext {
1959
1398
  /** Complete words that come *before* the hit (no ellipsis) */
1960
1399
  before: string;
1961
1400
  /** Exactly the text that matched (case-preserved) */
@@ -1972,7 +1411,7 @@ interface TextContext {
1972
1411
  *
1973
1412
  * @public
1974
1413
  */
1975
- interface PageTextSlice {
1414
+ export interface PageTextSlice {
1976
1415
  /**
1977
1416
  * Index of the pdf page
1978
1417
  */
@@ -1991,7 +1430,7 @@ interface PageTextSlice {
1991
1430
  *
1992
1431
  * @public
1993
1432
  */
1994
- interface SearchResult {
1433
+ export interface SearchResult {
1995
1434
  /**
1996
1435
  * Index of the pdf page
1997
1436
  */
@@ -2016,7 +1455,7 @@ interface SearchResult {
2016
1455
  /**
2017
1456
  * Results of searching through the entire document
2018
1457
  */
2019
- interface SearchAllPagesResult {
1458
+ export interface SearchAllPagesResult {
2020
1459
  /**
2021
1460
  * Array of all search results across all pages
2022
1461
  */
@@ -2031,7 +1470,7 @@ interface SearchAllPagesResult {
2031
1470
  *
2032
1471
  * @public
2033
1472
  */
2034
- interface PdfGlyphObject {
1473
+ export interface PdfGlyphObject {
2035
1474
  /**
2036
1475
  * Origin of the glyph
2037
1476
  */
@@ -2060,7 +1499,7 @@ interface PdfGlyphObject {
2060
1499
  *
2061
1500
  * @public
2062
1501
  */
2063
- interface PdfGlyphSlim {
1502
+ export interface PdfGlyphSlim {
2064
1503
  /**
2065
1504
  * X coordinate of the glyph
2066
1505
  */
@@ -2087,7 +1526,7 @@ interface PdfGlyphSlim {
2087
1526
  *
2088
1527
  * @public
2089
1528
  */
2090
- interface PdfRun {
1529
+ export interface PdfRun {
2091
1530
  /**
2092
1531
  * Rectangle of the run
2093
1532
  */
@@ -2111,7 +1550,7 @@ interface PdfRun {
2111
1550
  *
2112
1551
  * @public
2113
1552
  */
2114
- interface PdfPageGeometry {
1553
+ export interface PdfPageGeometry {
2115
1554
  /**
2116
1555
  * Runs of the page
2117
1556
  */
@@ -2121,7 +1560,7 @@ interface PdfPageGeometry {
2121
1560
  * form field value
2122
1561
  * @public
2123
1562
  */
2124
- type FormFieldValue = {
1563
+ export type FormFieldValue = {
2125
1564
  kind: 'text';
2126
1565
  text: string;
2127
1566
  } | {
@@ -2137,7 +1576,7 @@ type FormFieldValue = {
2137
1576
  *
2138
1577
  * @public
2139
1578
  */
2140
- interface PdfAnnotationTransformation {
1579
+ export interface PdfAnnotationTransformation {
2141
1580
  /**
2142
1581
  * Translated offset
2143
1582
  */
@@ -2152,7 +1591,7 @@ interface PdfAnnotationTransformation {
2152
1591
  *
2153
1592
  * @public
2154
1593
  */
2155
- interface PdfRenderOptions {
1594
+ export interface PdfRenderOptions {
2156
1595
  /**
2157
1596
  * Whether needs to render the page with annotations
2158
1597
  */
@@ -2163,8 +1602,8 @@ interface PdfRenderOptions {
2163
1602
  *
2164
1603
  * @public
2165
1604
  */
2166
- type PdfFileContent = ArrayBuffer;
2167
- declare enum PdfPermission {
1605
+ export type PdfFileContent = ArrayBuffer;
1606
+ export declare enum PdfPermission {
2168
1607
  PrintDocument = 8,
2169
1608
  ModifyContent = 16,
2170
1609
  CopyOrExtract = 32,
@@ -2174,11 +1613,11 @@ declare enum PdfPermission {
2174
1613
  AssembleDocument = 2048,
2175
1614
  PrintHighQuality = 4096
2176
1615
  }
2177
- declare enum PdfPageFlattenFlag {
1616
+ export declare enum PdfPageFlattenFlag {
2178
1617
  Display = 0,
2179
1618
  Print = 1
2180
1619
  }
2181
- declare enum PdfPageFlattenResult {
1620
+ export declare enum PdfPageFlattenResult {
2182
1621
  Fail = 0,
2183
1622
  Success = 1,
2184
1623
  NothingToDo = 2
@@ -2188,13 +1627,13 @@ declare enum PdfPageFlattenResult {
2188
1627
  *
2189
1628
  * @public
2190
1629
  */
2191
- interface PdfFileWithoutContent {
1630
+ export interface PdfFileWithoutContent {
2192
1631
  /**
2193
1632
  * id of file
2194
1633
  */
2195
1634
  id: string;
2196
1635
  }
2197
- interface PdfFileLoader extends PdfFileWithoutContent {
1636
+ export interface PdfFileLoader extends PdfFileWithoutContent {
2198
1637
  /**
2199
1638
  * length of file
2200
1639
  */
@@ -2212,20 +1651,20 @@ interface PdfFileLoader extends PdfFileWithoutContent {
2212
1651
  *
2213
1652
  * @public
2214
1653
  */
2215
- interface PdfFile extends PdfFileWithoutContent {
1654
+ export interface PdfFile extends PdfFileWithoutContent {
2216
1655
  /**
2217
1656
  * content of file
2218
1657
  */
2219
1658
  content: PdfFileContent;
2220
1659
  }
2221
- interface PdfFileUrl extends PdfFileWithoutContent {
1660
+ export interface PdfFileUrl extends PdfFileWithoutContent {
2222
1661
  url: string;
2223
1662
  }
2224
- interface PdfUrlOptions {
1663
+ export interface PdfUrlOptions {
2225
1664
  mode?: 'auto' | 'range-request' | 'full-fetch';
2226
1665
  password?: string;
2227
1666
  }
2228
- declare enum PdfErrorCode {
1667
+ export declare enum PdfErrorCode {
2229
1668
  Ok = 0,// #define FPDF_ERR_SUCCESS 0 // No error.
2230
1669
  Unknown = 1,// #define FPDF_ERR_UNKNOWN 1 // Unknown error.
2231
1670
  NotFound = 2,// #define FPDF_ERR_FILE 2 // File not found or could not be opened.
@@ -2256,13 +1695,13 @@ declare enum PdfErrorCode {
2256
1695
  CantSelectOption = 27,
2257
1696
  CantCheckField = 28
2258
1697
  }
2259
- interface PdfErrorReason {
1698
+ export interface PdfErrorReason {
2260
1699
  code: PdfErrorCode;
2261
1700
  message: string;
2262
1701
  }
2263
- type PdfEngineError = TaskError<PdfErrorReason>;
2264
- type PdfTask<R> = Task<R, PdfErrorReason>;
2265
- declare class PdfTaskHelper {
1702
+ export type PdfEngineError = TaskError<PdfErrorReason>;
1703
+ export type PdfTask<R> = Task<R, PdfErrorReason>;
1704
+ export declare class PdfTaskHelper {
2266
1705
  /**
2267
1706
  * Create a task
2268
1707
  * @returns new task
@@ -2292,7 +1731,7 @@ declare class PdfTaskHelper {
2292
1731
  *
2293
1732
  * @public
2294
1733
  */
2295
- interface PdfEngine<T = Blob> {
1734
+ export interface PdfEngine<T = Blob> {
2296
1735
  /**
2297
1736
  * Check whether pdf engine supports this feature
2298
1737
  * @param feature - which feature want to check
@@ -2571,52 +2010,17 @@ interface PdfEngine<T = Blob> {
2571
2010
  *
2572
2011
  * @public
2573
2012
  */
2574
- type PdfEngineMethodName = keyof Required<PdfEngine>;
2013
+ export type PdfEngineMethodName = keyof Required<PdfEngine>;
2575
2014
  /**
2576
2015
  * Arguments of PdfEngine method
2577
2016
  *
2578
2017
  * @public
2579
2018
  */
2580
- type PdfEngineMethodArgs<P extends PdfEngineMethodName> = Readonly<Parameters<Required<PdfEngine>[P]>>;
2019
+ export type PdfEngineMethodArgs<P extends PdfEngineMethodName> = Readonly<Parameters<Required<PdfEngine>[P]>>;
2581
2020
  /**
2582
2021
  * Return type of PdfEngine method
2583
2022
  *
2584
2023
  * @public
2585
2024
  */
2586
- type PdfEngineMethodReturnType<P extends PdfEngineMethodName> = ReturnType<Required<PdfEngine>[P]>;
2587
-
2588
- /**
2589
- * Parse a PDF date string **D:YYYYMMDDHHmmSSOHH'mm'** to ISO-8601.
2590
- *
2591
- * Returns `undefined` if the input is malformed.
2592
- *
2593
- * @public
2594
- */
2595
- declare function pdfDateToDate(pdf?: string): Date | undefined;
2596
- /**
2597
- * Convert a date to a PDF date string
2598
- * @param date - date to convert
2599
- * @returns PDF date string
2600
- *
2601
- * @public
2602
- */
2603
- declare function dateToPdfDate(date?: Date): string;
2604
-
2605
- /**
2606
- * Library contains the common definitions of data types and logic
2607
- *
2608
- * @remarks
2609
- * The `@embedpdf/models` defines the interface and classes which are used to
2610
- * handling PDF files.
2611
- *
2612
- * @packageDocumentation
2613
- */
2614
-
2615
- /**
2616
- * ignore will do nothing when called.
2617
- *
2618
- * @public
2619
- */
2620
- declare function ignore(): void;
2621
-
2622
- export { AllLogger, AppearanceMode, type Box, ConsoleLogger, type FormFieldValue, type ImageConversionTypes, LevelLogger, LogLevel, type Logger, MatchFlag, type Matrix, NoopLogger, PDF_FORM_FIELD_FLAG, PDF_FORM_FIELD_TYPE, type PageTextSlice, type PdfActionObject, PdfActionType, type PdfAlphaColor, PdfAnnotationBorderStyle, PdfAnnotationColorType, PdfAnnotationFlagName, PdfAnnotationFlags, type PdfAnnotationObject, type PdfAnnotationObjectBase, PdfAnnotationObjectStatus, PdfAnnotationState, PdfAnnotationStateModel, PdfAnnotationSubtype, PdfAnnotationSubtypeName, type PdfAnnotationTransformation, type PdfAttachmentObject, PdfBomOrZwnbsp, type PdfBookmarkObject, type PdfBookmarksObject, type PdfCaretAnnoObject, type PdfCircleAnnoObject, type PdfDestinationObject, type PdfDocumentObject, type PdfEngine, type PdfEngineError, PdfEngineFeature, type PdfEngineMethodArgs, type PdfEngineMethodName, type PdfEngineMethodReturnType, PdfEngineOperation, PdfErrorCode, type PdfErrorReason, type PdfFile, type PdfFileAttachmentAnnoObject, type PdfFileContent, type PdfFileLoader, type PdfFileUrl, type PdfFileWithoutContent, type PdfFormObject, type PdfFreeTextAnnoObject, type PdfGlyphObject, type PdfGlyphSlim, type PdfHighlightAnnoObject, type PdfImage, type PdfImageObject, type PdfInkAnnoObject, type PdfInkListObject, type PdfLineAnnoObject, type PdfLinkAnnoObject, type PdfLinkTarget, type PdfMetadataObject, PdfNonCharacterFFFE, PdfNonCharacterFFFF, PdfPageFlattenFlag, PdfPageFlattenResult, type PdfPageGeometry, type PdfPageObject, PdfPageObjectType, type PdfPageObjectWithRotatedSize, type PdfPathObject, PdfPermission, type PdfPolygonAnnoObject, type PdfPolylineAnnoObject, type PdfPopupAnnoObject, type PdfRenderOptions, type PdfRun, type PdfSegmentObject, PdfSegmentObjectType, type PdfSignatureObject, PdfSoftHyphenMarker, type PdfSquareAnnoObject, type PdfSquigglyAnnoObject, type PdfStampAnnoObject, type PdfStampAnnoObjectContents, type PdfStrikeOutAnnoObject, type PdfSupportedAnnoObject, type PdfTask, PdfTaskHelper, type PdfTextAnnoObject, type PdfTextRectObject, type PdfTransformMatrix, type PdfUnderlineAnnoObject, type PdfUnsupportedAnnoObject, PdfUnwantedTextMarkers, PdfUnwantedTextRegex, type PdfUrlOptions, type PdfWidgetAnnoField, type PdfWidgetAnnoObject, type PdfWidgetAnnoOption, PdfWordJoiner, PdfZeroWidthSpace, PdfZoomMode, PerfLogger, type Position, type Quad, type Rect, type RejectedCallback, type ResolvedCallback, Rotation, type SearchAllPagesResult, type SearchResult, type SearchTarget, type Size, Task, TaskAbortedError, type TaskError, TaskRejectedError, type TaskReturn, type TaskSettledResult, TaskStage, type TaskState, type TextContext, type WebAlphaColor, boundingRect, calculateAngle, calculateDegree, compareSearchTarget, dateToPdfDate, flagsToNames, ignore, makeMatrix, namesToFlags, pdfAlphaColorToWebAlphaColor, pdfDateToDate, quadToRect, rectToQuad, restoreOffset, restorePosition, restoreRect, rotatePosition, rotateRect, scalePosition, scaleRect, stripPdfUnwantedMarkers, swap, toIntPos, toIntRect, toIntSize, transformPosition, transformRect, transformSize, unionFlags, webAlphaColorToPdfAlphaColor };
2025
+ export type PdfEngineMethodReturnType<P extends PdfEngineMethodName> = ReturnType<Required<PdfEngine>[P]>;
2026
+ export {};