pdfjs-dist 2.6.347 → 2.7.570
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.
Potentially problematic release.
This version of pdfjs-dist might be problematic. Click here for more details.
- package/README.md +3 -3
- package/bower.json +1 -1
- package/build/pdf.js +2050 -1087
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +18219 -10436
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/es5/build/pdf.d.ts +1 -0
- package/es5/build/pdf.js +6623 -6654
- package/es5/build/pdf.js.map +1 -1
- package/es5/build/pdf.min.js +1 -1
- package/es5/build/pdf.worker.js +20815 -13888
- package/es5/build/pdf.worker.js.map +1 -1
- package/es5/build/pdf.worker.min.js +1 -1
- package/es5/image_decoders/pdf.image_decoders.js +3817 -4946
- package/es5/image_decoders/pdf.image_decoders.js.map +1 -1
- package/es5/image_decoders/pdf.image_decoders.min.js +1 -1
- package/es5/web/pdf_viewer.css +18 -15
- package/es5/web/pdf_viewer.js +1094 -514
- package/es5/web/pdf_viewer.js.map +1 -1
- package/image_decoders/pdf.image_decoders.js +774 -168
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +1 -1
- package/lib/core/annotation.js +556 -108
- package/lib/core/cff_parser.js +7 -1
- package/lib/core/charsets.js +1 -1
- package/lib/core/cmap.js +20 -1
- package/lib/core/core_utils.js +162 -3
- package/lib/core/crypto.js +1 -1
- package/lib/core/default_appearance.js +132 -0
- package/lib/core/document.js +115 -9
- package/lib/core/encodings.js +1 -1
- package/lib/core/evaluator.js +168 -74
- package/lib/core/fonts.js +97 -11
- package/lib/core/function.js +5 -10
- package/lib/core/glyphlist.js +11 -4529
- package/lib/core/image_utils.js +30 -1
- package/lib/core/jpg.js +1 -1
- package/lib/core/jpx.js +5 -5
- package/lib/core/murmurhash3.js +1 -1
- package/lib/core/obj.js +123 -39
- package/lib/core/pattern.js +4 -4
- package/lib/core/primitives.js +24 -5
- package/lib/core/standard_fonts.js +1 -1
- package/lib/core/stream.js +5 -1
- package/lib/core/unicode.js +15 -1387
- package/lib/core/worker.js +58 -17
- package/lib/core/writer.js +68 -4
- package/lib/display/annotation_layer.js +712 -119
- package/lib/display/annotation_storage.js +21 -4
- package/lib/display/api.js +88 -18
- package/lib/display/canvas.js +414 -375
- package/lib/display/display_utils.js +11 -4
- package/lib/display/fetch_stream.js +3 -3
- package/lib/display/font_loader.js +2 -3
- package/lib/display/metadata.js +54 -20
- package/lib/display/node_stream.js +1 -1
- package/lib/display/optional_content_config.js +1 -1
- package/lib/display/pattern_helper.js +109 -113
- package/lib/display/svg.js +5 -5
- package/lib/display/text_layer.js +54 -54
- package/lib/display/transport_stream.js +4 -4
- package/lib/display/webgl.js +65 -68
- package/lib/examples/node/domstubs.js +9 -4
- package/lib/pdf.js +2 -2
- package/lib/pdf.sandbox.js +311 -0
- package/lib/pdf.worker.js +2 -2
- package/lib/shared/scripting_utils.js +84 -0
- package/lib/shared/util.js +129 -14
- package/lib/{display → shared}/xml_parser.js +112 -4
- package/lib/test/unit/annotation_spec.js +831 -109
- package/lib/test/unit/annotation_storage_spec.js +28 -10
- package/lib/test/unit/api_spec.js +190 -160
- package/lib/test/unit/bidi_spec.js +6 -6
- package/lib/test/unit/cff_parser_spec.js +73 -73
- package/lib/test/unit/clitests_helper.js +2 -0
- package/lib/test/unit/cmap_spec.js +48 -74
- package/lib/test/unit/core_utils_spec.js +34 -0
- package/lib/test/unit/crypto_spec.js +162 -199
- package/lib/test/unit/custom_spec.js +7 -18
- package/lib/test/unit/default_appearance_spec.js +54 -0
- package/lib/test/unit/display_svg_spec.js +24 -19
- package/lib/test/unit/display_utils_spec.js +1 -1
- package/lib/test/unit/document_spec.js +187 -20
- package/lib/test/unit/evaluator_spec.js +30 -30
- package/lib/test/unit/function_spec.js +165 -165
- package/lib/test/unit/jasmine-boot.js +52 -53
- package/lib/test/unit/metadata_spec.js +2 -2
- package/lib/test/unit/murmurhash3_spec.js +29 -16
- package/lib/test/unit/network_spec.js +21 -21
- package/lib/test/unit/pdf_find_controller_spec.js +131 -69
- package/lib/test/unit/pdf_find_utils_spec.js +10 -10
- package/lib/test/unit/scripting_spec.js +1104 -0
- package/lib/test/unit/stream_spec.js +8 -8
- package/lib/test/unit/test_utils.js +16 -19
- package/lib/test/unit/testreporter.js +11 -4
- package/lib/test/unit/type1_parser_spec.js +23 -23
- package/lib/test/unit/ui_utils_spec.js +78 -35
- package/lib/test/unit/unicode_spec.js +7 -7
- package/lib/test/unit/util_spec.js +26 -3
- package/lib/test/unit/writer_spec.js +16 -1
- package/lib/test/unit/xml_spec.js +117 -0
- package/lib/web/annotation_layer_builder.js +18 -6
- package/lib/web/app.js +579 -161
- package/lib/web/app_options.js +14 -0
- package/lib/web/base_tree_viewer.js +50 -0
- package/lib/web/base_viewer.js +350 -14
- package/lib/web/chromecom.js +9 -1
- package/lib/web/debugger.js +1 -2
- package/lib/web/download_manager.js +0 -15
- package/lib/web/firefox_print_service.js +6 -4
- package/lib/web/firefoxcom.js +84 -69
- package/lib/web/generic_scripting.js +55 -0
- package/lib/web/genericcom.js +9 -1
- package/lib/web/grab_to_pan.js +1 -1
- package/lib/web/interfaces.js +9 -3
- package/lib/web/pdf_attachment_viewer.js +1 -3
- package/lib/web/pdf_cursor_tools.js +20 -13
- package/lib/web/pdf_document_properties.js +48 -61
- package/lib/web/pdf_find_bar.js +1 -3
- package/lib/web/pdf_find_controller.js +58 -12
- package/lib/web/pdf_history.js +43 -21
- package/lib/web/pdf_layer_viewer.js +1 -9
- package/lib/web/pdf_link_service.js +108 -78
- package/lib/web/pdf_outline_viewer.js +166 -10
- package/lib/web/pdf_page_view.js +14 -14
- package/lib/web/pdf_presentation_mode.js +21 -31
- package/lib/web/pdf_rendering_queue.js +8 -1
- package/lib/web/pdf_sidebar.js +62 -107
- package/lib/web/pdf_sidebar_resizer.js +11 -21
- package/lib/web/pdf_single_page_viewer.js +8 -0
- package/lib/web/pdf_thumbnail_view.js +26 -26
- package/lib/web/pdf_thumbnail_viewer.js +13 -2
- package/lib/web/pdf_viewer.component.js +2 -2
- package/lib/web/pdf_viewer.js +3 -1
- package/lib/web/preferences.js +33 -44
- package/lib/web/text_layer_builder.js +2 -9
- package/lib/web/ui_utils.js +78 -46
- package/lib/web/viewer_compatibility.js +1 -2
- package/package.json +4 -1
- package/types/display/annotation_layer.d.ts +18 -3
- package/types/display/api.d.ts +110 -54
- package/types/display/canvas.d.ts +1 -1
- package/types/display/display_utils.d.ts +96 -95
- package/types/display/fetch_stream.d.ts +2 -2
- package/types/display/metadata.d.ts +4 -0
- package/types/display/pattern_helper.d.ts +1 -1
- package/types/display/text_layer.d.ts +7 -7
- package/types/display/transport_stream.d.ts +1 -1
- package/types/shared/scripting_utils.d.ts +12 -0
- package/types/shared/util.d.ts +281 -250
- package/types/shared/xml_parser.d.ts +64 -0
- package/web/pdf_viewer.css +18 -15
- package/web/pdf_viewer.js +809 -408
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +1 -1
- package/types/display/xml_parser.d.ts +0 -35
package/types/display/api.d.ts
CHANGED
@@ -6,48 +6,48 @@ export type DocumentInitParameters = {
|
|
6
6
|
/**
|
7
7
|
* - The URL of the PDF.
|
8
8
|
*/
|
9
|
-
url?: string;
|
9
|
+
url?: string | undefined;
|
10
10
|
/**
|
11
11
|
* - Binary PDF data. Use
|
12
12
|
* typed arrays (Uint8Array) to improve the memory usage. If PDF data is
|
13
13
|
* BASE64-encoded, use `atob()` to convert it to a binary string first.
|
14
14
|
*/
|
15
|
-
data?:
|
15
|
+
data?: string | number[] | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | undefined;
|
16
16
|
/**
|
17
17
|
* - Basic authentication headers.
|
18
18
|
*/
|
19
|
-
httpHeaders?: Object;
|
19
|
+
httpHeaders?: Object | undefined;
|
20
20
|
/**
|
21
21
|
* - Indicates whether or not
|
22
22
|
* cross-site Access-Control requests should be made using credentials such
|
23
23
|
* as cookies or authorization headers. The default is `false`.
|
24
24
|
*/
|
25
|
-
withCredentials?: boolean;
|
25
|
+
withCredentials?: boolean | undefined;
|
26
26
|
/**
|
27
27
|
* - For decrypting password-protected PDFs.
|
28
28
|
*/
|
29
|
-
password?: string;
|
29
|
+
password?: string | undefined;
|
30
30
|
/**
|
31
31
|
* - A typed array with the first portion
|
32
32
|
* or all of the pdf data. Used by the extension since some data is already
|
33
33
|
* loaded before the switch to range requests.
|
34
34
|
*/
|
35
|
-
initialData?:
|
35
|
+
initialData?: Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | undefined;
|
36
36
|
/**
|
37
37
|
* - The PDF file length. It's used for progress
|
38
38
|
* reports and range requests operations.
|
39
39
|
*/
|
40
|
-
length?: number;
|
40
|
+
length?: number | undefined;
|
41
41
|
/**
|
42
42
|
* - Allows for using a custom range
|
43
43
|
* transport implementation.
|
44
44
|
*/
|
45
|
-
range?: PDFDataRangeTransport;
|
45
|
+
range?: PDFDataRangeTransport | undefined;
|
46
46
|
/**
|
47
47
|
* - Specify maximum number of bytes fetched
|
48
48
|
* per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.
|
49
49
|
*/
|
50
|
-
rangeChunkSize?: number;
|
50
|
+
rangeChunkSize?: number | undefined;
|
51
51
|
/**
|
52
52
|
* - The worker that will be used for loading and
|
53
53
|
* parsing the PDF data.
|
@@ -57,56 +57,56 @@ export type DocumentInitParameters = {
|
|
57
57
|
* - Controls the logging level; the constants
|
58
58
|
* from {@link VerbosityLevel} should be used.
|
59
59
|
*/
|
60
|
-
verbosity?: number;
|
60
|
+
verbosity?: number | undefined;
|
61
61
|
/**
|
62
62
|
* - The base URL of the document, used when
|
63
63
|
* attempting to recover valid absolute URLs for annotations, and outline
|
64
64
|
* items, that (incorrectly) only specify relative URLs.
|
65
65
|
*/
|
66
|
-
docBaseUrl?: string;
|
66
|
+
docBaseUrl?: string | undefined;
|
67
67
|
/**
|
68
68
|
* - The URL where the predefined Adobe CMaps are
|
69
69
|
* located. Include the trailing slash.
|
70
70
|
*/
|
71
|
-
cMapUrl?: string;
|
71
|
+
cMapUrl?: string | undefined;
|
72
72
|
/**
|
73
73
|
* - Specifies if the Adobe CMaps are binary
|
74
74
|
* packed or not.
|
75
75
|
*/
|
76
|
-
cMapPacked?: boolean;
|
76
|
+
cMapPacked?: boolean | undefined;
|
77
77
|
/**
|
78
78
|
* - The factory that will be used when
|
79
79
|
* reading built-in CMap files. Providing a custom factory is useful for
|
80
80
|
* environments without Fetch API or `XMLHttpRequest` support, such as
|
81
81
|
* Node.js. The default value is {DOMCMapReaderFactory}.
|
82
82
|
*/
|
83
|
-
CMapReaderFactory?: Object;
|
83
|
+
CMapReaderFactory?: Object | undefined;
|
84
84
|
/**
|
85
85
|
* - Reject certain promises, e.g.
|
86
86
|
* `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
|
87
87
|
* PDF data cannot be successfully parsed, instead of attempting to recover
|
88
88
|
* whatever possible of the data. The default value is `false`.
|
89
89
|
*/
|
90
|
-
stopAtErrors?: boolean;
|
90
|
+
stopAtErrors?: boolean | undefined;
|
91
91
|
/**
|
92
92
|
* - The maximum allowed image size in total
|
93
93
|
* pixels, i.e. width * height. Images above this value will not be rendered.
|
94
94
|
* Use -1 for no limit, which is also the default value.
|
95
95
|
*/
|
96
|
-
maxImageSize?: number;
|
96
|
+
maxImageSize?: number | undefined;
|
97
97
|
/**
|
98
98
|
* - Determines if we can evaluate strings
|
99
99
|
* as JavaScript. Primarily used to improve performance of font rendering, and
|
100
100
|
* when parsing PDF functions. The default value is `true`.
|
101
101
|
*/
|
102
|
-
isEvalSupported?: boolean;
|
102
|
+
isEvalSupported?: boolean | undefined;
|
103
103
|
/**
|
104
104
|
* - By default fonts are converted to
|
105
105
|
* OpenType fonts and loaded via `@font-face` rules. If disabled, fonts will
|
106
106
|
* be rendered using a built-in font renderer that constructs the glyphs with
|
107
107
|
* primitive path commands. The default value is `false`.
|
108
108
|
*/
|
109
|
-
disableFontFace?: boolean;
|
109
|
+
disableFontFace?: boolean | undefined;
|
110
110
|
/**
|
111
111
|
* - Include additional properties,
|
112
112
|
* which are unused during rendering of PDF documents, when exporting the
|
@@ -114,25 +114,25 @@ export type DocumentInitParameters = {
|
|
114
114
|
* purposes (and backwards compatibility), but note that it will lead to
|
115
115
|
* increased memory usage. The default value is `false`.
|
116
116
|
*/
|
117
|
-
fontExtraProperties?: boolean;
|
117
|
+
fontExtraProperties?: boolean | undefined;
|
118
118
|
/**
|
119
119
|
* - Specify an explicit document
|
120
120
|
* context to create elements with and to load resources, such as fonts,
|
121
121
|
* into. Defaults to the current document.
|
122
122
|
*/
|
123
|
-
ownerDocument?: HTMLDocument;
|
123
|
+
ownerDocument?: HTMLDocument | undefined;
|
124
124
|
/**
|
125
125
|
* - Disable range request loading of PDF
|
126
126
|
* files. When enabled, and if the server supports partial content requests,
|
127
127
|
* then the PDF will be fetched in chunks. The default value is `false`.
|
128
128
|
*/
|
129
|
-
disableRange?: boolean;
|
129
|
+
disableRange?: boolean | undefined;
|
130
130
|
/**
|
131
131
|
* - Disable streaming of PDF file data.
|
132
132
|
* By default PDF.js attempts to load PDF files in chunks. The default value
|
133
133
|
* is `false`.
|
134
134
|
*/
|
135
|
-
disableStream?: boolean;
|
135
|
+
disableStream?: boolean | undefined;
|
136
136
|
/**
|
137
137
|
* - Disable pre-fetching of PDF file
|
138
138
|
* data. When range requests are enabled PDF.js will automatically keep
|
@@ -142,12 +142,12 @@ export type DocumentInitParameters = {
|
|
142
142
|
* NOTE: It is also necessary to disable streaming, see above, in order for
|
143
143
|
* disabling of pre-fetching to work correctly.
|
144
144
|
*/
|
145
|
-
disableAutoFetch?: boolean;
|
145
|
+
disableAutoFetch?: boolean | undefined;
|
146
146
|
/**
|
147
147
|
* - Enables special hooks for debugging PDF.js
|
148
148
|
* (see `web/debugger.js`). The default value is `false`.
|
149
149
|
*/
|
150
|
-
pdfBug?: boolean;
|
150
|
+
pdfBug?: boolean | undefined;
|
151
151
|
};
|
152
152
|
export type PDFDocumentStats = {
|
153
153
|
/**
|
@@ -188,20 +188,20 @@ export type PDFDocumentLoadingTask = {
|
|
188
188
|
* function that should be called with the new password, and a reason (see
|
189
189
|
* {@link PasswordResponses}).
|
190
190
|
*/
|
191
|
-
onPassword?: Function;
|
191
|
+
onPassword?: Function | undefined;
|
192
192
|
/**
|
193
193
|
* - Callback to be able to monitor the
|
194
194
|
* loading progress of the PDF file (necessary to implement e.g. a loading
|
195
195
|
* bar). The callback receives an {Object} with the properties `loaded`
|
196
196
|
* ({number}) and `total` ({number}) that indicate how many bytes are loaded.
|
197
197
|
*/
|
198
|
-
onProgress?: Function;
|
198
|
+
onProgress?: Function | undefined;
|
199
199
|
/**
|
200
200
|
* - Callback for when an
|
201
201
|
* unsupported feature is used in the PDF document. The callback receives an
|
202
202
|
* {@link UNSUPPORTED_FEATURES} argument.
|
203
203
|
*/
|
204
|
-
onUnsupportedFeature?: Function;
|
204
|
+
onUnsupportedFeature?: Function | undefined;
|
205
205
|
/**
|
206
206
|
* - Promise for document loading
|
207
207
|
* task completion.
|
@@ -226,22 +226,22 @@ export type GetViewportParameters = {
|
|
226
226
|
* - The desired rotation, in degrees, of
|
227
227
|
* the viewport. If omitted it defaults to the page rotation.
|
228
228
|
*/
|
229
|
-
rotation?: number;
|
229
|
+
rotation?: number | undefined;
|
230
230
|
/**
|
231
231
|
* - The horizontal, i.e. x-axis, offset.
|
232
232
|
* The default value is `0`.
|
233
233
|
*/
|
234
|
-
offsetX?: number;
|
234
|
+
offsetX?: number | undefined;
|
235
235
|
/**
|
236
236
|
* - The vertical, i.e. y-axis, offset.
|
237
237
|
* The default value is `0`.
|
238
238
|
*/
|
239
|
-
offsetY?: number;
|
239
|
+
offsetY?: number | undefined;
|
240
240
|
/**
|
241
241
|
* - If true, the y-axis will not be
|
242
242
|
* flipped. The default value is `false`.
|
243
243
|
*/
|
244
|
-
dontFlip?: boolean;
|
244
|
+
dontFlip?: boolean | undefined;
|
245
245
|
};
|
246
246
|
/**
|
247
247
|
* Page getTextContent parameters.
|
@@ -352,33 +352,33 @@ export type RenderParameters = {
|
|
352
352
|
* - Rendering intent, can be 'display' or 'print'.
|
353
353
|
* The default value is 'display'.
|
354
354
|
*/
|
355
|
-
intent?: string;
|
355
|
+
intent?: string | undefined;
|
356
356
|
/**
|
357
357
|
* - Enables WebGL accelerated rendering for
|
358
358
|
* some operations. The default value is `false`.
|
359
359
|
*/
|
360
|
-
enableWebGL?: boolean;
|
360
|
+
enableWebGL?: boolean | undefined;
|
361
361
|
/**
|
362
362
|
* - Whether or not interactive
|
363
363
|
* form elements are rendered in the display layer. If so, we do not render
|
364
364
|
* them on the canvas as well.
|
365
365
|
*/
|
366
|
-
renderInteractiveForms?: boolean;
|
366
|
+
renderInteractiveForms?: boolean | undefined;
|
367
367
|
/**
|
368
368
|
* - Additional transform, applied just
|
369
369
|
* before viewport transform.
|
370
370
|
*/
|
371
|
-
transform?:
|
371
|
+
transform?: any[] | undefined;
|
372
372
|
/**
|
373
373
|
* - An object that has `beginLayout`,
|
374
374
|
* `endLayout` and `appendImage` functions.
|
375
375
|
*/
|
376
|
-
imageLayer?: Object;
|
376
|
+
imageLayer?: Object | undefined;
|
377
377
|
/**
|
378
378
|
* - The factory instance that will be used
|
379
379
|
* when creating canvases. The default value is {new DOMCanvasFactory()}.
|
380
380
|
*/
|
381
|
-
canvasFactory?: Object;
|
381
|
+
canvasFactory?: Object | undefined;
|
382
382
|
/**
|
383
383
|
* - Background to use for the canvas.
|
384
384
|
* Any valid `canvas.fillStyle` can be used: a `DOMString` parsed as CSS
|
@@ -386,12 +386,12 @@ export type RenderParameters = {
|
|
386
386
|
* a `CanvasPattern` object (a repetitive image). The default value is
|
387
387
|
* 'rgb(255,255,255)'.
|
388
388
|
*/
|
389
|
-
background?: Object |
|
389
|
+
background?: string | Object | undefined;
|
390
390
|
/**
|
391
391
|
* - Storage for annotation
|
392
392
|
* data in forms.
|
393
393
|
*/
|
394
|
-
annotationStorage?: AnnotationStorage;
|
394
|
+
annotationStorage?: AnnotationStorage | undefined;
|
395
395
|
/**
|
396
396
|
* -
|
397
397
|
* A promise that should resolve with an {@link OptionalContentConfig}
|
@@ -399,7 +399,7 @@ export type RenderParameters = {
|
|
399
399
|
* the configuration will be fetched automatically with the default visibility
|
400
400
|
* states set.
|
401
401
|
*/
|
402
|
-
optionalContentConfigPromise?: Promise<OptionalContentConfig
|
402
|
+
optionalContentConfigPromise?: Promise<OptionalContentConfig> | undefined;
|
403
403
|
};
|
404
404
|
/**
|
405
405
|
* PDF page operator list.
|
@@ -419,16 +419,24 @@ export type PDFWorkerParameters = {
|
|
419
419
|
/**
|
420
420
|
* - The name of the worker.
|
421
421
|
*/
|
422
|
-
name?: string;
|
422
|
+
name?: string | undefined;
|
423
423
|
/**
|
424
424
|
* - The `workerPort` object.
|
425
425
|
*/
|
426
|
-
port?: Object;
|
426
|
+
port?: Object | undefined;
|
427
427
|
/**
|
428
428
|
* - Controls the logging level; the
|
429
429
|
* constants from {@link VerbosityLevel} should be used.
|
430
430
|
*/
|
431
|
-
verbosity?: number;
|
431
|
+
verbosity?: number | undefined;
|
432
|
+
};
|
433
|
+
/** @type {string} */
|
434
|
+
export const build: string;
|
435
|
+
export const DefaultCanvasFactory: typeof DOMCanvasFactory | {
|
436
|
+
new (): {};
|
437
|
+
};
|
438
|
+
export const DefaultCMapReaderFactory: typeof DOMCMapReaderFactory | {
|
439
|
+
new (): {};
|
432
440
|
};
|
433
441
|
/**
|
434
442
|
* @typedef { Int8Array | Uint8Array | Uint8ClampedArray |
|
@@ -574,15 +582,6 @@ export class PDFDataRangeTransport {
|
|
574
582
|
requestDataRange(begin: any, end: any): void;
|
575
583
|
abort(): void;
|
576
584
|
}
|
577
|
-
/**
|
578
|
-
* @typedef {Object} PDFWorkerParameters
|
579
|
-
* @property {string} [name] - The name of the worker.
|
580
|
-
* @property {Object} [port] - The `workerPort` object.
|
581
|
-
* @property {number} [verbosity] - Controls the logging level; the
|
582
|
-
* constants from {@link VerbosityLevel} should be used.
|
583
|
-
*/
|
584
|
-
/** @type {any} */
|
585
|
-
export const PDFWorker: any;
|
586
585
|
/**
|
587
586
|
* Proxy to a `PDFDocument` in the worker thread.
|
588
587
|
*/
|
@@ -676,6 +675,14 @@ export class PDFDocumentProxy {
|
|
676
675
|
* if no JavaScript exists.
|
677
676
|
*/
|
678
677
|
getJavaScript(): Promise<Array<string> | null>;
|
678
|
+
/**
|
679
|
+
* @returns {Promise<Object | null>} A promise that is resolved with
|
680
|
+
* an {Object} with the JavaScript actions:
|
681
|
+
* - from the name tree (like getJavaScript);
|
682
|
+
* - from A or AA entries in the catalog dictionary.
|
683
|
+
* , or `null` if no JavaScript exists.
|
684
|
+
*/
|
685
|
+
getJSActions(): Promise<Object | null>;
|
679
686
|
/**
|
680
687
|
* @typedef {Object} OutlineNode
|
681
688
|
* @property {string} title
|
@@ -733,6 +740,23 @@ export class PDFDocumentProxy {
|
|
733
740
|
info: Object;
|
734
741
|
metadata: Metadata;
|
735
742
|
}>;
|
743
|
+
/**
|
744
|
+
* @typedef {Object} MarkInfo
|
745
|
+
* Properties correspond to Table 321 of the PDF 32000-1:2008 spec.
|
746
|
+
* @property {boolean} Marked
|
747
|
+
* @property {boolean} UserProperties
|
748
|
+
* @property {boolean} Suspects
|
749
|
+
*/
|
750
|
+
/**
|
751
|
+
* @returns {Promise<MarkInfo | null>} A promise that is resolved with
|
752
|
+
* a {MarkInfo} object that contains the MarkInfo flags for the PDF
|
753
|
+
* document, or `null` when no MarkInfo values are present in the PDF file.
|
754
|
+
*/
|
755
|
+
getMarkInfo(): Promise<{
|
756
|
+
Marked: boolean;
|
757
|
+
UserProperties: boolean;
|
758
|
+
Suspects: boolean;
|
759
|
+
} | null>;
|
736
760
|
/**
|
737
761
|
* @returns {Promise<TypedArray>} A promise that is resolved with a
|
738
762
|
* {TypedArray} that has the raw data from the PDF.
|
@@ -783,6 +807,23 @@ export class PDFDocumentProxy {
|
|
783
807
|
* {Uint8Array} containing the full data of the saved document.
|
784
808
|
*/
|
785
809
|
saveDocument(annotationStorage: AnnotationStorage): Promise<Uint8Array>;
|
810
|
+
/**
|
811
|
+
* @returns {Promise<Array<Object> | null>} A promise that is resolved with an
|
812
|
+
* {Array<Object>} containing /AcroForm field data for the JS sandbox,
|
813
|
+
* or `null` when no field data is present in the PDF file.
|
814
|
+
*/
|
815
|
+
getFieldObjects(): Promise<Array<Object> | null>;
|
816
|
+
/**
|
817
|
+
* @returns {Promise<boolean>} A promise that is resolved with `true`
|
818
|
+
* if some /AcroForm fields have JavaScript actions.
|
819
|
+
*/
|
820
|
+
hasJSActions(): Promise<boolean>;
|
821
|
+
/**
|
822
|
+
* @returns {Promise<Array<string> | null>} A promise that is resolved with an
|
823
|
+
* {Array<string>} containing IDs of annotations that have a calculation
|
824
|
+
* action, or `null` when no such annotations are present in the PDF file.
|
825
|
+
*/
|
826
|
+
getCalculationOrderIds(): Promise<Array<string> | null>;
|
786
827
|
}
|
787
828
|
/**
|
788
829
|
* Page getViewport parameters.
|
@@ -937,6 +978,11 @@ export class PDFPageProxy {
|
|
937
978
|
getAnnotations({ intent }?: GetAnnotationsParameters): Promise<Array<any>>;
|
938
979
|
annotationsPromise: any;
|
939
980
|
annotationsIntent: string | undefined;
|
981
|
+
/**
|
982
|
+
* @returns {Promise<Object>} A promise that is resolved with an
|
983
|
+
* {Object} with JS actions.
|
984
|
+
*/
|
985
|
+
getJSActions(): Promise<Object>;
|
940
986
|
/**
|
941
987
|
* Begins the process of rendering a page to the desired context.
|
942
988
|
*
|
@@ -966,6 +1012,7 @@ export class PDFPageProxy {
|
|
966
1012
|
* @private
|
967
1013
|
*/
|
968
1014
|
private _destroy;
|
1015
|
+
_jsActionsPromise: any;
|
969
1016
|
/**
|
970
1017
|
* Cleans up resources allocated by the page.
|
971
1018
|
*
|
@@ -1000,6 +1047,15 @@ export class PDFPageProxy {
|
|
1000
1047
|
*/
|
1001
1048
|
get stats(): Object;
|
1002
1049
|
}
|
1050
|
+
/**
|
1051
|
+
* @typedef {Object} PDFWorkerParameters
|
1052
|
+
* @property {string} [name] - The name of the worker.
|
1053
|
+
* @property {Object} [port] - The `workerPort` object.
|
1054
|
+
* @property {number} [verbosity] - Controls the logging level; the
|
1055
|
+
* constants from {@link VerbosityLevel} should be used.
|
1056
|
+
*/
|
1057
|
+
/** @type {any} */
|
1058
|
+
export const PDFWorker: any;
|
1003
1059
|
/**
|
1004
1060
|
* Sets the function that instantiates an {IPDFStream} as an alternative PDF
|
1005
1061
|
* data transport.
|
@@ -1012,11 +1068,11 @@ export class PDFPageProxy {
|
|
1012
1068
|
export function setPDFNetworkStreamFactory(pdfNetworkStreamFactory: IPDFStreamFactory): void;
|
1013
1069
|
/** @type {string} */
|
1014
1070
|
export const version: string;
|
1015
|
-
/** @type {string} */
|
1016
|
-
export const build: string;
|
1017
1071
|
import { PageViewport } from "./display_utils.js";
|
1018
1072
|
import { AnnotationStorage } from "./annotation_storage.js";
|
1019
1073
|
import { OptionalContentConfig } from "./optional_content_config.js";
|
1074
|
+
import { DOMCanvasFactory } from "./display_utils.js";
|
1075
|
+
import { DOMCMapReaderFactory } from "./display_utils.js";
|
1020
1076
|
/**
|
1021
1077
|
* The loading task controls the operations required to load a PDF document
|
1022
1078
|
* (such as network requests) and provides a way to listen for completion,
|
@@ -17,45 +17,120 @@ export type PageViewportParameters = {
|
|
17
17
|
* - The horizontal, i.e. x-axis, offset. The
|
18
18
|
* default value is `0`.
|
19
19
|
*/
|
20
|
-
offsetX?: number;
|
20
|
+
offsetX?: number | undefined;
|
21
21
|
/**
|
22
22
|
* - The vertical, i.e. y-axis, offset. The
|
23
23
|
* default value is `0`.
|
24
24
|
*/
|
25
|
-
offsetY?: number;
|
25
|
+
offsetY?: number | undefined;
|
26
26
|
/**
|
27
27
|
* - If true, the y-axis will not be flipped.
|
28
28
|
* The default value is `false`.
|
29
29
|
*/
|
30
|
-
dontFlip?: boolean;
|
30
|
+
dontFlip?: boolean | undefined;
|
31
31
|
};
|
32
32
|
export type PageViewportCloneParameters = {
|
33
33
|
/**
|
34
34
|
* - The scale, overriding the one in the cloned
|
35
35
|
* viewport. The default value is `this.scale`.
|
36
36
|
*/
|
37
|
-
scale?: number;
|
37
|
+
scale?: number | undefined;
|
38
38
|
/**
|
39
39
|
* - The rotation, in degrees, overriding the one
|
40
40
|
* in the cloned viewport. The default value is `this.rotation`.
|
41
41
|
*/
|
42
|
-
rotation?: number;
|
42
|
+
rotation?: number | undefined;
|
43
43
|
/**
|
44
44
|
* - The horizontal, i.e. x-axis, offset.
|
45
45
|
* The default value is `this.offsetX`.
|
46
46
|
*/
|
47
|
-
offsetX?: number;
|
47
|
+
offsetX?: number | undefined;
|
48
48
|
/**
|
49
49
|
* - The vertical, i.e. y-axis, offset.
|
50
50
|
* The default value is `this.offsetY`.
|
51
51
|
*/
|
52
|
-
offsetY?: number;
|
52
|
+
offsetY?: number | undefined;
|
53
53
|
/**
|
54
54
|
* - If true, the x-axis will not be flipped.
|
55
55
|
* The default value is `false`.
|
56
56
|
*/
|
57
|
-
dontFlip?: boolean;
|
57
|
+
dontFlip?: boolean | undefined;
|
58
58
|
};
|
59
|
+
/**
|
60
|
+
* @typedef ExternalLinkParameters
|
61
|
+
* @typedef {Object} ExternalLinkParameters
|
62
|
+
* @property {string} url - An absolute URL.
|
63
|
+
* @property {LinkTarget} [target] - The link target. The default value is
|
64
|
+
* `LinkTarget.NONE`.
|
65
|
+
* @property {string} [rel] - The link relationship. The default value is
|
66
|
+
* `DEFAULT_LINK_REL`.
|
67
|
+
* @property {boolean} [enabled] - Whether the link should be enabled. The
|
68
|
+
* default value is true.
|
69
|
+
*/
|
70
|
+
/**
|
71
|
+
* Adds various attributes (href, title, target, rel) to hyperlinks.
|
72
|
+
* @param {HTMLLinkElement} link - The link element.
|
73
|
+
* @param {ExternalLinkParameters} params
|
74
|
+
*/
|
75
|
+
export function addLinkAttributes(link: HTMLLinkElement, { url, target, rel, enabled }?: any): void;
|
76
|
+
export class BaseCanvasFactory {
|
77
|
+
create(width: any, height: any): void;
|
78
|
+
reset(canvasAndContext: any, width: any, height: any): void;
|
79
|
+
destroy(canvasAndContext: any): void;
|
80
|
+
}
|
81
|
+
export class BaseCMapReaderFactory {
|
82
|
+
constructor({ baseUrl, isCompressed }: {
|
83
|
+
baseUrl?: any;
|
84
|
+
isCompressed?: boolean | undefined;
|
85
|
+
});
|
86
|
+
baseUrl: any;
|
87
|
+
isCompressed: boolean;
|
88
|
+
fetch({ name }: {
|
89
|
+
name: any;
|
90
|
+
}): Promise<any>;
|
91
|
+
/**
|
92
|
+
* @private
|
93
|
+
*/
|
94
|
+
private _fetchData;
|
95
|
+
}
|
96
|
+
export const DEFAULT_LINK_REL: "noopener noreferrer nofollow";
|
97
|
+
export function deprecated(details: any): void;
|
98
|
+
export class DOMCanvasFactory extends BaseCanvasFactory {
|
99
|
+
constructor({ ownerDocument }?: {
|
100
|
+
ownerDocument?: Document | undefined;
|
101
|
+
});
|
102
|
+
_document: Document;
|
103
|
+
}
|
104
|
+
export class DOMCMapReaderFactory extends BaseCMapReaderFactory {
|
105
|
+
constructor({ baseUrl, isCompressed }: {
|
106
|
+
baseUrl?: any;
|
107
|
+
isCompressed?: boolean | undefined;
|
108
|
+
});
|
109
|
+
}
|
110
|
+
export class DOMSVGFactory {
|
111
|
+
create(width: any, height: any): SVGElement;
|
112
|
+
createElement(type: any): any;
|
113
|
+
}
|
114
|
+
/**
|
115
|
+
* Gets the file name from a given URL.
|
116
|
+
* @param {string} url
|
117
|
+
*/
|
118
|
+
export function getFilenameFromUrl(url: string): string;
|
119
|
+
export function isFetchSupported(): boolean;
|
120
|
+
export function isValidFetchUrl(url: any, baseUrl: any): boolean;
|
121
|
+
export namespace LinkTarget {
|
122
|
+
const NONE: number;
|
123
|
+
const SELF: number;
|
124
|
+
const BLANK: number;
|
125
|
+
const PARENT: number;
|
126
|
+
const TOP: number;
|
127
|
+
}
|
128
|
+
/**
|
129
|
+
* @param {string} src
|
130
|
+
* @param {boolean} [removeScriptElement]
|
131
|
+
* @returns {Promise<void>}
|
132
|
+
*/
|
133
|
+
export function loadScript(src: string, removeScriptElement?: boolean | undefined): Promise<void>;
|
59
134
|
/**
|
60
135
|
* @typedef {Object} PageViewportParameters
|
61
136
|
* @property {Array<number>} viewBox - The xMin, yMin, xMax and
|
@@ -134,93 +209,6 @@ export class PageViewport {
|
|
134
209
|
*/
|
135
210
|
convertToPdfPoint(x: number, y: number): Object;
|
136
211
|
}
|
137
|
-
declare const RenderingCancelledException_base: any;
|
138
|
-
export class RenderingCancelledException extends RenderingCancelledException_base {
|
139
|
-
[x: string]: any;
|
140
|
-
constructor(msg: any, type: any);
|
141
|
-
type: any;
|
142
|
-
}
|
143
|
-
/**
|
144
|
-
* @typedef ExternalLinkParameters
|
145
|
-
* @typedef {Object} ExternalLinkParameters
|
146
|
-
* @property {string} url - An absolute URL.
|
147
|
-
* @property {LinkTarget} [target] - The link target. The default value is
|
148
|
-
* `LinkTarget.NONE`.
|
149
|
-
* @property {string} [rel] - The link relationship. The default value is
|
150
|
-
* `DEFAULT_LINK_REL`.
|
151
|
-
* @property {boolean} [enabled] - Whether the link should be enabled. The
|
152
|
-
* default value is true.
|
153
|
-
*/
|
154
|
-
/**
|
155
|
-
* Adds various attributes (href, title, target, rel) to hyperlinks.
|
156
|
-
* @param {HTMLLinkElement} link - The link element.
|
157
|
-
* @param {ExternalLinkParameters} params
|
158
|
-
*/
|
159
|
-
export function addLinkAttributes(link: HTMLLinkElement, { url, target, rel, enabled }?: any): void;
|
160
|
-
/**
|
161
|
-
* Gets the file name from a given URL.
|
162
|
-
* @param {string} url
|
163
|
-
*/
|
164
|
-
export function getFilenameFromUrl(url: string): string;
|
165
|
-
export namespace LinkTarget {
|
166
|
-
export const NONE: number;
|
167
|
-
export const SELF: number;
|
168
|
-
export const BLANK: number;
|
169
|
-
export const PARENT: number;
|
170
|
-
export const TOP: number;
|
171
|
-
}
|
172
|
-
export const DEFAULT_LINK_REL: "noopener noreferrer nofollow";
|
173
|
-
export class BaseCanvasFactory {
|
174
|
-
create(width: any, height: any): void;
|
175
|
-
reset(canvasAndContext: any, width: any, height: any): void;
|
176
|
-
destroy(canvasAndContext: any): void;
|
177
|
-
}
|
178
|
-
export class DOMCanvasFactory extends BaseCanvasFactory {
|
179
|
-
constructor({ ownerDocument }?: {
|
180
|
-
ownerDocument?: Document | undefined;
|
181
|
-
});
|
182
|
-
_document: Document;
|
183
|
-
}
|
184
|
-
export class BaseCMapReaderFactory {
|
185
|
-
constructor({ baseUrl, isCompressed }: {
|
186
|
-
baseUrl?: any;
|
187
|
-
isCompressed?: boolean | undefined;
|
188
|
-
});
|
189
|
-
baseUrl: any;
|
190
|
-
isCompressed: boolean;
|
191
|
-
fetch({ name }: {
|
192
|
-
name: any;
|
193
|
-
}): Promise<any>;
|
194
|
-
/**
|
195
|
-
* @private
|
196
|
-
*/
|
197
|
-
private _fetchData;
|
198
|
-
}
|
199
|
-
export class DOMCMapReaderFactory extends BaseCMapReaderFactory {
|
200
|
-
constructor({ baseUrl, isCompressed }: {
|
201
|
-
baseUrl?: any;
|
202
|
-
isCompressed?: boolean | undefined;
|
203
|
-
});
|
204
|
-
}
|
205
|
-
export class DOMSVGFactory {
|
206
|
-
create(width: any, height: any): SVGElement;
|
207
|
-
createElement(type: any): any;
|
208
|
-
}
|
209
|
-
export class StatTimer {
|
210
|
-
started: any;
|
211
|
-
times: any[];
|
212
|
-
time(name: any): void;
|
213
|
-
timeEnd(name: any): void;
|
214
|
-
toString(): string;
|
215
|
-
}
|
216
|
-
export function isFetchSupported(): boolean;
|
217
|
-
export function isValidFetchUrl(url: any, baseUrl: any): boolean;
|
218
|
-
/**
|
219
|
-
* @param {string} src
|
220
|
-
* @returns {Promise<void>}
|
221
|
-
*/
|
222
|
-
export function loadScript(src: string): Promise<void>;
|
223
|
-
export function deprecated(details: any): void;
|
224
212
|
export class PDFDateString {
|
225
213
|
/**
|
226
214
|
* Convert a PDF date string to a JavaScript `Date` object.
|
@@ -240,4 +228,17 @@ export class PDFDateString {
|
|
240
228
|
*/
|
241
229
|
static toDateObject(input: string): Date | null;
|
242
230
|
}
|
231
|
+
declare const RenderingCancelledException_base: any;
|
232
|
+
export class RenderingCancelledException extends RenderingCancelledException_base {
|
233
|
+
[x: string]: any;
|
234
|
+
constructor(msg: any, type: any);
|
235
|
+
type: any;
|
236
|
+
}
|
237
|
+
export class StatTimer {
|
238
|
+
started: any;
|
239
|
+
times: any[];
|
240
|
+
time(name: any): void;
|
241
|
+
timeEnd(name: any): void;
|
242
|
+
toString(): string;
|
243
|
+
}
|
243
244
|
export {};
|
@@ -23,7 +23,7 @@ declare class PDFFetchStreamReader {
|
|
23
23
|
_headersCapability: import("../shared/util.js").PromiseCapability;
|
24
24
|
_disableRange: any;
|
25
25
|
_rangeChunkSize: any;
|
26
|
-
_abortController: AbortController;
|
26
|
+
_abortController: AbortController | undefined;
|
27
27
|
_isStreamingSupported: boolean;
|
28
28
|
_isRangeSupported: boolean;
|
29
29
|
_headers: Headers;
|
@@ -51,7 +51,7 @@ declare class PDFFetchStreamRangeReader {
|
|
51
51
|
_withCredentials: any;
|
52
52
|
_readCapability: import("../shared/util.js").PromiseCapability;
|
53
53
|
_isStreamingSupported: boolean;
|
54
|
-
_abortController: AbortController;
|
54
|
+
_abortController: AbortController | undefined;
|
55
55
|
_headers: Headers;
|
56
56
|
onProgress: any;
|
57
57
|
get isStreamingSupported(): boolean;
|