cnf
2025-05-10 386fa0eca75ddc88165f9b73038f2a2239e1072e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/**
 * Interface that represents PDF data transport. If possible, it allows
 * progressively load entire or fragment of the PDF binary data.
 *
 * @interface
 */
export class IPDFStream {
    /**
     * Gets a reader for the entire PDF data.
     * @returns {IPDFStreamReader}
     */
    getFullReader(): IPDFStreamReader;
    /**
     * Gets a reader for the range of the PDF data.
     *
     * NOTE: Currently this method is only expected to be invoked *after*
     * the `IPDFStreamReader.prototype.headersReady` promise has resolved.
     *
     * @param {number} begin - the start offset of the data.
     * @param {number} end - the end offset of the data.
     * @returns {IPDFStreamRangeReader}
     */
    getRangeReader(begin: number, end: number): IPDFStreamRangeReader;
    /**
     * Cancels all opened reader and closes all their opened requests.
     * @param {Object} reason - the reason for cancelling
     */
    cancelAllRequests(reason: Object): void;
}
/**
 * Interface for a PDF binary data fragment reader.
 *
 * @interface
 */
export class IPDFStreamRangeReader {
    /**
     * Sets or gets the progress callback. The callback can be useful when the
     * isStreamingSupported property of the object is defined as false.
     * The callback is called with one parameter: an object with the loaded
     * property.
     */
    onProgress: any;
    /**
     * Gets ability of the stream to progressively load binary data.
     * @type {boolean}
     */
    get isStreamingSupported(): boolean;
    /**
     * Requests a chunk of the binary data. The method returns the promise, which
     * is resolved into object with properties "value" and "done". If the done
     * is set to true, then the stream has reached its end, otherwise the value
     * contains binary data. Cancelled requests will be resolved with the done is
     * set to true.
     * @returns {Promise}
     */
    read(): Promise<any>;
    /**
     * Cancels all pending read requests and closes the stream.
     * @param {Object} reason
     */
    cancel(reason: Object): void;
}
/**
 * Interface for a PDF binary data reader.
 *
 * @interface
 */
export class IPDFStreamReader {
    /**
     * Sets or gets the progress callback. The callback can be useful when the
     * isStreamingSupported property of the object is defined as false.
     * The callback is called with one parameter: an object with the loaded and
     * total properties.
     */
    onProgress: any;
    /**
     * Gets a promise that is resolved when the headers and other metadata of
     * the PDF data stream are available.
     * @type {Promise}
     */
    get headersReady(): Promise<any>;
    /**
     * Gets the Content-Disposition filename. It is defined after the headersReady
     * promise is resolved.
     * @type {string|null} The filename, or `null` if the Content-Disposition
     *                     header is missing/invalid.
     */
    get filename(): string | null;
    /**
     * Gets PDF binary data length. It is defined after the headersReady promise
     * is resolved.
     * @type {number} The data length (or 0 if unknown).
     */
    get contentLength(): number;
    /**
     * Gets ability of the stream to handle range requests. It is defined after
     * the headersReady promise is resolved. Rejected when the reader is cancelled
     * or an error occurs.
     * @type {boolean}
     */
    get isRangeSupported(): boolean;
    /**
     * Gets ability of the stream to progressively load binary data. It is defined
     * after the headersReady promise is resolved.
     * @type {boolean}
     */
    get isStreamingSupported(): boolean;
    /**
     * Requests a chunk of the binary data. The method returns the promise, which
     * is resolved into object with properties "value" and "done". If the done
     * is set to true, then the stream has reached its end, otherwise the value
     * contains binary data. Cancelled requests will be resolved with the done is
     * set to true.
     * @returns {Promise}
     */
    read(): Promise<any>;
    /**
     * Cancels all pending read requests and closes the stream.
     * @param {Object} reason
     */
    cancel(reason: Object): void;
}