unpdf 2.1.0 → 2.2.0
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 +12 -12
- package/dist/index.mjs +9 -10
- package/dist/pdfjs-jbig2_nowasm_fallback.mjs +1 -1
- package/dist/pdfjs-openjpeg.mjs +1 -1
- package/dist/pdfjs-openjpeg_nowasm_fallback.mjs +1 -2
- package/dist/pdfjs.mjs +39 -39
- package/dist/types/src/core/colorspace.d.ts +7 -0
- package/dist/types/src/core/crypto.d.ts +10 -2
- package/dist/types/src/core/flate_stream.d.ts +6 -1
- package/dist/types/src/core/image_resizer.d.ts +1 -1
- package/dist/types/src/core/image_utils.d.ts +10 -0
- package/dist/types/src/core/jpx.d.ts +0 -1
- package/dist/types/src/core/parser.d.ts +8 -1
- package/dist/types/src/core/pattern.d.ts +0 -4
- package/dist/types/src/core/primitives.d.ts +1 -0
- package/dist/types/src/core/struct_tree.d.ts +2 -0
- package/dist/types/src/core/wasm_image.d.ts +3 -3
- package/dist/types/src/display/annotation_layer.d.ts +9 -2
- package/dist/types/src/display/api.d.ts +38 -2
- package/dist/types/src/display/api_utils.d.ts +10 -0
- package/dist/types/src/display/canvas.d.ts +13 -3
- package/dist/types/src/display/canvas_dependency_tracker.d.ts +20 -10
- package/dist/types/src/display/canvas_factory.d.ts +1 -11
- package/dist/types/src/display/display_utils.d.ts +0 -71
- package/dist/types/src/display/dom_canvas_factory.d.ts +12 -0
- package/dist/types/src/display/dom_filter_factory.d.ts +23 -0
- package/dist/types/src/display/dom_utils.d.ts +68 -0
- package/dist/types/src/display/editor/draw.d.ts +2 -0
- package/dist/types/src/display/editor/drawers/inkdraw.d.ts +14 -17
- package/dist/types/src/display/editor/drawers/input_smoother.d.ts +28 -0
- package/dist/types/src/display/editor/drawers/outline.d.ts +2 -2
- package/dist/types/src/display/editor/ink.d.ts +2 -1
- package/dist/types/src/display/editor/tools.d.ts +2 -1
- package/dist/types/src/display/filter_factory.d.ts +0 -22
- package/dist/types/src/display/object_handler.d.ts +21 -0
- package/dist/types/src/display/pdf_objects.d.ts +10 -1
- package/dist/types/src/display/renderer_worker_proxy.d.ts +131 -0
- package/dist/types/src/display/text_layer.d.ts +1 -6
- package/dist/types/src/display/worker_options.d.ts +24 -0
- package/dist/types/src/pdf.d.ts +12 -12
- package/dist/types/src/shared/message_handler.d.ts +1 -0
- package/dist/types/src/shared/util.d.ts +4 -0
- package/dist/types/web/annotation_layer_builder.d.ts +1 -0
- package/dist/types/web/autolinker.d.ts +4 -4
- package/dist/types/web/base_download_manager.d.ts +3 -2
- package/dist/types/web/download_manager.d.ts +1 -0
- package/dist/types/web/pdf_page_view.d.ts +1 -0
- package/dist/types/web/pdf_scripting_manager.d.ts +1 -1
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +7 -1
- package/package.json +27 -24
|
@@ -95,6 +95,13 @@ export class ColorSpace {
|
|
|
95
95
|
* Returns true if source data will be equal the result/output data.
|
|
96
96
|
*/
|
|
97
97
|
isPassthrough(bits: any): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Returns an RGB lookup table for all `bpc`-bit samples in a single-component
|
|
100
|
+
* color space.
|
|
101
|
+
* @param {number} bpc
|
|
102
|
+
* @returns {Uint8ClampedArray}
|
|
103
|
+
*/
|
|
104
|
+
getColorMap(bpc: number): Uint8ClampedArray;
|
|
98
105
|
/**
|
|
99
106
|
* Refer to the static `ColorSpace.isDefaultDecode` method below.
|
|
100
107
|
*/
|
|
@@ -34,7 +34,7 @@ export class ARCFourCipher {
|
|
|
34
34
|
constructor(key: any);
|
|
35
35
|
a: number;
|
|
36
36
|
b: number;
|
|
37
|
-
s:
|
|
37
|
+
s: any;
|
|
38
38
|
encryptBlock(data: any): Uint8Array<any>;
|
|
39
39
|
decryptBlock(data: any): Uint8Array<any>;
|
|
40
40
|
encrypt(data: any): Uint8Array<any>;
|
|
@@ -63,6 +63,13 @@ export class CipherTransform {
|
|
|
63
63
|
createStream(stream: BaseStream, length: number | null, cryptFilterName?: Name | null): DecryptStream;
|
|
64
64
|
decryptString(s: any): string;
|
|
65
65
|
encryptString(s: any): string;
|
|
66
|
+
/**
|
|
67
|
+
* @param {string} s - Stream bytes.
|
|
68
|
+
* @param {Dict} dict
|
|
69
|
+
* @param {Name | null} [cryptFilterName] - Explicit /Crypt filter name.
|
|
70
|
+
* @returns {string} Encrypted bytes, unchanged for Identity.
|
|
71
|
+
*/
|
|
72
|
+
encryptStream(s: string, dict: Dict, cryptFilterName?: Name | null): string;
|
|
66
73
|
#private;
|
|
67
74
|
}
|
|
68
75
|
export class CipherTransformFactory {
|
|
@@ -71,7 +78,7 @@ export class CipherTransformFactory {
|
|
|
71
78
|
filterName: any;
|
|
72
79
|
dict: any;
|
|
73
80
|
algorithm: any;
|
|
74
|
-
cf:
|
|
81
|
+
cf: Dict | null;
|
|
75
82
|
stmf: any;
|
|
76
83
|
strf: any;
|
|
77
84
|
eff: any;
|
|
@@ -125,6 +132,7 @@ declare class AESBaseCipher {
|
|
|
125
132
|
}
|
|
126
133
|
import type { BaseStream } from "./base_stream.js";
|
|
127
134
|
import { DecryptStream } from "./decrypt_stream.js";
|
|
135
|
+
import { Dict } from "./primitives.js";
|
|
128
136
|
declare class PDFBase {
|
|
129
137
|
_hash(password: any, input: any, userBytes: any): void;
|
|
130
138
|
checkOwnerPassword(password: any, ownerValidationSalt: any, userBytes: any, ownerPassword: any): boolean;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
export class FlateStream extends DecodeStream {
|
|
2
|
+
static #MIN_NATIVE_COMPRESSED_LENGTH: number;
|
|
3
|
+
static #MAX_JS_DECODED_LENGTH: number;
|
|
2
4
|
constructor(str: any, maybeLength: any);
|
|
3
5
|
stream: any;
|
|
4
6
|
dict: any;
|
|
5
7
|
codeSize: number;
|
|
6
8
|
codeBuf: number;
|
|
7
9
|
getImageData(length: any, _decoderOptions: any): Promise<Uint8Array<ArrayBuffer>>;
|
|
8
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @param {number} [decodedLength] - Expected output length, or 0 if unknown.
|
|
12
|
+
*/
|
|
13
|
+
asyncGetBytes(decodedLength?: number): Promise<Uint8Array<ArrayBuffer> | null>;
|
|
9
14
|
getBits(bits: any): number;
|
|
10
15
|
getCode(table: any): number;
|
|
11
16
|
generateHuffmanTable(lengths: any): (number | Int32Array<ArrayBuffer>)[];
|
|
@@ -11,6 +11,16 @@ export class GlobalImageCache {
|
|
|
11
11
|
shouldCache(ref: any, pageIndex: any): boolean;
|
|
12
12
|
addDecodeFailed(ref: any): void;
|
|
13
13
|
hasDecodeFailed(ref: any): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Track the page before decoding so cleanup can discard the entry.
|
|
16
|
+
*/
|
|
17
|
+
startDecodedImage(ref: any, pageProxyId: any): void;
|
|
18
|
+
setDecodedImage(ref: any, imgData: any): void;
|
|
19
|
+
/**
|
|
20
|
+
* @returns {object | null} The cached image, owned by the caller, or null.
|
|
21
|
+
*/
|
|
22
|
+
takeDecodedImage(ref: any): object | null;
|
|
23
|
+
cleanupPage(pageProxyId: any): void;
|
|
14
24
|
/**
|
|
15
25
|
* PLEASE NOTE: Must be called *after* the `setData` method.
|
|
16
26
|
*/
|
|
@@ -14,7 +14,6 @@ export class JpxImage extends WasmImage {
|
|
|
14
14
|
_filename: string;
|
|
15
15
|
_noWasmFilename: string;
|
|
16
16
|
decode(bytes: any, { numComponents, isIndexedColormap, smaskInData, reducePower, }?: {
|
|
17
|
-
numComponents?: number | undefined;
|
|
18
17
|
isIndexedColormap?: boolean | undefined;
|
|
19
18
|
smaskInData?: boolean | undefined;
|
|
20
19
|
reducePower?: number | undefined;
|
|
@@ -65,6 +65,11 @@ export class Parser {
|
|
|
65
65
|
findDCTDecodeInlineStreamEnd(stream: any): number;
|
|
66
66
|
/**
|
|
67
67
|
* Find the EOD (end-of-data) marker '~>' (i.e. TILDE + GT) of the stream.
|
|
68
|
+
*
|
|
69
|
+
* Since `Ascii85Stream` stops reading immediately upon encountering TILDE,
|
|
70
|
+
* we do the same thing here to simplify handling of corrupt PDFs; e.g.
|
|
71
|
+
* - whitespace "inside" of the EOD marker (fixes issue10614.pdf).
|
|
72
|
+
* - truncated EOD marker, missing the '>' character (fixes issue11385.pdf).
|
|
68
73
|
* @returns {number} The inline stream length.
|
|
69
74
|
*/
|
|
70
75
|
findASCII85DecodeInlineStreamEnd(stream: any): number;
|
|
@@ -75,8 +80,9 @@ export class Parser {
|
|
|
75
80
|
findASCIIHexDecodeInlineStreamEnd(stream: any): number;
|
|
76
81
|
/**
|
|
77
82
|
* Skip over the /EI/ for streams where we search for an EOD marker.
|
|
83
|
+
* @returns {number} The inline stream length.
|
|
78
84
|
*/
|
|
79
|
-
inlineStreamSkipEI(stream: any):
|
|
85
|
+
inlineStreamSkipEI(stream: any, startPos: any, ch: any, name: any): number;
|
|
80
86
|
/**
|
|
81
87
|
* @param {CipherTransform | null} cipherTransform
|
|
82
88
|
* @returns {Streams}
|
|
@@ -102,6 +108,7 @@ export class Parser {
|
|
|
102
108
|
makeFilter(stream: Streams, name: string, maybeLength: number | null, params: Dict | null, cipherTransform?: CipherTransform | null | undefined): Streams;
|
|
103
109
|
#private;
|
|
104
110
|
}
|
|
111
|
+
export function toHexDigit(ch: any): number;
|
|
105
112
|
import { Ascii85Stream } from "./ascii_85_stream.js";
|
|
106
113
|
import { AsciiHexStream } from "./ascii_hex_stream.js";
|
|
107
114
|
import type { BaseStream } from "./base_stream.js";
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
export function clearPatternCaches(): void;
|
|
2
2
|
export function getTilingPatternIR(operatorList: any, dict: any, color: any, needsIsolation?: boolean): any[];
|
|
3
3
|
export class Pattern {
|
|
4
|
-
static #hasGPU: boolean;
|
|
5
|
-
static setOptions({ hasGPU }: {
|
|
6
|
-
hasGPU: any;
|
|
7
|
-
}): void;
|
|
8
4
|
static parseShading(shading: any, xref: any, res: any, pdfFunctionFactory: any, globalColorSpaceCache: any, localColorSpaceCache: any): FunctionBasedShading | RadialAxialShading | MeshShading | DummyShading;
|
|
9
5
|
}
|
|
10
6
|
declare class FunctionBasedShading extends BaseShading {
|
|
@@ -76,6 +76,7 @@ export class RefMap {
|
|
|
76
76
|
has(ref: any): boolean;
|
|
77
77
|
put(ref: any, obj: any): void;
|
|
78
78
|
putAlias(ref: any, aliasRef: any): void;
|
|
79
|
+
remove(ref: any): void;
|
|
79
80
|
getOrPutComputed(ref: any, callback: any): any;
|
|
80
81
|
clear(): void;
|
|
81
82
|
values(): Generator<any, void, unknown>;
|
|
@@ -21,6 +21,7 @@ export class StructTreePage {
|
|
|
21
21
|
* @returns {object}
|
|
22
22
|
*/
|
|
23
23
|
get serializable(): object;
|
|
24
|
+
#private;
|
|
24
25
|
}
|
|
25
26
|
export class StructTreeRoot {
|
|
26
27
|
static canCreateStructureTree({ catalogRef, pdfManager, newAnnotationsByPage, }: {
|
|
@@ -78,6 +79,7 @@ export class StructTreeRoot {
|
|
|
78
79
|
dict: any;
|
|
79
80
|
ref: Ref | null;
|
|
80
81
|
getKidPosition(kidRef: any): any;
|
|
82
|
+
getElementsForPage(pageRef: any): any;
|
|
81
83
|
addAnnotationIdToPage(pageRef: any, id: any, ref: any): void;
|
|
82
84
|
canUpdateStructTree({ pdfManager, newAnnotationsByPage }: {
|
|
83
85
|
pdfManager: any;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export class WasmImage {
|
|
2
|
-
static #
|
|
2
|
+
static #getHandler: null;
|
|
3
3
|
static #instances: Set<any>;
|
|
4
4
|
static #useWasm: boolean;
|
|
5
5
|
static #useWorkerFetch: boolean;
|
|
6
6
|
static #wasmUrl: null;
|
|
7
|
-
static setOptions({
|
|
8
|
-
|
|
7
|
+
static setOptions({ getHandler, useWasm, useWorkerFetch, wasmUrl }: {
|
|
8
|
+
getHandler: any;
|
|
9
9
|
useWasm: any;
|
|
10
10
|
useWorkerFetch: any;
|
|
11
11
|
wasmUrl: any;
|
|
@@ -19,7 +19,6 @@ export type AnnotationElementParameters = {
|
|
|
19
19
|
*/
|
|
20
20
|
imageResourcesPath?: string | undefined;
|
|
21
21
|
renderForms: boolean;
|
|
22
|
-
svgFactory: object;
|
|
23
22
|
enableScripting?: boolean | undefined;
|
|
24
23
|
hasJSActions?: boolean | undefined;
|
|
25
24
|
fieldObjects?: Map<any, any> | undefined;
|
|
@@ -38,6 +37,11 @@ export type AnnotationLayerParameters = {
|
|
|
38
37
|
*/
|
|
39
38
|
imageResourcesPath?: string | undefined;
|
|
40
39
|
renderForms: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* - Allow editing existing
|
|
42
|
+
* annotations. The default value is `true`.
|
|
43
|
+
*/
|
|
44
|
+
enableAnnotationEditing?: boolean | undefined;
|
|
41
45
|
/**
|
|
42
46
|
* - Enable embedded script execution.
|
|
43
47
|
*/
|
|
@@ -66,6 +70,8 @@ export type AnnotationLayerParameters = {
|
|
|
66
70
|
* @property {string} [imageResourcesPath] - Path for image resources, mainly
|
|
67
71
|
* for annotation icons. Include trailing slash.
|
|
68
72
|
* @property {boolean} renderForms
|
|
73
|
+
* @property {boolean} [enableAnnotationEditing] - Allow editing existing
|
|
74
|
+
* annotations. The default value is `true`.
|
|
69
75
|
* @property {boolean} [enableScripting] - Enable embedded script execution.
|
|
70
76
|
* @property {boolean} [hasJSActions] - Some fields have JS actions.
|
|
71
77
|
* The default value is `false`.
|
|
@@ -170,6 +176,7 @@ declare class AnnotationElement {
|
|
|
170
176
|
contentsObj: any;
|
|
171
177
|
richText: any;
|
|
172
178
|
}): boolean;
|
|
179
|
+
static get _svgFactory(): any;
|
|
173
180
|
constructor(parameters: any, { isRenderable, ignoreBorder, createQuadrilaterals, }?: {
|
|
174
181
|
isRenderable?: boolean | undefined;
|
|
175
182
|
ignoreBorder?: boolean | undefined;
|
|
@@ -182,9 +189,9 @@ declare class AnnotationElement {
|
|
|
182
189
|
downloadManager: any;
|
|
183
190
|
imageResourcesPath: any;
|
|
184
191
|
renderForms: any;
|
|
185
|
-
svgFactory: any;
|
|
186
192
|
annotationStorage: any;
|
|
187
193
|
enableComment: any;
|
|
194
|
+
enableAnnotationEditing: boolean;
|
|
188
195
|
enableScripting: any;
|
|
189
196
|
hasJSActions: any;
|
|
190
197
|
_fieldObjects: any;
|
|
@@ -166,6 +166,7 @@ export type DocumentInitParameters = {
|
|
|
166
166
|
* - Specify an explicit document
|
|
167
167
|
* context to create elements with and to load resources, such as fonts,
|
|
168
168
|
* into. Defaults to the current document.
|
|
169
|
+
* NOTE: Worker rendering is disabled when this is set to a custom document.
|
|
169
170
|
*/
|
|
170
171
|
ownerDocument?: HTMLDocument | undefined;
|
|
171
172
|
/**
|
|
@@ -224,6 +225,13 @@ export type DocumentInitParameters = {
|
|
|
224
225
|
* pages are removed, cloned, etc.
|
|
225
226
|
*/
|
|
226
227
|
pagesMapper?: object | undefined;
|
|
228
|
+
/**
|
|
229
|
+
* - Disables worker rendering.
|
|
230
|
+
* Worker rendering requires `GlobalWorkerOptions.rendererSrc` or a nonempty
|
|
231
|
+
* `GlobalWorkerOptions.rendererPorts` array. If unavailable or initialization
|
|
232
|
+
* fails, pages render on the main thread. The default is `false`.
|
|
233
|
+
*/
|
|
234
|
+
disableWorkerRendering?: boolean | undefined;
|
|
227
235
|
};
|
|
228
236
|
export type OnProgressParameters = {
|
|
229
237
|
/**
|
|
@@ -477,6 +485,12 @@ export type RenderParameters = {
|
|
|
477
485
|
* boxes of all PDF operations that render onto the canvas.
|
|
478
486
|
*/
|
|
479
487
|
recordOperations?: boolean | undefined;
|
|
488
|
+
/**
|
|
489
|
+
* - Emit partial renderings of the page
|
|
490
|
+
* through `RenderTask.onFrame` while it is being drawn. Only has an effect
|
|
491
|
+
* when the page is rendered in a renderer worker.
|
|
492
|
+
*/
|
|
493
|
+
partialFrames?: boolean | undefined;
|
|
480
494
|
/**
|
|
481
495
|
* - If provided, only
|
|
482
496
|
* run for which this function returns `true`.
|
|
@@ -708,6 +722,7 @@ export const build: string;
|
|
|
708
722
|
* @property {HTMLDocument} [ownerDocument] - Specify an explicit document
|
|
709
723
|
* context to create elements with and to load resources, such as fonts,
|
|
710
724
|
* into. Defaults to the current document.
|
|
725
|
+
* NOTE: Worker rendering is disabled when this is set to a custom document.
|
|
711
726
|
* @property {boolean} [disableRange] - Disable range request loading of PDF
|
|
712
727
|
* files. When enabled, and if the server supports partial content requests,
|
|
713
728
|
* then the PDF will be fetched in chunks. The default value is `false`.
|
|
@@ -737,6 +752,10 @@ export const build: string;
|
|
|
737
752
|
* @property {object} [pagesMapper] - The pages mapper that will be used to map
|
|
738
753
|
* page ids and page numbers. It's used when the page order is changed or some
|
|
739
754
|
* pages are removed, cloned, etc.
|
|
755
|
+
* @property {boolean} [disableWorkerRendering] - Disables worker rendering.
|
|
756
|
+
* Worker rendering requires `GlobalWorkerOptions.rendererSrc` or a nonempty
|
|
757
|
+
* `GlobalWorkerOptions.rendererPorts` array. If unavailable or initialization
|
|
758
|
+
* fails, pages render on the main thread. The default is `false`.
|
|
740
759
|
*/
|
|
741
760
|
/**
|
|
742
761
|
* This is the main entry point for loading a PDF and interacting with it.
|
|
@@ -819,6 +838,10 @@ export class PDFDocumentLoadingTask {
|
|
|
819
838
|
* @private
|
|
820
839
|
*/
|
|
821
840
|
private _worker;
|
|
841
|
+
/**
|
|
842
|
+
* @private
|
|
843
|
+
*/
|
|
844
|
+
private _rendererWorker;
|
|
822
845
|
/**
|
|
823
846
|
* Unique identifier for the document loading task.
|
|
824
847
|
* @type {string}
|
|
@@ -1369,6 +1392,9 @@ export class PDFDocumentProxy {
|
|
|
1369
1392
|
* @property {boolean} [recordImages] - Record the location of images in the PDF
|
|
1370
1393
|
* @property {boolean} [recordOperations] - Record the dependencies and bounding
|
|
1371
1394
|
* boxes of all PDF operations that render onto the canvas.
|
|
1395
|
+
* @property {boolean} [partialFrames] - Emit partial renderings of the page
|
|
1396
|
+
* through `RenderTask.onFrame` while it is being drawn. Only has an effect
|
|
1397
|
+
* when the page is rendered in a renderer worker.
|
|
1372
1398
|
* @property {OperationsFilter} [operationsFilter] - If provided, only
|
|
1373
1399
|
* run for which this function returns `true`.
|
|
1374
1400
|
*/
|
|
@@ -1515,7 +1541,7 @@ export class PDFPageProxy {
|
|
|
1515
1541
|
* @returns {RenderTask} An object that contains a promise that is
|
|
1516
1542
|
* resolved when the page finishes rendering.
|
|
1517
1543
|
*/
|
|
1518
|
-
render({ canvasContext, canvas, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, recordImages, recordOperations, operationsFilter, }: RenderParameters): RenderTask;
|
|
1544
|
+
render({ canvasContext, canvas, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, recordImages, recordOperations, partialFrames, operationsFilter, }: RenderParameters): RenderTask;
|
|
1519
1545
|
/**
|
|
1520
1546
|
* @param {GetOperatorListParameters} params - Page getOperatorList
|
|
1521
1547
|
* parameters.
|
|
@@ -1659,6 +1685,12 @@ export class RenderTask {
|
|
|
1659
1685
|
* @param {Error} error
|
|
1660
1686
|
*/
|
|
1661
1687
|
onError: Function;
|
|
1688
|
+
/**
|
|
1689
|
+
* Callback invoked after a frame from the renderer worker has been drawn
|
|
1690
|
+
* onto the canvas, including the final one.
|
|
1691
|
+
* @type {Function}
|
|
1692
|
+
*/
|
|
1693
|
+
onFrame: Function;
|
|
1662
1694
|
/**
|
|
1663
1695
|
* Promise for rendering task completion.
|
|
1664
1696
|
* @type {Promise<void>}
|
|
@@ -1677,6 +1709,10 @@ export class RenderTask {
|
|
|
1677
1709
|
*/
|
|
1678
1710
|
get separateAnnots(): boolean;
|
|
1679
1711
|
get imageCoordinates(): any;
|
|
1712
|
+
/**
|
|
1713
|
+
* @type {boolean} Whether this render task draws in a renderer worker.
|
|
1714
|
+
*/
|
|
1715
|
+
get isWorkerRendering(): boolean;
|
|
1680
1716
|
}
|
|
1681
1717
|
/** @type {string} */
|
|
1682
1718
|
export const version: string;
|
|
@@ -1688,6 +1724,6 @@ import { AnnotationStorage } from "./annotation_storage.js";
|
|
|
1688
1724
|
import type { CatalogAttachment } from "../core/catalog.js";
|
|
1689
1725
|
import type { CatalogAttachmentContent } from "../core/catalog.js";
|
|
1690
1726
|
import { Metadata } from "./metadata.js";
|
|
1691
|
-
import { StatTimer } from "./
|
|
1727
|
+
import { StatTimer } from "./api_utils.js";
|
|
1692
1728
|
import { PDFObjects } from "./pdf_objects.js";
|
|
1693
1729
|
import { MessageHandler } from "../shared/message_handler.js";
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
export function deprecated(details: any): void;
|
|
1
2
|
export function getDataProp(val: any): Uint8Array<any>;
|
|
2
3
|
export function getFactoryUrlProp(val: any): string | null;
|
|
3
4
|
export function getUrlProp(val: any): URL | null;
|
|
5
|
+
export function getWorkerSrc(src: any): any;
|
|
4
6
|
export function isNameProxy(v: any): boolean;
|
|
5
7
|
export function isRefProxy(v: any): boolean;
|
|
8
|
+
export function isSameOrigin(baseUrl: any, otherUrl: any): boolean;
|
|
6
9
|
export const isValidExplicitDest: (dest?: any) => boolean;
|
|
7
10
|
export class LoopbackPort {
|
|
8
11
|
postMessage(obj: any, transfer: any): void;
|
|
@@ -11,3 +14,10 @@ export class LoopbackPort {
|
|
|
11
14
|
terminate(): void;
|
|
12
15
|
#private;
|
|
13
16
|
}
|
|
17
|
+
export class StatTimer {
|
|
18
|
+
times: any[];
|
|
19
|
+
time(name: any): void;
|
|
20
|
+
timeEnd(name: any): void;
|
|
21
|
+
toString(): string;
|
|
22
|
+
#private;
|
|
23
|
+
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
export class CanvasGraphics {
|
|
2
2
|
static #SCALE_MATRIX: null;
|
|
3
|
-
|
|
3
|
+
static #pathCaches: WeakMap<object, any>;
|
|
4
|
+
constructor(canvasCtx: any, commonObjs: any, objs: any, canvasFactory: any, filterFactory: any, { optionalContentConfig, markedContentStack, pixelRatio, }: {
|
|
4
5
|
optionalContentConfig: any;
|
|
5
6
|
markedContentStack?: null | undefined;
|
|
7
|
+
pixelRatio?: number | undefined;
|
|
6
8
|
}, annotationCanvasMap: any, pageColors: any, dependencyTracker: any, imagesTracker: any);
|
|
7
9
|
ctx: any;
|
|
8
10
|
current: CanvasExtraState;
|
|
9
11
|
stateStack: any[];
|
|
10
|
-
pendingClip:
|
|
12
|
+
pendingClip: any;
|
|
11
13
|
pendingEOFill: boolean;
|
|
12
14
|
commonObjs: any;
|
|
13
15
|
objs: any;
|
|
@@ -29,6 +31,7 @@ export class CanvasGraphics {
|
|
|
29
31
|
contentVisible: boolean;
|
|
30
32
|
markedContentStack: never[];
|
|
31
33
|
optionalContentConfig: any;
|
|
34
|
+
pixelRatio: number;
|
|
32
35
|
cachedPatterns: Map<any, any>;
|
|
33
36
|
annotationCanvasMap: any;
|
|
34
37
|
viewportScale: number;
|
|
@@ -48,7 +51,8 @@ export class CanvasGraphics {
|
|
|
48
51
|
}): void;
|
|
49
52
|
transparentCanvasEntry: any;
|
|
50
53
|
compositeCtx: any;
|
|
51
|
-
executeOperatorList(operatorList: any, executionStartIdx: any, continueCallback: any, stepper: any, operationsFilter: any): any;
|
|
54
|
+
executeOperatorList(operatorList: any, executionStartIdx: any, continueCallback: any, errorCallback: any, stepper: any, operationsFilter: any): any;
|
|
55
|
+
_pathCache: any;
|
|
52
56
|
transparentCanvas: any;
|
|
53
57
|
endDrawing(): void;
|
|
54
58
|
_scaleImage(img: any, inverseTransform: any): {
|
|
@@ -136,6 +140,10 @@ export class CanvasGraphics {
|
|
|
136
140
|
genericComposeSMask(smask: any, layerCtx: any, width: any, height: any, layerOffsetX: any, layerOffsetY: any): void;
|
|
137
141
|
save(opIdx: any): void;
|
|
138
142
|
restore(opIdx: any): void;
|
|
143
|
+
/**
|
|
144
|
+
* Resets the graphics state, except the clip and the transfer maps.
|
|
145
|
+
*/
|
|
146
|
+
resetGraphicsState(): void;
|
|
139
147
|
transform(opIdx: any, a: any, b: any, c: any, d: any, e: any, f: any): void;
|
|
140
148
|
constructPath(opIdx: any, op: any, data: any, minMax: any): void;
|
|
141
149
|
_pathStartIdx: any;
|
|
@@ -216,6 +224,8 @@ export class CanvasGraphics {
|
|
|
216
224
|
isContentVisible(): boolean;
|
|
217
225
|
#private;
|
|
218
226
|
}
|
|
227
|
+
export function getAnnotationCanvasName(canvas: any): any;
|
|
228
|
+
export function setAnnotationCanvasName(canvas: any, canvasName: any): void;
|
|
219
229
|
declare class CanvasExtraState {
|
|
220
230
|
constructor(width: any, height: any);
|
|
221
231
|
alphaIsShape: boolean;
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
export type SimpleDependency = "lineWidth" | "lineCap" | "lineJoin" | "miterLimit" | "dash" | "strokeAlpha" | "fillColor" | "fillAlpha" | "globalCompositeOperation" | "path" | "filter" | "font" | "fontObj";
|
|
2
2
|
export type IncrementalDependency = "transform" | "moveText" | "sameLineText";
|
|
3
3
|
export type InternalIncrementalDependency = IncrementalDependency | typeof FORCED_DEPENDENCY_LABEL;
|
|
4
|
+
export class BBoxReader {
|
|
5
|
+
static fromBuffer(buffer: any): BBoxReader;
|
|
6
|
+
constructor(bboxes: any, coords: any);
|
|
7
|
+
get buffer(): any;
|
|
8
|
+
get length(): any;
|
|
9
|
+
isEmpty(i: any): boolean;
|
|
10
|
+
minX(i: any): number;
|
|
11
|
+
minY(i: any): number;
|
|
12
|
+
maxX(i: any): number;
|
|
13
|
+
maxY(i: any): number;
|
|
14
|
+
#private;
|
|
15
|
+
}
|
|
4
16
|
export class CanvasBBoxTracker {
|
|
5
17
|
constructor(canvas: any, operationsCount: any);
|
|
6
18
|
_pendingBBoxIdx: number;
|
|
@@ -198,6 +210,14 @@ export class CanvasNestedDependencyTracker implements CanvasDependencyTracker {
|
|
|
198
210
|
takeDebugMetadata(): void;
|
|
199
211
|
#private;
|
|
200
212
|
}
|
|
213
|
+
export function createCanvasTrackers(canvas: any, operationsCount: any, { recordOperations, recordImages, recordDebugMetadata, }: {
|
|
214
|
+
recordOperations?: boolean | undefined;
|
|
215
|
+
recordImages?: boolean | undefined;
|
|
216
|
+
recordDebugMetadata?: boolean | undefined;
|
|
217
|
+
}): {
|
|
218
|
+
dependencyTracker: CanvasBBoxTracker | CanvasDependencyTracker | null;
|
|
219
|
+
imagesTracker: CanvasImagesTracker | null;
|
|
220
|
+
};
|
|
201
221
|
export namespace Dependencies {
|
|
202
222
|
let stroke: string[];
|
|
203
223
|
let fill: string[];
|
|
@@ -208,14 +228,4 @@ export namespace Dependencies {
|
|
|
208
228
|
let transformAndFill: string[];
|
|
209
229
|
}
|
|
210
230
|
declare const FORCED_DEPENDENCY_LABEL: "__forcedDependency";
|
|
211
|
-
declare class BBoxReader {
|
|
212
|
-
constructor(bboxes: any, coords: any);
|
|
213
|
-
get length(): any;
|
|
214
|
-
isEmpty(i: any): boolean;
|
|
215
|
-
minX(i: any): number;
|
|
216
|
-
minY(i: any): number;
|
|
217
|
-
maxX(i: any): number;
|
|
218
|
-
maxY(i: any): number;
|
|
219
|
-
#private;
|
|
220
|
-
}
|
|
221
231
|
export {};
|
|
@@ -10,20 +10,10 @@ export class BaseCanvasFactory {
|
|
|
10
10
|
canvas: any;
|
|
11
11
|
}, width: any, height: any): void;
|
|
12
12
|
destroy(canvasAndContext: any): void;
|
|
13
|
+
getNoAlphaContext(canvas: any): any;
|
|
13
14
|
/**
|
|
14
15
|
* @ignore
|
|
15
16
|
*/
|
|
16
17
|
_createCanvas(width: any, height: any): void;
|
|
17
18
|
#private;
|
|
18
19
|
}
|
|
19
|
-
export class DOMCanvasFactory extends BaseCanvasFactory {
|
|
20
|
-
constructor({ ownerDocument, enableHWA }: {
|
|
21
|
-
ownerDocument?: Document | undefined;
|
|
22
|
-
enableHWA?: boolean | undefined;
|
|
23
|
-
});
|
|
24
|
-
_document: Document;
|
|
25
|
-
/**
|
|
26
|
-
* @ignore
|
|
27
|
-
*/
|
|
28
|
-
_createCanvas(width: any, height: any): HTMLCanvasElement;
|
|
29
|
-
}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
export function applyOpacity(color: any, opacity: any): any;
|
|
2
|
-
export class ColorScheme {
|
|
3
|
-
static get isDarkMode(): any;
|
|
4
|
-
}
|
|
5
2
|
export function computeLuminance(x: any): number;
|
|
6
|
-
export class CSSConstants {
|
|
7
|
-
static get commentForegroundColor(): any;
|
|
8
|
-
}
|
|
9
|
-
export function deprecated(details: any): void;
|
|
10
|
-
export function fetchData(url: any, type?: string): Promise<any>;
|
|
11
3
|
/**
|
|
12
4
|
* Find a color that has sufficient contrast against a fixed color.
|
|
13
5
|
* The luminance (in HSL color space) of the base color is adjusted
|
|
@@ -18,33 +10,11 @@ export function fetchData(url: any, type?: string): Promise<any>;
|
|
|
18
10
|
* @returns {string}
|
|
19
11
|
*/
|
|
20
12
|
export function findContrastColor(baseColor: Array<number>, fixedColor: Array<number>): string;
|
|
21
|
-
export function getColorValues(colors: any): void;
|
|
22
13
|
export function getCurrentTransform(ctx: any): any[];
|
|
23
14
|
export function getCurrentTransformInverse(ctx: any): any[];
|
|
24
|
-
/**
|
|
25
|
-
* Gets the filename from a given URL.
|
|
26
|
-
* @param {string} url
|
|
27
|
-
* @returns {string}
|
|
28
|
-
*/
|
|
29
|
-
export function getFilenameFromUrl(url: string): string;
|
|
30
|
-
/**
|
|
31
|
-
* Returns the filename or guessed filename from the url (see issue 3455).
|
|
32
|
-
* @param {string} url - The original PDF location.
|
|
33
|
-
* @param {string} defaultFilename - The value returned if the filename is
|
|
34
|
-
* unknown, or the protocol is unsupported.
|
|
35
|
-
* @returns {string} Guessed PDF filename.
|
|
36
|
-
*/
|
|
37
|
-
export function getPdfFilenameFromUrl(url: string, defaultFilename?: string): string;
|
|
38
15
|
export function getRGB(color: any): any[];
|
|
39
16
|
export function getRGBA(color: any): any[] | null;
|
|
40
|
-
export function isDataScheme(url: any): boolean;
|
|
41
|
-
export function isPdfFile(filename: any): boolean;
|
|
42
|
-
export function isValidFetchUrl(url: any, baseUrl: any): boolean;
|
|
43
17
|
export function makePathFromDrawOPS(data: any): Path2D;
|
|
44
|
-
/**
|
|
45
|
-
* Event handler to suppress context menu.
|
|
46
|
-
*/
|
|
47
|
-
export function noContextMenu(e: any): void;
|
|
48
18
|
/**
|
|
49
19
|
* Scale factors for the canvas, necessary with HiDPI displays.
|
|
50
20
|
*/
|
|
@@ -74,25 +44,6 @@ export class OutputScale {
|
|
|
74
44
|
*/
|
|
75
45
|
limitCanvas(width: any, height: any, maxPixels: any, maxDim: any, capAreaFactor?: number): boolean;
|
|
76
46
|
}
|
|
77
|
-
export class PDFDateString {
|
|
78
|
-
static #regex: any;
|
|
79
|
-
/**
|
|
80
|
-
* Convert a PDF date string to a JavaScript `Date` object.
|
|
81
|
-
*
|
|
82
|
-
* The PDF date string format is described in section 7.9.4 of the official
|
|
83
|
-
* PDF 32000-1:2008 specification. However, in the PDF 1.7 reference (sixth
|
|
84
|
-
* edition) Adobe describes the same format including a trailing apostrophe.
|
|
85
|
-
* This syntax in incorrect, but Adobe Acrobat creates PDF files that contain
|
|
86
|
-
* them. We ignore all apostrophes as they are not necessary for date parsing.
|
|
87
|
-
*
|
|
88
|
-
* Moreover, Adobe Acrobat doesn't handle changing the date to universal time
|
|
89
|
-
* and doesn't use the user's time zone (effectively ignoring the HH' and mm'
|
|
90
|
-
* parts of the date string).
|
|
91
|
-
* @param {string} input
|
|
92
|
-
* @returns {Date|null}
|
|
93
|
-
*/
|
|
94
|
-
static toDateObject(input: string): Date | null;
|
|
95
|
-
}
|
|
96
47
|
export class PixelsPerInch {
|
|
97
48
|
static CSS: number;
|
|
98
49
|
static PDF: number;
|
|
@@ -104,26 +55,4 @@ export class RenderingCancelledException extends RenderingCancelledException_bas
|
|
|
104
55
|
constructor(msg: any, extraDelay?: number);
|
|
105
56
|
extraDelay: number;
|
|
106
57
|
}
|
|
107
|
-
export function renderRichText({ html, dir, className }: {
|
|
108
|
-
html: any;
|
|
109
|
-
dir: any;
|
|
110
|
-
className: any;
|
|
111
|
-
}, container: any): void;
|
|
112
|
-
/**
|
|
113
|
-
* @param {HTMLDivElement} div
|
|
114
|
-
* @param {PageViewport} viewport
|
|
115
|
-
* @param {boolean} mustFlip
|
|
116
|
-
* @param {boolean} mustRotate
|
|
117
|
-
*/
|
|
118
|
-
export function setLayerDimensions(div: HTMLDivElement, viewport: PageViewport, mustFlip?: boolean, mustRotate?: boolean): void;
|
|
119
|
-
export class StatTimer {
|
|
120
|
-
times: any[];
|
|
121
|
-
time(name: any): void;
|
|
122
|
-
timeEnd(name: any): void;
|
|
123
|
-
toString(): string;
|
|
124
|
-
#private;
|
|
125
|
-
}
|
|
126
|
-
export function stopEvent(e: any): void;
|
|
127
|
-
export const SupportedImageMimeTypes: Set<string>;
|
|
128
|
-
import { PageViewport } from "./page_viewport.js";
|
|
129
58
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export class DOMCanvasFactory extends BaseCanvasFactory {
|
|
2
|
+
constructor({ ownerDocument, enableHWA }: {
|
|
3
|
+
ownerDocument?: Document | undefined;
|
|
4
|
+
enableHWA?: boolean | undefined;
|
|
5
|
+
});
|
|
6
|
+
_document: Document;
|
|
7
|
+
/**
|
|
8
|
+
* @ignore
|
|
9
|
+
*/
|
|
10
|
+
_createCanvas(width: any, height: any): HTMLCanvasElement;
|
|
11
|
+
}
|
|
12
|
+
import { BaseCanvasFactory } from "./canvas_factory.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FilterFactory aims to create some SVG filters we can use when drawing an
|
|
3
|
+
* image (or whatever) on a canvas.
|
|
4
|
+
* Filters aren't applied with ctx.putImageData because it just overwrites the
|
|
5
|
+
* underlying pixels.
|
|
6
|
+
* With these filters, it's possible for example to apply some transfer maps on
|
|
7
|
+
* an image without the need to apply them on the pixel arrays: the renderer
|
|
8
|
+
* does the magic for us.
|
|
9
|
+
*/
|
|
10
|
+
export class DOMFilterFactory extends BaseFilterFactory {
|
|
11
|
+
constructor({ docId, ownerDocument }: {
|
|
12
|
+
docId: any;
|
|
13
|
+
ownerDocument?: Document | undefined;
|
|
14
|
+
});
|
|
15
|
+
addFilter(maps: any): any;
|
|
16
|
+
addHCMFilter(fgColor: any, bgColor: any): any;
|
|
17
|
+
addAlphaFilter(map: any): any;
|
|
18
|
+
addLuminosityFilter(map: any): any;
|
|
19
|
+
addKnockoutFilter(alpha?: number): any;
|
|
20
|
+
addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): any;
|
|
21
|
+
#private;
|
|
22
|
+
}
|
|
23
|
+
import { BaseFilterFactory } from "./filter_factory.js";
|