@chialab/pdfjs-lib 1.0.0-alpha.2 → 1.0.0-alpha.20
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 +15 -7
- package/dist/browser/NodeCanvasFactory-ONRE5YYL.js +58 -0
- package/dist/browser/chunk-5IWODJWD.js +801 -0
- package/dist/browser/chunk-ELOUEWKT.js +1142 -0
- package/dist/browser/chunk-NJUB3B5A.js +1207 -0
- package/dist/browser/index.js +2641 -3053
- package/dist/browser/openjpeg-K2XBCFFN.js +9 -0
- package/dist/browser/qcms_bg-Q7BRLLZG.js +9 -0
- package/dist/browser/worker.js +7307 -6457
- package/dist/index.d.ts +3 -0
- package/dist/lib/AnnotationData.d.ts +8 -8
- package/dist/lib/AnnotationOperatorsList.d.ts +21 -0
- package/dist/lib/CanvasGraphics.d.ts +1 -0
- package/dist/lib/NodeCanvasFactory.d.ts +9 -0
- package/dist/lib/NodeFilterFactory.d.ts +10 -0
- package/dist/lib/Path2D.d.ts +1 -1
- package/dist/lib/StandardFontDataFactory.d.ts +2 -2
- package/dist/lib/Svg.d.ts +143 -0
- package/dist/lib/SvgCanvasContext.d.ts +31 -22
- package/dist/lib/TextLayer.d.ts +12 -5
- package/dist/lib/WasmFactory.d.ts +5 -0
- package/dist/lib/utils.d.ts +29 -3
- package/dist/node/NodeCanvasFactory-YRBSQ5MH.js +8 -0
- package/dist/node/chunk-3XZOTLLE.js +1439 -0
- package/dist/node/chunk-XMKSLA4K.js +1207 -0
- package/dist/node/chunk-ZKUTXCS2.js +801 -0
- package/dist/node/index.js +2659 -3102
- package/dist/node/openjpeg-B2WN24QZ.js +9 -0
- package/dist/node/qcms_bg-T4RSHPOQ.js +9 -0
- package/dist/node/worker.js +7307 -6457
- package/dist/pdf.js/src/display/annotation_layer.d.ts +1 -2
- package/dist/pdf.js/src/display/annotation_storage.d.ts +1 -8
- package/dist/pdf.js/src/display/api.d.ts +38 -72
- package/dist/pdf.js/src/display/api_utils.d.ts +13 -0
- package/dist/pdf.js/src/display/canvas.d.ts +21 -29
- package/dist/pdf.js/src/display/display_utils.d.ts +12 -1
- package/dist/pdf.js/src/display/draw_layer.d.ts +2 -2
- package/dist/pdf.js/src/display/editor/alt_text.d.ts +1 -1
- package/dist/pdf.js/src/display/editor/annotation_editor_layer.d.ts +5 -5
- package/dist/pdf.js/src/display/editor/color_picker.d.ts +1 -1
- package/dist/pdf.js/src/display/editor/draw.d.ts +7 -7
- package/dist/pdf.js/src/display/editor/drawers/freedraw.d.ts +3 -3
- package/dist/pdf.js/src/display/editor/drawers/signaturedraw.d.ts +13 -13
- package/dist/pdf.js/src/display/editor/editor.d.ts +30 -6
- package/dist/pdf.js/src/display/editor/freetext.d.ts +4 -7
- package/dist/pdf.js/src/display/editor/highlight.d.ts +6 -3
- package/dist/pdf.js/src/display/editor/ink.d.ts +1 -0
- package/dist/pdf.js/src/display/editor/signature.d.ts +3 -0
- package/dist/pdf.js/src/display/editor/stamp.d.ts +4 -3
- package/dist/pdf.js/src/display/editor/toolbar.d.ts +4 -2
- package/dist/pdf.js/src/display/editor/tools.d.ts +7 -9
- package/dist/pdf.js/src/display/metadata.d.ts +1 -2
- package/dist/pdf.js/src/display/optional_content_config.d.ts +1 -1
- package/dist/pdf.js/src/display/pattern_helper.d.ts +4 -2
- package/dist/pdf.js/src/display/pdf_objects.d.ts +40 -0
- package/dist/pdf.js/src/display/text_layer.d.ts +9 -9
- package/dist/pdf.js/src/display/touch_manager.d.ts +5 -1
- package/dist/pdf.js/src/display/worker_options.d.ts +2 -2
- package/dist/pdf.js/src/pdf.d.ts +4 -1
- package/dist/pdf.js/src/shared/scripting_utils.d.ts +2 -0
- package/dist/pdf.js/src/shared/util.d.ts +123 -100
- package/dist/pdf.js/web/text_accessibility.d.ts +1 -1
- package/package.json +7 -4
- package/dist/browser/chunk-DYHYQ33L.js +0 -1775
- package/dist/node/chunk-KTTVPO2G.js +0 -1775
- package/dist/pdf.js/src/display/cmap_reader_factory.d.ts +0 -25
- package/dist/pdf.js/src/display/node_utils.d.ts +0 -32
- package/dist/pdf.js/src/display/wasm_factory.d.ts +0 -20
|
@@ -152,8 +152,7 @@ export class StampAnnotationElement extends AnnotationElement {
|
|
|
152
152
|
}
|
|
153
153
|
import { AnnotationStorage } from "./annotation_storage.js";
|
|
154
154
|
declare class AnnotationElement {
|
|
155
|
-
static _hasPopupData({
|
|
156
|
-
titleObj: any;
|
|
155
|
+
static _hasPopupData({ contentsObj, richText }: {
|
|
157
156
|
contentsObj: any;
|
|
158
157
|
richText: any;
|
|
159
158
|
}): boolean;
|
|
@@ -35,14 +35,6 @@ export class AnnotationStorage {
|
|
|
35
35
|
* @returns {boolean}
|
|
36
36
|
*/
|
|
37
37
|
has(key: string): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* @returns {Object | null}
|
|
40
|
-
*/
|
|
41
|
-
getAll(): Object | null;
|
|
42
|
-
/**
|
|
43
|
-
* @param {Object} obj
|
|
44
|
-
*/
|
|
45
|
-
setAll(obj: Object): void;
|
|
46
38
|
get size(): number;
|
|
47
39
|
resetModified(): void;
|
|
48
40
|
/**
|
|
@@ -71,6 +63,7 @@ export class AnnotationStorage {
|
|
|
71
63
|
ids: Set<string>;
|
|
72
64
|
hash: string;
|
|
73
65
|
};
|
|
66
|
+
[Symbol.iterator](): MapIterator<[any, any]>;
|
|
74
67
|
#private;
|
|
75
68
|
}
|
|
76
69
|
/**
|
|
@@ -21,7 +21,7 @@ export type DocumentInitParameters = {
|
|
|
21
21
|
* worker-thread. This will help reduce main-thread memory usage, however
|
|
22
22
|
* it will take ownership of the TypedArrays.
|
|
23
23
|
*/
|
|
24
|
-
data?: string |
|
|
24
|
+
data?: string | number[] | ArrayBuffer | TypedArray | undefined;
|
|
25
25
|
/**
|
|
26
26
|
* - Basic authentication headers.
|
|
27
27
|
*/
|
|
@@ -48,7 +48,7 @@ export type DocumentInitParameters = {
|
|
|
48
48
|
range?: PDFDataRangeTransport | undefined;
|
|
49
49
|
/**
|
|
50
50
|
* - Specify maximum number of bytes fetched
|
|
51
|
-
* per range request. The default value is
|
|
51
|
+
* per range request. The default value is 65536 (= 2^16).
|
|
52
52
|
*/
|
|
53
53
|
rangeChunkSize?: number | undefined;
|
|
54
54
|
/**
|
|
@@ -83,6 +83,11 @@ export type DocumentInitParameters = {
|
|
|
83
83
|
* The default value is {DOMCMapReaderFactory}.
|
|
84
84
|
*/
|
|
85
85
|
CMapReaderFactory?: Object | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* - The URL where the predefined ICC profiles are
|
|
88
|
+
* located. Include the trailing slash.
|
|
89
|
+
*/
|
|
90
|
+
iccUrl?: string | undefined;
|
|
86
91
|
/**
|
|
87
92
|
* - When `true`, fonts that aren't
|
|
88
93
|
* embedded in the PDF document will fallback to a system font.
|
|
@@ -604,7 +609,7 @@ export const build: string;
|
|
|
604
609
|
* @property {PDFDataRangeTransport} [range] - Allows for using a custom range
|
|
605
610
|
* transport implementation.
|
|
606
611
|
* @property {number} [rangeChunkSize] - Specify maximum number of bytes fetched
|
|
607
|
-
* per range request. The default value is
|
|
612
|
+
* per range request. The default value is 65536 (= 2^16).
|
|
608
613
|
* @property {PDFWorker} [worker] - The worker that will be used for loading and
|
|
609
614
|
* parsing the PDF data.
|
|
610
615
|
* @property {number} [verbosity] - Controls the logging level; the constants
|
|
@@ -619,6 +624,8 @@ export const build: string;
|
|
|
619
624
|
* @property {Object} [CMapReaderFactory] - The factory that will be used when
|
|
620
625
|
* reading built-in CMap files.
|
|
621
626
|
* The default value is {DOMCMapReaderFactory}.
|
|
627
|
+
* @property {string} [iccUrl] - The URL where the predefined ICC profiles are
|
|
628
|
+
* located. Include the trailing slash.
|
|
622
629
|
* @property {boolean} [useSystemFonts] - When `true`, fonts that aren't
|
|
623
630
|
* embedded in the PDF document will fallback to a system font.
|
|
624
631
|
* The default value is `true` in web environments and `false` in Node.js;
|
|
@@ -725,13 +732,6 @@ export const build: string;
|
|
|
725
732
|
* @returns {PDFDocumentLoadingTask}
|
|
726
733
|
*/
|
|
727
734
|
export function getDocument(src?: string | URL | TypedArray | ArrayBuffer | DocumentInitParameters): PDFDocumentLoadingTask;
|
|
728
|
-
export class LoopbackPort {
|
|
729
|
-
postMessage(obj: any, transfer: any): void;
|
|
730
|
-
addEventListener(name: any, listener: any, options?: null): void;
|
|
731
|
-
removeEventListener(name: any, listener: any): void;
|
|
732
|
-
terminate(): void;
|
|
733
|
-
#private;
|
|
734
|
-
}
|
|
735
735
|
/**
|
|
736
736
|
* Abstract class to support range requests file loading.
|
|
737
737
|
*
|
|
@@ -751,11 +751,6 @@ export class PDFDataRangeTransport {
|
|
|
751
751
|
initialData: Uint8Array<ArrayBufferLike> | null;
|
|
752
752
|
progressiveDone: boolean;
|
|
753
753
|
contentDispositionFilename: string;
|
|
754
|
-
_rangeListeners: any[];
|
|
755
|
-
_progressListeners: any[];
|
|
756
|
-
_progressiveReadListeners: any[];
|
|
757
|
-
_progressiveDoneListeners: any[];
|
|
758
|
-
_readyCapability: PromiseWithResolvers<any>;
|
|
759
754
|
/**
|
|
760
755
|
* @param {function} listener
|
|
761
756
|
*/
|
|
@@ -794,6 +789,7 @@ export class PDFDataRangeTransport {
|
|
|
794
789
|
*/
|
|
795
790
|
requestDataRange(begin: number, end: number): void;
|
|
796
791
|
abort(): void;
|
|
792
|
+
#private;
|
|
797
793
|
}
|
|
798
794
|
/**
|
|
799
795
|
* @typedef {Object} OnProgressParameters
|
|
@@ -806,10 +802,19 @@ export class PDFDataRangeTransport {
|
|
|
806
802
|
* after which individual pages can be rendered.
|
|
807
803
|
*/
|
|
808
804
|
export class PDFDocumentLoadingTask {
|
|
809
|
-
static
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
805
|
+
static #docId: number;
|
|
806
|
+
/**
|
|
807
|
+
* @private
|
|
808
|
+
*/
|
|
809
|
+
private _capability;
|
|
810
|
+
/**
|
|
811
|
+
* @private
|
|
812
|
+
*/
|
|
813
|
+
private _transport;
|
|
814
|
+
/**
|
|
815
|
+
* @private
|
|
816
|
+
*/
|
|
817
|
+
private _worker;
|
|
813
818
|
/**
|
|
814
819
|
* Unique identifier for the document loading task.
|
|
815
820
|
* @type {string}
|
|
@@ -845,6 +850,13 @@ export class PDFDocumentLoadingTask {
|
|
|
845
850
|
* completed.
|
|
846
851
|
*/
|
|
847
852
|
destroy(): Promise<void>;
|
|
853
|
+
/**
|
|
854
|
+
* Attempt to fetch the raw data of the PDF document, when e.g.
|
|
855
|
+
* - An exception was thrown during document initialization.
|
|
856
|
+
* - An `onPassword` callback is delaying initialization.
|
|
857
|
+
* @returns {Promise<Uint8Array>}
|
|
858
|
+
*/
|
|
859
|
+
getData(): Promise<Uint8Array>;
|
|
848
860
|
}
|
|
849
861
|
/**
|
|
850
862
|
* Proxy to a `PDFDocument` in the worker thread.
|
|
@@ -1443,19 +1455,20 @@ export class PDFPageProxy {
|
|
|
1443
1455
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1444
1456
|
*/
|
|
1445
1457
|
export class PDFWorker {
|
|
1446
|
-
static
|
|
1447
|
-
static
|
|
1448
|
-
static
|
|
1458
|
+
static #fakeWorkerId: number;
|
|
1459
|
+
static #isWorkerDisabled: boolean;
|
|
1460
|
+
static #workerPorts: WeakMap<WeakKey, any>;
|
|
1449
1461
|
/**
|
|
1450
1462
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1463
|
+
* @returns {PDFWorker}
|
|
1451
1464
|
*/
|
|
1452
|
-
static
|
|
1465
|
+
static create(params: PDFWorkerParameters): PDFWorker;
|
|
1453
1466
|
/**
|
|
1454
1467
|
* The current `workerSrc`, when it exists.
|
|
1455
1468
|
* @type {string}
|
|
1456
1469
|
*/
|
|
1457
1470
|
static get workerSrc(): string;
|
|
1458
|
-
static get
|
|
1471
|
+
static get #mainThreadWorkerMessageHandler(): any;
|
|
1459
1472
|
static get _setupFakeWorkerGlobal(): any;
|
|
1460
1473
|
constructor({ name, port, verbosity, }?: {
|
|
1461
1474
|
name?: null | undefined;
|
|
@@ -1465,10 +1478,6 @@ export class PDFWorker {
|
|
|
1465
1478
|
name: any;
|
|
1466
1479
|
destroyed: boolean;
|
|
1467
1480
|
verbosity: number;
|
|
1468
|
-
_readyCapability: PromiseWithResolvers<any>;
|
|
1469
|
-
_port: any;
|
|
1470
|
-
_webWorker: Worker | null;
|
|
1471
|
-
_messageHandler: MessageHandler | null;
|
|
1472
1481
|
/**
|
|
1473
1482
|
* Promise for worker initialization completion.
|
|
1474
1483
|
* @type {Promise<void>}
|
|
@@ -1484,9 +1493,6 @@ export class PDFWorker {
|
|
|
1484
1493
|
* @type {MessageHandler}
|
|
1485
1494
|
*/
|
|
1486
1495
|
get messageHandler(): MessageHandler;
|
|
1487
|
-
_initializeFromPort(port: any): void;
|
|
1488
|
-
_initialize(): void;
|
|
1489
|
-
_setupFakeWorker(): void;
|
|
1490
1496
|
/**
|
|
1491
1497
|
* Destroys the worker instance.
|
|
1492
1498
|
*/
|
|
@@ -1542,45 +1548,5 @@ import { PrintAnnotationStorage } from "./annotation_storage.js";
|
|
|
1542
1548
|
import { AnnotationStorage } from "./annotation_storage.js";
|
|
1543
1549
|
import { Metadata } from "./metadata.js";
|
|
1544
1550
|
import { StatTimer } from "./display_utils.js";
|
|
1545
|
-
|
|
1546
|
-
* A PDF document and page is built of many objects. E.g. there are objects for
|
|
1547
|
-
* fonts, images, rendering code, etc. These objects may get processed inside of
|
|
1548
|
-
* a worker. This class implements some basic methods to manage these objects.
|
|
1549
|
-
*/
|
|
1550
|
-
declare class PDFObjects {
|
|
1551
|
-
/**
|
|
1552
|
-
* If called *without* callback, this returns the data of `objId` but the
|
|
1553
|
-
* object needs to be resolved. If it isn't, this method throws.
|
|
1554
|
-
*
|
|
1555
|
-
* If called *with* a callback, the callback is called with the data of the
|
|
1556
|
-
* object once the object is resolved. That means, if you call this method
|
|
1557
|
-
* and the object is already resolved, the callback gets called right away.
|
|
1558
|
-
*
|
|
1559
|
-
* @param {string} objId
|
|
1560
|
-
* @param {function} [callback]
|
|
1561
|
-
* @returns {any}
|
|
1562
|
-
*/
|
|
1563
|
-
get(objId: string, callback?: Function): any;
|
|
1564
|
-
/**
|
|
1565
|
-
* @param {string} objId
|
|
1566
|
-
* @returns {boolean}
|
|
1567
|
-
*/
|
|
1568
|
-
has(objId: string): boolean;
|
|
1569
|
-
/**
|
|
1570
|
-
* @param {string} objId
|
|
1571
|
-
* @returns {boolean}
|
|
1572
|
-
*/
|
|
1573
|
-
delete(objId: string): boolean;
|
|
1574
|
-
/**
|
|
1575
|
-
* Resolves the object `objId` with optional `data`.
|
|
1576
|
-
*
|
|
1577
|
-
* @param {string} objId
|
|
1578
|
-
* @param {any} [data]
|
|
1579
|
-
*/
|
|
1580
|
-
resolve(objId: string, data?: any): void;
|
|
1581
|
-
clear(): void;
|
|
1582
|
-
[Symbol.iterator](): Generator<any[], void, unknown>;
|
|
1583
|
-
#private;
|
|
1584
|
-
}
|
|
1551
|
+
import { PDFObjects } from "./pdf_objects.js";
|
|
1585
1552
|
import { MessageHandler } from "../shared/message_handler.js";
|
|
1586
|
-
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function getDataProp(val: any): Uint8Array<any>;
|
|
2
|
+
export function getFactoryUrlProp(val: any): string | null;
|
|
3
|
+
export function getUrlProp(val: any): string | null;
|
|
4
|
+
export function isNameProxy(v: any): boolean;
|
|
5
|
+
export function isRefProxy(v: any): boolean;
|
|
6
|
+
export const isValidExplicitDest: (dest?: any) => boolean;
|
|
7
|
+
export class LoopbackPort {
|
|
8
|
+
postMessage(obj: any, transfer: any): void;
|
|
9
|
+
addEventListener(name: any, listener: any, options?: null): void;
|
|
10
|
+
removeEventListener(name: any, listener: any): void;
|
|
11
|
+
terminate(): void;
|
|
12
|
+
#private;
|
|
13
|
+
}
|
|
@@ -15,7 +15,6 @@ export class CanvasGraphics {
|
|
|
15
15
|
canvasFactory: any;
|
|
16
16
|
filterFactory: any;
|
|
17
17
|
groupStack: any[];
|
|
18
|
-
processingType3: any;
|
|
19
18
|
baseTransform: any;
|
|
20
19
|
baseTransformStack: any[];
|
|
21
20
|
groupLevel: number;
|
|
@@ -84,17 +83,18 @@ export class CanvasGraphics {
|
|
|
84
83
|
save(): void;
|
|
85
84
|
restore(): void;
|
|
86
85
|
transform(a: any, b: any, c: any, d: any, e: any, f: any): void;
|
|
87
|
-
constructPath(
|
|
86
|
+
constructPath(op: any, data: any, minMax: any): void;
|
|
88
87
|
closePath(): void;
|
|
89
|
-
stroke(consumePath?: boolean): void;
|
|
90
|
-
closeStroke(): void;
|
|
91
|
-
fill(consumePath?: boolean): void;
|
|
92
|
-
eoFill(): void;
|
|
93
|
-
fillStroke(): void;
|
|
94
|
-
eoFillStroke(): void;
|
|
95
|
-
closeFillStroke(): void;
|
|
96
|
-
closeEOFillStroke(): void;
|
|
97
|
-
endPath(): void;
|
|
88
|
+
stroke(path: any, consumePath?: boolean): void;
|
|
89
|
+
closeStroke(path: any): void;
|
|
90
|
+
fill(path: any, consumePath?: boolean): void;
|
|
91
|
+
eoFill(path: any): void;
|
|
92
|
+
fillStroke(path: any): void;
|
|
93
|
+
eoFillStroke(path: any): void;
|
|
94
|
+
closeFillStroke(path: any): void;
|
|
95
|
+
closeEOFillStroke(path: any): void;
|
|
96
|
+
endPath(path: any): void;
|
|
97
|
+
rawFillPath(path: any): void;
|
|
98
98
|
clip(): void;
|
|
99
99
|
eoClip(): void;
|
|
100
100
|
beginText(): void;
|
|
@@ -108,7 +108,7 @@ export class CanvasGraphics {
|
|
|
108
108
|
setTextRise(rise: any): void;
|
|
109
109
|
moveText(x: any, y: any): void;
|
|
110
110
|
setLeadingMoveText(x: any, y: any): void;
|
|
111
|
-
setTextMatrix(
|
|
111
|
+
setTextMatrix(matrix: any): void;
|
|
112
112
|
nextLine(): void;
|
|
113
113
|
paintChar(character: any, x: any, y: any, patternFillTransform: any, patternStrokeTransform: any): void;
|
|
114
114
|
get isFontSubpixelAAEnabled(): any;
|
|
@@ -119,9 +119,9 @@ export class CanvasGraphics {
|
|
|
119
119
|
getColorN_Pattern(IR: any): any;
|
|
120
120
|
setStrokeColorN(...args: any[]): void;
|
|
121
121
|
setFillColorN(...args: any[]): void;
|
|
122
|
-
setStrokeRGBColor(
|
|
122
|
+
setStrokeRGBColor(color: any): void;
|
|
123
123
|
setStrokeTransparent(): void;
|
|
124
|
-
setFillRGBColor(
|
|
124
|
+
setFillRGBColor(color: any): void;
|
|
125
125
|
setFillTransparent(): void;
|
|
126
126
|
_getPattern(objId: any, matrix?: null): any;
|
|
127
127
|
shadingFill(objId: any): void;
|
|
@@ -151,10 +151,10 @@ export class CanvasGraphics {
|
|
|
151
151
|
endMarkedContent(): void;
|
|
152
152
|
beginCompat(): void;
|
|
153
153
|
endCompat(): void;
|
|
154
|
-
consumePath(clipBox: any): void;
|
|
154
|
+
consumePath(path: any, clipBox: any): void;
|
|
155
155
|
getSinglePixelWidth(): number;
|
|
156
156
|
getScaleForStroking(): number[];
|
|
157
|
-
rescaleAndStroke(saveRestore: any): void;
|
|
157
|
+
rescaleAndStroke(path: any, saveRestore: any): void;
|
|
158
158
|
isContentVisible(): boolean;
|
|
159
159
|
#private;
|
|
160
160
|
}
|
|
@@ -163,7 +163,7 @@ declare class CanvasExtraState {
|
|
|
163
163
|
alphaIsShape: boolean;
|
|
164
164
|
fontSize: number;
|
|
165
165
|
fontSizeScale: number;
|
|
166
|
-
textMatrix:
|
|
166
|
+
textMatrix: null;
|
|
167
167
|
textMatrixScale: number;
|
|
168
168
|
fontMatrix: number[];
|
|
169
169
|
leading: number;
|
|
@@ -183,23 +183,15 @@ declare class CanvasExtraState {
|
|
|
183
183
|
fillAlpha: number;
|
|
184
184
|
strokeAlpha: number;
|
|
185
185
|
lineWidth: number;
|
|
186
|
-
activeSMask:
|
|
186
|
+
activeSMask: null;
|
|
187
187
|
transferMaps: string;
|
|
188
|
+
clipBox: Float32Array<ArrayBuffer>;
|
|
189
|
+
minMax: Float32Array<ArrayBuffer>;
|
|
188
190
|
clone(): any;
|
|
189
|
-
|
|
190
|
-
updatePathMinMax(transform: any, x: any, y: any): void;
|
|
191
|
-
minX: any;
|
|
192
|
-
minY: any;
|
|
193
|
-
maxX: any;
|
|
194
|
-
maxY: any;
|
|
195
|
-
updateRectMinMax(transform: any, rect: any): void;
|
|
196
|
-
updateScalingPathMinMax(transform: any, minMax: any): void;
|
|
197
|
-
updateCurvePathMinMax(transform: any, x0: any, y0: any, x1: any, y1: any, x2: any, y2: any, x3: any, y3: any, minMax: any): void;
|
|
198
|
-
getPathBoundingBox(pathType?: string, transform?: null): any[];
|
|
191
|
+
getPathBoundingBox(pathType?: string, transform?: null): Float32Array<ArrayBuffer>;
|
|
199
192
|
updateClipFromPath(): void;
|
|
200
193
|
isEmptyClip(): boolean;
|
|
201
194
|
startNewPathAndClipBox(box: any): void;
|
|
202
|
-
clipBox: any;
|
|
203
195
|
getClippedPathBoundingBox(pathType?: string, transform?: null): number[] | null;
|
|
204
196
|
}
|
|
205
197
|
declare class CachedCanvases {
|
|
@@ -97,6 +97,8 @@ export function noContextMenu(e: any): void;
|
|
|
97
97
|
* Scale factors for the canvas, necessary with HiDPI displays.
|
|
98
98
|
*/
|
|
99
99
|
export class OutputScale {
|
|
100
|
+
static get pixelRatio(): number;
|
|
101
|
+
static capPixels(maxPixels: any, capAreaFactor: any): any;
|
|
100
102
|
/**
|
|
101
103
|
* @type {number} Horizontal scale.
|
|
102
104
|
*/
|
|
@@ -109,7 +111,16 @@ export class OutputScale {
|
|
|
109
111
|
* @type {boolean} Returns `true` when scaling is required, `false` otherwise.
|
|
110
112
|
*/
|
|
111
113
|
get scaled(): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* @type {boolean} Returns `true` when scaling is symmetric,
|
|
116
|
+
* `false` otherwise.
|
|
117
|
+
*/
|
|
112
118
|
get symmetric(): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* @returns {boolean} Returns `true` if scaling was limited,
|
|
121
|
+
* `false` otherwise.
|
|
122
|
+
*/
|
|
123
|
+
limitCanvas(width: any, height: any, maxPixels: any, maxDim: any, capAreaFactor?: number): boolean;
|
|
113
124
|
}
|
|
114
125
|
/**
|
|
115
126
|
* @typedef {Object} PageViewportParameters
|
|
@@ -197,7 +208,7 @@ export class PageViewport {
|
|
|
197
208
|
convertToPdfPoint(x: number, y: number): any[];
|
|
198
209
|
}
|
|
199
210
|
export class PDFDateString {
|
|
200
|
-
static
|
|
211
|
+
static #regex: any;
|
|
201
212
|
/**
|
|
202
213
|
* Convert a PDF date string to a JavaScript `Date` object.
|
|
203
214
|
*
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* be able to use mix-blend-mode for some of them.
|
|
5
5
|
*/
|
|
6
6
|
export class DrawLayer {
|
|
7
|
-
static
|
|
7
|
+
static #id: number;
|
|
8
8
|
static get _svgFactory(): any;
|
|
9
|
-
static
|
|
9
|
+
static #setBox(element: any, [x, y, width, height]: [any, any, any, any]): void;
|
|
10
10
|
constructor({ pageIndex }: {
|
|
11
11
|
pageIndex: any;
|
|
12
12
|
});
|
|
@@ -46,7 +46,7 @@ export type RenderEditorLayerOptions = {
|
|
|
46
46
|
*/
|
|
47
47
|
export class AnnotationEditorLayer {
|
|
48
48
|
static _initialized: boolean;
|
|
49
|
-
static
|
|
49
|
+
static #editorTypes: Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof SignatureEditor | typeof StampEditor>;
|
|
50
50
|
/**
|
|
51
51
|
* @param {AnnotationEditorLayerOptions} options
|
|
52
52
|
*/
|
|
@@ -60,9 +60,9 @@ export class AnnotationEditorLayer {
|
|
|
60
60
|
get isInvisible(): boolean;
|
|
61
61
|
/**
|
|
62
62
|
* Update the toolbar if it's required to reflect the tool currently used.
|
|
63
|
-
* @param {
|
|
63
|
+
* @param {Object} options
|
|
64
64
|
*/
|
|
65
|
-
updateToolbar(
|
|
65
|
+
updateToolbar(options: Object): void;
|
|
66
66
|
/**
|
|
67
67
|
* The mode has changed: it must be updated.
|
|
68
68
|
* @param {number} mode
|
|
@@ -140,10 +140,10 @@ export class AnnotationEditorLayer {
|
|
|
140
140
|
canCreateNewEmptyEditor(): boolean | undefined;
|
|
141
141
|
/**
|
|
142
142
|
* Paste some content into a new editor.
|
|
143
|
-
* @param {
|
|
143
|
+
* @param {Object} options
|
|
144
144
|
* @param {Object} params
|
|
145
145
|
*/
|
|
146
|
-
pasteEditor(
|
|
146
|
+
pasteEditor(options: Object, params: Object): Promise<void>;
|
|
147
147
|
/**
|
|
148
148
|
* Create a new editor
|
|
149
149
|
* @param {Object} data
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
export class DrawingEditor extends AnnotationEditor {
|
|
5
5
|
static _currentDrawId: number;
|
|
6
6
|
static _currentParent: null;
|
|
7
|
-
static
|
|
8
|
-
static
|
|
9
|
-
static
|
|
10
|
-
static
|
|
11
|
-
static
|
|
12
|
-
static
|
|
13
|
-
static
|
|
7
|
+
static #currentDraw: null;
|
|
8
|
+
static #currentDrawingAC: null;
|
|
9
|
+
static #currentDrawingOptions: null;
|
|
10
|
+
static #currentPointerId: number;
|
|
11
|
+
static #currentPointerType: null;
|
|
12
|
+
static #currentPointerIds: null;
|
|
13
|
+
static #currentMoveTimestamp: number;
|
|
14
14
|
static _INNER_MARGIN: number;
|
|
15
15
|
static _mergeSVGProperties(p1: any, p2: any): any;
|
|
16
16
|
/**
|
|
@@ -11,9 +11,9 @@ export class FreeDrawOutline extends Outline {
|
|
|
11
11
|
#private;
|
|
12
12
|
}
|
|
13
13
|
export class FreeDrawOutliner {
|
|
14
|
-
static
|
|
15
|
-
static
|
|
16
|
-
static
|
|
14
|
+
static #MIN_DIST: number;
|
|
15
|
+
static #MIN_DIFF: number;
|
|
16
|
+
static #MIN: number;
|
|
17
17
|
constructor({ x, y }: {
|
|
18
18
|
x: any;
|
|
19
19
|
y: any;
|
|
@@ -2,29 +2,29 @@
|
|
|
2
2
|
* Basic text editor in order to create a Signature annotation.
|
|
3
3
|
*/
|
|
4
4
|
export class SignatureExtractor {
|
|
5
|
-
static
|
|
5
|
+
static #PARAMETERS: {
|
|
6
6
|
maxDim: number;
|
|
7
7
|
sigmaSFactor: number;
|
|
8
8
|
sigmaR: number;
|
|
9
9
|
kernelSize: number;
|
|
10
10
|
};
|
|
11
|
-
static
|
|
12
|
-
static
|
|
13
|
-
static
|
|
14
|
-
static
|
|
15
|
-
static
|
|
11
|
+
static #neighborIndexToId(i0: any, j0: any, i: any, j: any): any;
|
|
12
|
+
static #neighborIdToIndex: Int32Array<ArrayBuffer>;
|
|
13
|
+
static #clockwiseNonZero(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
|
|
14
|
+
static #counterClockwiseNonZero(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
|
|
15
|
+
static #findContours(buf: any, width: any, height: any, threshold: any): {
|
|
16
16
|
isHole: boolean;
|
|
17
17
|
points: number[];
|
|
18
18
|
id: number;
|
|
19
19
|
parent: number;
|
|
20
20
|
}[];
|
|
21
|
-
static
|
|
22
|
-
static
|
|
23
|
-
static
|
|
24
|
-
static
|
|
25
|
-
static
|
|
26
|
-
static
|
|
27
|
-
static
|
|
21
|
+
static #douglasPeuckerHelper(points: any, start: any, end: any, output: any): void;
|
|
22
|
+
static #douglasPeucker(points: any): any[] | null;
|
|
23
|
+
static #bilateralFilter(buf: any, width: any, height: any, sigmaS: any, sigmaR: any, kernelSize: any): (Uint32Array<ArrayBuffer> | Uint8Array<any>)[];
|
|
24
|
+
static #getHistogram(buf: any): Uint32Array<ArrayBuffer>;
|
|
25
|
+
static #toUint8(buf: any): Uint8ClampedArray<ArrayBuffer>;
|
|
26
|
+
static #guessThreshold(histogram: any): number;
|
|
27
|
+
static #getGrayPixels(bitmap: any): any[];
|
|
28
28
|
static extractContoursFromText(text: any, { fontFamily, fontStyle, fontWeight }: {
|
|
29
29
|
fontFamily: any;
|
|
30
30
|
fontStyle: any;
|
|
@@ -73,7 +73,7 @@ export class AnnotationEditor {
|
|
|
73
73
|
* @param {AnnotationEditorLayer} parent
|
|
74
74
|
*/
|
|
75
75
|
static paste(item: DataTransferItem, parent: AnnotationEditorLayer): void;
|
|
76
|
-
static
|
|
76
|
+
static #rotatePoint(x: any, y: any, angle: any): any[];
|
|
77
77
|
static _round(x: any): number;
|
|
78
78
|
/**
|
|
79
79
|
* Deserialize the editor.
|
|
@@ -91,6 +91,7 @@ export class AnnotationEditor {
|
|
|
91
91
|
* @param {AnnotationEditorParameters} parameters
|
|
92
92
|
*/
|
|
93
93
|
constructor(parameters: AnnotationEditorParameters);
|
|
94
|
+
isSelected: boolean;
|
|
94
95
|
_isCopy: boolean;
|
|
95
96
|
_editToolbar: null;
|
|
96
97
|
_initialOptions: any;
|
|
@@ -117,6 +118,7 @@ export class AnnotationEditor {
|
|
|
117
118
|
isAttachedToDOM: boolean;
|
|
118
119
|
deleted: boolean;
|
|
119
120
|
get editorType(): any;
|
|
121
|
+
get mode(): any;
|
|
120
122
|
/**
|
|
121
123
|
* Get the properties to update in the UI for this editor.
|
|
122
124
|
* @returns {Array}
|
|
@@ -254,6 +256,11 @@ export class AnnotationEditor {
|
|
|
254
256
|
* Called when the alt text dialog is closed.
|
|
255
257
|
*/
|
|
256
258
|
altTextFinish(): void;
|
|
259
|
+
/**
|
|
260
|
+
* Get the toolbar buttons for this editor.
|
|
261
|
+
* @returns {Array<Array<string|object>>|null}
|
|
262
|
+
*/
|
|
263
|
+
get toolbarButtons(): Array<Array<string | object>> | null;
|
|
257
264
|
/**
|
|
258
265
|
* Add a toolbar for this editor.
|
|
259
266
|
* @returns {Promise<EditorToolbar|null>}
|
|
@@ -262,7 +269,11 @@ export class AnnotationEditor {
|
|
|
262
269
|
removeEditToolbar(): void;
|
|
263
270
|
addContainer(container: any): void;
|
|
264
271
|
getClientDimensions(): DOMRect;
|
|
265
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Create the alt text for this editor.
|
|
274
|
+
* @returns {object}
|
|
275
|
+
*/
|
|
276
|
+
createAltText(): object;
|
|
266
277
|
/**
|
|
267
278
|
* Set the alt text data.
|
|
268
279
|
*/
|
|
@@ -283,7 +294,6 @@ export class AnnotationEditor {
|
|
|
283
294
|
* @param {PointerEvent} event
|
|
284
295
|
*/
|
|
285
296
|
pointerdown(event: PointerEvent): void;
|
|
286
|
-
get isSelected(): any;
|
|
287
297
|
_onStartDragging(): void;
|
|
288
298
|
_onStopDragging(): void;
|
|
289
299
|
moveInDOM(): void;
|
|
@@ -308,12 +318,14 @@ export class AnnotationEditor {
|
|
|
308
318
|
isEmpty(): boolean;
|
|
309
319
|
/**
|
|
310
320
|
* Enable edit mode.
|
|
321
|
+
* @returns {boolean} - true if the edit mode has been enabled.
|
|
311
322
|
*/
|
|
312
|
-
enableEditMode():
|
|
323
|
+
enableEditMode(): boolean;
|
|
313
324
|
/**
|
|
314
325
|
* Disable edit mode.
|
|
326
|
+
* @returns {boolean} - true if the edit mode has been disabled.
|
|
315
327
|
*/
|
|
316
|
-
disableEditMode():
|
|
328
|
+
disableEditMode(): boolean;
|
|
317
329
|
/**
|
|
318
330
|
* Check if the editor is edited.
|
|
319
331
|
* @returns {boolean}
|
|
@@ -413,14 +425,26 @@ export class AnnotationEditor {
|
|
|
413
425
|
* their properties.
|
|
414
426
|
*/
|
|
415
427
|
enableEditing(): void;
|
|
428
|
+
/**
|
|
429
|
+
* Check if the content of this editor can be changed.
|
|
430
|
+
* For example, a FreeText editor can be changed (the user can change the
|
|
431
|
+
* text), but a Stamp editor cannot.
|
|
432
|
+
* @returns {boolean}
|
|
433
|
+
*/
|
|
434
|
+
get canChangeContent(): boolean;
|
|
416
435
|
/**
|
|
417
436
|
* The editor is about to be edited.
|
|
418
437
|
*/
|
|
419
438
|
enterInEditMode(): void;
|
|
439
|
+
/**
|
|
440
|
+
* ondblclick callback.
|
|
441
|
+
* @param {MouseEvent} event
|
|
442
|
+
*/
|
|
443
|
+
dblclick(event: MouseEvent): void;
|
|
420
444
|
/**
|
|
421
445
|
* @returns {HTMLElement | null} the element requiring an alt text.
|
|
422
446
|
*/
|
|
423
|
-
|
|
447
|
+
getElementForAltText(): HTMLElement | null;
|
|
424
448
|
/**
|
|
425
449
|
* Get the div which really contains the displayed content.
|
|
426
450
|
* @returns {HTMLDivElement | undefined}
|
|
@@ -16,8 +16,8 @@ export class FreeTextEditor extends AnnotationEditor {
|
|
|
16
16
|
static updateDefaultParams(type: any, value: any): void;
|
|
17
17
|
/** @inheritdoc */
|
|
18
18
|
static get defaultPropertiesToUpdate(): any[][];
|
|
19
|
-
static
|
|
20
|
-
static
|
|
19
|
+
static #getNodeContent(node: any): any;
|
|
20
|
+
static #deserializeContent(content: any): any;
|
|
21
21
|
/** @inheritdoc */
|
|
22
22
|
static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
|
|
23
23
|
constructor(params: any);
|
|
@@ -38,11 +38,8 @@ export class FreeTextEditor extends AnnotationEditor {
|
|
|
38
38
|
* @returns {undefined}
|
|
39
39
|
*/
|
|
40
40
|
commit(): undefined;
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
* @param {MouseEvent} event
|
|
44
|
-
*/
|
|
45
|
-
dblclick(event: MouseEvent): void;
|
|
41
|
+
/** @inheritdoc */
|
|
42
|
+
keydown(event: any): void;
|
|
46
43
|
editorDivKeydown(event: any): void;
|
|
47
44
|
editorDivFocus(event: any): void;
|
|
48
45
|
editorDivBlur(event: any): void;
|