Improve consistency for the API documentation comments
Over time we used multiple different formats for JSDoc comments. This commit standardizes those formats to the one we used most often. Moreover, this removes the example in the outline endpoint documentation since it now has a proper type definition and it didn't render correctly in JSDoc.
This commit is contained in:
parent
ba4a07ce07
commit
56ca027c08
@ -89,6 +89,7 @@ let createPDFNetworkStream;
|
|||||||
/**
|
/**
|
||||||
* Sets the function that instantiates an {IPDFStream} as an alternative PDF
|
* Sets the function that instantiates an {IPDFStream} as an alternative PDF
|
||||||
* data transport.
|
* data transport.
|
||||||
|
*
|
||||||
* @param {IPDFStreamFactory} pdfNetworkStreamFactory - The factory function
|
* @param {IPDFStreamFactory} pdfNetworkStreamFactory - The factory function
|
||||||
* that takes document initialization parameters (including a "url") and
|
* that takes document initialization parameters (including a "url") and
|
||||||
* returns a promise which is resolved with an instance of {IPDFStream}.
|
* returns a promise which is resolved with an instance of {IPDFStream}.
|
||||||
@ -98,82 +99,84 @@ function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {
|
|||||||
createPDFNetworkStream = pdfNetworkStreamFactory;
|
createPDFNetworkStream = pdfNetworkStreamFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-disable max-len */
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array} TypedArray
|
* @typedef {
|
||||||
|
* Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array |
|
||||||
|
* Int32Array | Uint32Array | Float32Array | Float64Array
|
||||||
|
* } TypedArray
|
||||||
*/
|
*/
|
||||||
/* eslint-enable max-len */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Document initialization / loading parameters object.
|
* Document initialization / loading parameters object.
|
||||||
*
|
*
|
||||||
* @typedef {Object} DocumentInitParameters
|
* @typedef {Object} DocumentInitParameters
|
||||||
* @property {string} [url] - The URL of the PDF.
|
* @property {string} [url] - The URL of the PDF.
|
||||||
* @property {TypedArray|Array<number>|string} [data] - Binary PDF data. Use
|
* @property {TypedArray|Array<number>|string} [data] - Binary PDF data. Use
|
||||||
* typed arrays (Uint8Array) to improve the memory usage. If PDF data is
|
* typed arrays (Uint8Array) to improve the memory usage. If PDF data is
|
||||||
* BASE64-encoded, use atob() to convert it to a binary string first.
|
* BASE64-encoded, use `atob()` to convert it to a binary string first.
|
||||||
* @property {Object} [httpHeaders] - Basic authentication headers.
|
* @property {Object} [httpHeaders] - Basic authentication headers.
|
||||||
* @property {boolean} [withCredentials] - Indicates whether or not
|
* @property {boolean} [withCredentials] - Indicates whether or not
|
||||||
* cross-site Access-Control requests should be made using credentials such
|
* cross-site Access-Control requests should be made using credentials such
|
||||||
* as cookies or authorization headers. The default is false.
|
* as cookies or authorization headers. The default is `false`.
|
||||||
* @property {string} [password] - For decrypting password-protected PDFs.
|
* @property {string} [password] - For decrypting password-protected PDFs.
|
||||||
* @property {TypedArray} [initialData] - A typed array with the first portion
|
* @property {TypedArray} [initialData] - A typed array with the first portion
|
||||||
* or all of the pdf data. Used by the extension since some data is already
|
* or all of the pdf data. Used by the extension since some data is already
|
||||||
* loaded before the switch to range requests.
|
* loaded before the switch to range requests.
|
||||||
* @property {number} [length] - The PDF file length. It's used for
|
* @property {number} [length] - The PDF file length. It's used for progress
|
||||||
* progress reports and range requests operations.
|
* reports and range requests operations.
|
||||||
* @property {PDFDataRangeTransport} [range]
|
* @property {PDFDataRangeTransport} [range] - Allows for using a custom range
|
||||||
* @property {number} [rangeChunkSize] - Specify maximum number of bytes
|
* transport implementation.
|
||||||
* fetched per range request. The default value is 2^16 = 65536.
|
* @property {number} [rangeChunkSize] - Specify maximum number of bytes fetched
|
||||||
* @property {PDFWorker} [worker] - The worker that will be used for
|
* per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.
|
||||||
* the loading and parsing of the PDF data.
|
* @property {PDFWorker} [worker] - The worker that will be used for loading and
|
||||||
* @property {number} [verbosity] - Controls the logging level; the
|
* parsing the PDF data.
|
||||||
* constants from {VerbosityLevel} should be used.
|
* @property {number} [verbosity] - Controls the logging level; the constants
|
||||||
* @property {string} [docBaseUrl] - The base URL of the document,
|
* from {@link VerbosityLevel} should be used.
|
||||||
* used when attempting to recover valid absolute URLs for annotations, and
|
* @property {string} [docBaseUrl] - The base URL of the document, used when
|
||||||
* outline items, that (incorrectly) only specify relative URLs.
|
* attempting to recover valid absolute URLs for annotations, and outline
|
||||||
* @property {string} [cMapUrl] - The URL where the predefined
|
* items, that (incorrectly) only specify relative URLs.
|
||||||
* Adobe CMaps are located. Include trailing slash.
|
* @property {string} [cMapUrl] - The URL where the predefined Adobe CMaps are
|
||||||
* @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are
|
* located. Include the trailing slash.
|
||||||
* binary packed.
|
* @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are binary
|
||||||
* @property {Object} [CMapReaderFactory] - The factory that will be
|
* packed or not.
|
||||||
* used when reading built-in CMap files. Providing a custom factory is useful
|
* @property {Object} [CMapReaderFactory] - The factory that will be used when
|
||||||
* for environments without `XMLHttpRequest` support, such as e.g. Node.js.
|
* reading built-in CMap files. Providing a custom factory is useful for
|
||||||
* The default value is {DOMCMapReaderFactory}.
|
* environments without Fetch API or `XMLHttpRequest` support, such as
|
||||||
|
* Node.js. The default value is {DOMCMapReaderFactory}.
|
||||||
* @property {boolean} [stopAtErrors] - Reject certain promises, e.g.
|
* @property {boolean} [stopAtErrors] - Reject certain promises, e.g.
|
||||||
* `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
|
* `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
|
||||||
* PDF data cannot be successfully parsed, instead of attempting to recover
|
* PDF data cannot be successfully parsed, instead of attempting to recover
|
||||||
* whatever possible of the data. The default value is `false`.
|
* whatever possible of the data. The default value is `false`.
|
||||||
* @property {number} [maxImageSize] - The maximum allowed image size
|
* @property {number} [maxImageSize] - The maximum allowed image size in total
|
||||||
* in total pixels, i.e. width * height. Images above this value will not be
|
* pixels, i.e. width * height. Images above this value will not be rendered.
|
||||||
* rendered. Use -1 for no limit, which is also the default value.
|
* Use -1 for no limit, which is also the default value.
|
||||||
* @property {boolean} [isEvalSupported] - Determines if we can eval
|
* @property {boolean} [isEvalSupported] - Determines if we can evaluate strings
|
||||||
* strings as JS. Primarily used to improve performance of font rendering,
|
* as JavaScript. Primarily used to improve performance of font rendering, and
|
||||||
* and when parsing PDF functions. The default value is `true`.
|
* when parsing PDF functions. The default value is `true`.
|
||||||
* @property {boolean} [disableFontFace] - By default fonts are
|
* @property {boolean} [disableFontFace] - By default fonts are converted to
|
||||||
* converted to OpenType fonts and loaded via font face rules. If disabled,
|
* OpenType fonts and loaded via `@font-face` rules. If disabled, fonts will
|
||||||
* fonts will be rendered using a built-in font renderer that constructs the
|
* be rendered using a built-in font renderer that constructs the glyphs with
|
||||||
* glyphs with primitive path commands. The default value is `false`.
|
* primitive path commands. The default value is `false`.
|
||||||
* @property {boolean} [fontExtraProperties] - Include additional properties,
|
* @property {boolean} [fontExtraProperties] - Include additional properties,
|
||||||
* which are unused during rendering of PDF documents, when exporting the
|
* which are unused during rendering of PDF documents, when exporting the
|
||||||
* parsed font data from the worker-thread. This may be useful for debugging
|
* parsed font data from the worker-thread. This may be useful for debugging
|
||||||
* purposes (and backwards compatibility), but note that it will lead to
|
* purposes (and backwards compatibility), but note that it will lead to
|
||||||
* increased memory usage. The default value is `false`.
|
* increased memory usage. The default value is `false`.
|
||||||
* @property {boolean} [disableRange] - Disable range request loading
|
* @property {boolean} [disableRange] - Disable range request loading of PDF
|
||||||
* of PDF files. When enabled, and if the server supports partial content
|
* files. When enabled, and if the server supports partial content requests,
|
||||||
* requests, then the PDF will be fetched in chunks.
|
* then the PDF will be fetched in chunks. The default value is `false`.
|
||||||
* The default value is `false`.
|
* @property {boolean} [disableStream] - Disable streaming of PDF file data.
|
||||||
* @property {boolean} [disableStream] - Disable streaming of PDF file
|
* By default PDF.js attempts to load PDF files in chunks. The default value
|
||||||
* data. By default PDF.js attempts to load PDFs in chunks.
|
* is `false`.
|
||||||
* The default value is `false`.
|
* @property {boolean} [disableAutoFetch] - Disable pre-fetching of PDF file
|
||||||
* @property {boolean} [disableAutoFetch] - Disable pre-fetching of PDF
|
* data. When range requests are enabled PDF.js will automatically keep
|
||||||
* file data. When range requests are enabled PDF.js will automatically keep
|
|
||||||
* fetching more data even if it isn't needed to display the current page.
|
* fetching more data even if it isn't needed to display the current page.
|
||||||
* The default value is `false`.
|
* The default value is `false`.
|
||||||
* NOTE: It is also necessary to disable streaming, see above,
|
*
|
||||||
* in order for disabling of pre-fetching to work correctly.
|
* NOTE: It is also necessary to disable streaming, see above, in order for
|
||||||
* @property {boolean} [pdfBug] - Enables special hooks for debugging
|
* disabling of pre-fetching to work correctly.
|
||||||
* PDF.js (see `web/debugger.js`). The default value is `false`.
|
* @property {boolean} [pdfBug] - Enables special hooks for debugging PDF.js
|
||||||
|
* (see `web/debugger.js`). The default value is `false`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -188,13 +191,14 @@ function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main entry point for loading a PDF and interacting with it.
|
* This is the main entry point for loading a PDF and interacting with it.
|
||||||
* NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR)
|
|
||||||
* is used, which means it must follow the same origin rules that any XHR does
|
|
||||||
* e.g. No cross domain requests without CORS.
|
|
||||||
*
|
*
|
||||||
* @param {string|TypedArray|DocumentInitParameters|PDFDataRangeTransport} src
|
* NOTE: If a URL is used to fetch the PDF data a standard Fetch API call (or
|
||||||
* Can be a url to where a PDF is located, a typed array (Uint8Array)
|
* XHR as fallback) is used, which means it must follow same origin rules,
|
||||||
* already populated with data or parameter object.
|
* e.g. no cross-domain requests without CORS.
|
||||||
|
*
|
||||||
|
* @param {string|TypedArray|DocumentInitParameters|PDFDataRangeTransport} src -
|
||||||
|
* Can be a URL to where a PDF file is located, a typed array (Uint8Array)
|
||||||
|
* already populated with data or parameter object.
|
||||||
* @returns {PDFDocumentLoadingTask}
|
* @returns {PDFDocumentLoadingTask}
|
||||||
*/
|
*/
|
||||||
function getDocument(src) {
|
function getDocument(src) {
|
||||||
@ -373,12 +377,13 @@ function getDocument(src) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts fetching of specified PDF document/data.
|
* Starts fetching of specified PDF document/data.
|
||||||
|
*
|
||||||
* @param {PDFWorker} worker
|
* @param {PDFWorker} worker
|
||||||
* @param {Object} source
|
* @param {Object} source
|
||||||
* @param {PDFDataRangeTransport} pdfDataRangeTransport
|
* @param {PDFDataRangeTransport} pdfDataRangeTransport
|
||||||
* @param {string} docId Unique document id, used as MessageHandler id.
|
* @param {string} docId - Unique document ID, used in `MessageHandler`.
|
||||||
* @returns {Promise} The promise, which is resolved when worker id of
|
* @returns {Promise} A promise that is resolved when the worker ID of the
|
||||||
* MessageHandler is known.
|
* `MessageHandler` is known.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
|
function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
|
||||||
@ -542,7 +547,7 @@ class PDFDataRangeTransport {
|
|||||||
/**
|
/**
|
||||||
* @param {number} length
|
* @param {number} length
|
||||||
* @param {Uint8Array} initialData
|
* @param {Uint8Array} initialData
|
||||||
* @param {boolean} progressiveDone
|
* @param {boolean} [progressiveDone]
|
||||||
*/
|
*/
|
||||||
constructor(length, initialData, progressiveDone = false) {
|
constructor(length, initialData, progressiveDone = false) {
|
||||||
this.length = length;
|
this.length = length;
|
||||||
@ -614,8 +619,7 @@ class PDFDataRangeTransport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proxy to a PDFDocument in the worker thread. Also, contains commonly used
|
* Proxy to a `PDFDocument` in the worker thread.
|
||||||
* properties that can be read synchronously.
|
|
||||||
*/
|
*/
|
||||||
class PDFDocumentProxy {
|
class PDFDocumentProxy {
|
||||||
constructor(pdfInfo, transport) {
|
constructor(pdfInfo, transport) {
|
||||||
@ -632,7 +636,7 @@ class PDFDocumentProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number} Total number of pages the PDF contains.
|
* @type {number} Total number of pages in the PDF file.
|
||||||
*/
|
*/
|
||||||
get numPages() {
|
get numPages() {
|
||||||
return this._pdfInfo.numPages;
|
return this._pdfInfo.numPages;
|
||||||
@ -648,7 +652,7 @@ class PDFDocumentProxy {
|
|||||||
/**
|
/**
|
||||||
* @param {number} pageNumber - The page number to get. The first page is 1.
|
* @param {number} pageNumber - The page number to get. The first page is 1.
|
||||||
* @returns {Promise<PDFPageProxy>} A promise that is resolved with
|
* @returns {Promise<PDFPageProxy>} A promise that is resolved with
|
||||||
* a {@link PDFPageProxy} object.
|
* a {@link PDFPageProxy} object.
|
||||||
*/
|
*/
|
||||||
getPage(pageNumber) {
|
getPage(pageNumber) {
|
||||||
return this._transport.getPage(pageNumber);
|
return this._transport.getPage(pageNumber);
|
||||||
@ -736,9 +740,9 @@ class PDFDocumentProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Promise<Array<string> | null>} A promise that is
|
* @returns {Promise<Array<string> | null>} A promise that is resolved with
|
||||||
* resolved with an {Array} of all the JavaScript strings in the name tree,
|
* an {Array} of all the JavaScript strings in the name tree, or `null`
|
||||||
* or `null` if no JavaScript exists.
|
* if no JavaScript exists.
|
||||||
*/
|
*/
|
||||||
getJavaScript() {
|
getJavaScript() {
|
||||||
return this._transport.getJavaScript();
|
return this._transport.getJavaScript();
|
||||||
@ -749,29 +753,19 @@ class PDFDocumentProxy {
|
|||||||
* @property {string} title
|
* @property {string} title
|
||||||
* @property {boolean} bold
|
* @property {boolean} bold
|
||||||
* @property {boolean} italic
|
* @property {boolean} italic
|
||||||
* @property {Uint8ClampedArray} color
|
* @property {Uint8ClampedArray} color - The color in RGB format to use for
|
||||||
* @property {any} dest
|
* display purposes.
|
||||||
* @property {string} url
|
* @property {string | Array<any> | null} dest
|
||||||
|
* @property {string | null} url
|
||||||
|
* @property {string | undefined} unsafeUrl
|
||||||
|
* @property {boolean | undefined} newWindow
|
||||||
|
* @property {number | undefined} count
|
||||||
* @property {Array<OutlineNode>} items
|
* @property {Array<OutlineNode>} items
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Promise<Array<OutlineNode>>} A promise that is resolved with
|
* @returns {Promise<Array<OutlineNode>>} A promise that is resolved with an
|
||||||
* an {Array} that is a tree outline (if it has one) of the PDF. The tree is
|
* {Array} that is a tree outline (if it has one) of the PDF file.
|
||||||
* in the format of:
|
|
||||||
* [
|
|
||||||
* {
|
|
||||||
* title: string,
|
|
||||||
* bold: boolean,
|
|
||||||
* italic: boolean,
|
|
||||||
* color: rgb Uint8ClampedArray,
|
|
||||||
* count: integer or undefined,
|
|
||||||
* dest: dest obj,
|
|
||||||
* url: string,
|
|
||||||
* items: array of more items like this
|
|
||||||
* },
|
|
||||||
* ...
|
|
||||||
* ]
|
|
||||||
*/
|
*/
|
||||||
getOutline() {
|
getOutline() {
|
||||||
return this._transport.getOutline();
|
return this._transport.getOutline();
|
||||||
@ -779,8 +773,8 @@ class PDFDocumentProxy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Promise<OptionalContentConfig | null>} A promise that is resolved
|
* @returns {Promise<OptionalContentConfig | null>} A promise that is resolved
|
||||||
* with an {@link OptionalContentConfig} that will have all the optional
|
* with an {@link OptionalContentConfig} that has all the optional content
|
||||||
* content groups (if the document has any).
|
* groups, or `null` if the document does not have any.
|
||||||
*/
|
*/
|
||||||
getOptionalContentConfig() {
|
getOptionalContentConfig() {
|
||||||
return this._transport.getOptionalContentConfig();
|
return this._transport.getOptionalContentConfig();
|
||||||
@ -825,19 +819,19 @@ class PDFDocumentProxy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Promise<PDFDocumentStats>} A promise this is resolved with
|
* @returns {Promise<PDFDocumentStats>} A promise this is resolved with
|
||||||
* current statistics about document structures
|
* current statistics about document structures (see
|
||||||
* (see {@link PDFDocumentStats}).
|
* {@link PDFDocumentStats}).
|
||||||
*/
|
*/
|
||||||
getStats() {
|
getStats() {
|
||||||
return this._transport.getStats();
|
return this._transport.getStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans up resources allocated by the document, on both the main- and
|
* Cleans up resources allocated by the document on both the main and worker
|
||||||
* worker-threads.
|
* threads.
|
||||||
*
|
*
|
||||||
* NOTE: Do not, under any circumstances, call this method when rendering is
|
* NOTE: Do not, under any circumstances, call this method when rendering is
|
||||||
* currently ongoing since that may lead to rendering errors.
|
* currently ongoing since that may lead to rendering errors.
|
||||||
*
|
*
|
||||||
* @returns {Promise} A promise that is resolved when clean-up has finished.
|
* @returns {Promise} A promise that is resolved when clean-up has finished.
|
||||||
*/
|
*/
|
||||||
@ -888,9 +882,9 @@ class PDFDocumentProxy {
|
|||||||
* Page getTextContent parameters.
|
* Page getTextContent parameters.
|
||||||
*
|
*
|
||||||
* @typedef {Object} getTextContentParameters
|
* @typedef {Object} getTextContentParameters
|
||||||
* @property {boolean} normalizeWhitespace - replaces all occurrences of
|
* @property {boolean} normalizeWhitespace - Replaces all occurrences of
|
||||||
* whitespace with standard spaces (0x20). The default value is `false`.
|
* whitespace with standard spaces (0x20). The default value is `false`.
|
||||||
* @property {boolean} disableCombineTextItems - do not attempt to combine
|
* @property {boolean} disableCombineTextItems - Do not attempt to combine
|
||||||
* same line {@link TextItem}'s. The default value is `false`.
|
* same line {@link TextItem}'s. The default value is `false`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -898,7 +892,7 @@ class PDFDocumentProxy {
|
|||||||
* Page text content.
|
* Page text content.
|
||||||
*
|
*
|
||||||
* @typedef {Object} TextContent
|
* @typedef {Object} TextContent
|
||||||
* @property {Array<TextItem>} items - array of {@link TextItem}
|
* @property {Array<TextItem>} items - Array of {@link TextItem} objects.
|
||||||
* @property {Object<string, TextStyle>} styles - {@link TextStyle} objects,
|
* @property {Object<string, TextStyle>} styles - {@link TextStyle} objects,
|
||||||
* indexed by font name.
|
* indexed by font name.
|
||||||
*/
|
*/
|
||||||
@ -907,22 +901,22 @@ class PDFDocumentProxy {
|
|||||||
* Page text content part.
|
* Page text content part.
|
||||||
*
|
*
|
||||||
* @typedef {Object} TextItem
|
* @typedef {Object} TextItem
|
||||||
* @property {string} str - text content.
|
* @property {string} str - Text content.
|
||||||
* @property {string} dir - text direction: 'ttb', 'ltr' or 'rtl'.
|
* @property {string} dir - Text direction: 'ttb', 'ltr' or 'rtl'.
|
||||||
* @property {Array<any>} transform - transformation matrix.
|
* @property {Array<any>} transform - Transformation matrix.
|
||||||
* @property {number} width - width in device space.
|
* @property {number} width - Width in device space.
|
||||||
* @property {number} height - height in device space.
|
* @property {number} height - Height in device space.
|
||||||
* @property {string} fontName - font name used by pdf.js for converted font.
|
* @property {string} fontName - Font name used by PDF.js for converted font.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text style.
|
* Text style.
|
||||||
*
|
*
|
||||||
* @typedef {Object} TextStyle
|
* @typedef {Object} TextStyle
|
||||||
* @property {number} ascent - font ascent.
|
* @property {number} ascent - Font ascent.
|
||||||
* @property {number} descent - font descent.
|
* @property {number} descent - Font descent.
|
||||||
* @property {boolean} vertical - text is in vertical mode.
|
* @property {boolean} vertical - Whether or not the text is in vertical mode.
|
||||||
* @property {string} fontFamily - possible font family
|
* @property {string} fontFamily - The possible font family.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -930,9 +924,8 @@ class PDFDocumentProxy {
|
|||||||
*
|
*
|
||||||
* @typedef {Object} GetAnnotationsParameters
|
* @typedef {Object} GetAnnotationsParameters
|
||||||
* @property {string} intent - Determines the annotations that will be fetched,
|
* @property {string} intent - Determines the annotations that will be fetched,
|
||||||
* can be either 'display' (viewable annotations) or 'print'
|
* can be either 'display' (viewable annotations) or 'print' (printable
|
||||||
* (printable annotations).
|
* annotations). If the parameter is omitted, all annotations are fetched.
|
||||||
* If the parameter is omitted, all annotations are fetched.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -940,48 +933,46 @@ class PDFDocumentProxy {
|
|||||||
*
|
*
|
||||||
* @typedef {Object} RenderParameters
|
* @typedef {Object} RenderParameters
|
||||||
* @property {Object} canvasContext - A 2D context of a DOM Canvas object.
|
* @property {Object} canvasContext - A 2D context of a DOM Canvas object.
|
||||||
* @property {PageViewport} viewport - Rendering viewport obtained by
|
* @property {PageViewport} viewport - Rendering viewport obtained by calling
|
||||||
* calling the `PDFPageProxy.getViewport` method.
|
* the `PDFPageProxy.getViewport` method.
|
||||||
* @property {string} [intent] - Rendering intent, can be 'display' or 'print'
|
* @property {string} [intent] - Rendering intent, can be 'display' or 'print'.
|
||||||
* (default value is 'display').
|
* The default value is 'display'.
|
||||||
* @property {boolean} [enableWebGL] - Enables WebGL accelerated rendering
|
* @property {boolean} [enableWebGL] - Enables WebGL accelerated rendering for
|
||||||
* for some operations. The default value is `false`.
|
* some operations. The default value is `false`.
|
||||||
* @property {boolean} [renderInteractiveForms] - Whether or not
|
* @property {boolean} [renderInteractiveForms] - Whether or not interactive
|
||||||
* interactive form elements are rendered in the display
|
* form elements are rendered in the display layer. If so, we do not render
|
||||||
* layer. If so, we do not render them on canvas as well.
|
* them on the canvas as well.
|
||||||
* @property {Array<any>} [transform] - Additional transform, applied
|
* @property {Array<any>} [transform] - Additional transform, applied just
|
||||||
* just before viewport transform.
|
* before viewport transform.
|
||||||
* @property {Object} [imageLayer] - An object that has beginLayout,
|
* @property {Object} [imageLayer] - An object that has `beginLayout`,
|
||||||
* endLayout and appendImage functions.
|
* `endLayout` and `appendImage` functions.
|
||||||
* @property {Object} [canvasFactory] - The factory instance that will be used
|
* @property {Object} [canvasFactory] - The factory instance that will be used
|
||||||
* when creating canvases. The default value is
|
* when creating canvases. The default value is {new DOMCanvasFactory()}.
|
||||||
* {new DOMCanvasFactory()}.
|
* @property {Object | string} [background] - Background to use for the canvas.
|
||||||
* @property {Object} [background] - Background to use for the canvas.
|
* Any valid `canvas.fillStyle` can be used: a `DOMString` parsed as CSS
|
||||||
* Can use any valid canvas.fillStyle: A DOMString parsed as
|
* <color> value, a `CanvasGradient` object (a linear or radial gradient) or
|
||||||
* CSS <color> value, a CanvasGradient object (a linear or
|
* a `CanvasPattern` object (a repetitive image). The default value is
|
||||||
* radial gradient) or a CanvasPattern object (a repetitive
|
* 'rgb(255,255,255)'.
|
||||||
* image). The default value is 'rgb(255,255,255)'.
|
* @property {AnnotationStorage} [annotationStorage] - Storage for annotation
|
||||||
* @property {Object} [annotationStorage] - Storage for annotation data in
|
* data in forms.
|
||||||
* forms.
|
* @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -
|
||||||
* @property {Promise} [optionalContentConfigPromise] - A promise that should
|
* A promise that should resolve with an {@link OptionalContentConfig}
|
||||||
* resolve with an {OptionalContentConfig} created from
|
* created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`,
|
||||||
* PDFDocumentProxy.getOptionalContentConfig. If null, the
|
* the configuration will be fetched automatically with the default visibility
|
||||||
* config will be automatically fetched with the default
|
* states set.
|
||||||
* visibility states set.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PDF page operator list.
|
* PDF page operator list.
|
||||||
*
|
*
|
||||||
* @typedef {Object} PDFOperatorList
|
* @typedef {Object} PDFOperatorList
|
||||||
* @property {Array<number>} fnArray - Array containing the operator
|
* @property {Array<number>} fnArray - Array containing the operator functions.
|
||||||
* functions.
|
|
||||||
* @property {Array<any>} argsArray - Array containing the arguments of the
|
* @property {Array<any>} argsArray - Array containing the arguments of the
|
||||||
* functions.
|
* functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proxy to a PDFPage in the worker thread.
|
* Proxy to a `PDFPage` in the worker thread.
|
||||||
*/
|
*/
|
||||||
class PDFPageProxy {
|
class PDFPageProxy {
|
||||||
constructor(pageIndex, pageInfo, transport, pdfBug = false) {
|
constructor(pageIndex, pageInfo, transport, pdfBug = false) {
|
||||||
@ -1076,9 +1067,10 @@ class PDFPageProxy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Begins the process of rendering a page to the desired context.
|
* Begins the process of rendering a page to the desired context.
|
||||||
|
*
|
||||||
* @param {RenderParameters} params Page render parameters.
|
* @param {RenderParameters} params Page render parameters.
|
||||||
* @returns {RenderTask} An object that contains the promise, which
|
* @returns {RenderTask} An object that contains a promise that is
|
||||||
* is resolved when the page finishes rendering.
|
* resolved when the page finishes rendering.
|
||||||
*/
|
*/
|
||||||
render({
|
render({
|
||||||
canvasContext,
|
canvasContext,
|
||||||
@ -1271,7 +1263,7 @@ class PDFPageProxy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {getTextContentParameters} params - getTextContent parameters.
|
* @param {getTextContentParameters} params - getTextContent parameters.
|
||||||
* @returns {ReadableStream} ReadableStream to read textContent chunks.
|
* @returns {ReadableStream} Stream for reading text content chunks.
|
||||||
*/
|
*/
|
||||||
streamTextContent({
|
streamTextContent({
|
||||||
normalizeWhitespace = false,
|
normalizeWhitespace = false,
|
||||||
@ -1297,8 +1289,8 @@ class PDFPageProxy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {getTextContentParameters} params - getTextContent parameters.
|
* @param {getTextContentParameters} params - getTextContent parameters.
|
||||||
* @returns {Promise<TextContent>} That is resolved a {@link TextContent}
|
* @returns {Promise<TextContent>} A promise that is resolved with a
|
||||||
* object that represent the page text content.
|
* {@link TextContent} object that represents the page's text content.
|
||||||
*/
|
*/
|
||||||
getTextContent(params = {}) {
|
getTextContent(params = {}) {
|
||||||
const readableStream = this.streamTextContent(params);
|
const readableStream = this.streamTextContent(params);
|
||||||
@ -1358,9 +1350,10 @@ class PDFPageProxy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans up resources allocated by the page.
|
* Cleans up resources allocated by the page.
|
||||||
|
*
|
||||||
* @param {boolean} [resetStats] - Reset page stats, if enabled.
|
* @param {boolean} [resetStats] - Reset page stats, if enabled.
|
||||||
* The default value is `false`.
|
* The default value is `false`.
|
||||||
* @returns {boolean} Indicating if clean-up was successfully run.
|
* @returns {boolean} Indicates if clean-up was successfully run.
|
||||||
*/
|
*/
|
||||||
cleanup(resetStats = false) {
|
cleanup(resetStats = false) {
|
||||||
this.pendingCleanup = true;
|
this.pendingCleanup = true;
|
||||||
@ -1641,9 +1634,9 @@ class LoopbackPort {
|
|||||||
/**
|
/**
|
||||||
* @typedef {Object} PDFWorkerParameters
|
* @typedef {Object} PDFWorkerParameters
|
||||||
* @property {string} [name] - The name of the worker.
|
* @property {string} [name] - The name of the worker.
|
||||||
* @property {Object} [port] - The `workerPort`.
|
* @property {Object} [port] - The `workerPort` object.
|
||||||
* @property {number} [verbosity] - Controls the logging level; the
|
* @property {number} [verbosity] - Controls the logging level; the
|
||||||
* constants from {VerbosityLevel} should be used.
|
* constants from {@link VerbosityLevel} should be used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @type {any} */
|
/** @type {any} */
|
||||||
@ -1763,7 +1756,7 @@ const PDFWorker = (function PDFWorkerClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PDF.js web worker abstraction, which controls the instantiation of PDF
|
* PDF.js web worker abstraction that controls the instantiation of PDF
|
||||||
* documents. Message handlers are used to pass information from the main
|
* documents. Message handlers are used to pass information from the main
|
||||||
* thread to the worker thread and vice versa. If the creation of a web
|
* thread to the worker thread and vice versa. If the creation of a web
|
||||||
* worker is not possible, a "fake" worker will be used instead.
|
* worker is not possible, a "fake" worker will be used instead.
|
||||||
@ -2002,7 +1995,7 @@ const PDFWorker = (function PDFWorkerClosure() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {PDFWorkerParameters} params - The worker initialization
|
* @param {PDFWorkerParameters} params - The worker initialization
|
||||||
* parameters.
|
* parameters.
|
||||||
*/
|
*/
|
||||||
static fromPort(params) {
|
static fromPort(params) {
|
||||||
if (!params || !params.port) {
|
if (!params || !params.port) {
|
||||||
@ -2693,7 +2686,6 @@ class PDFObjects {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows controlling of the rendering tasks.
|
* Allows controlling of the rendering tasks.
|
||||||
* @alias RenderTask
|
|
||||||
*/
|
*/
|
||||||
class RenderTask {
|
class RenderTask {
|
||||||
constructor(internalRenderTask) {
|
constructor(internalRenderTask) {
|
||||||
|
Loading…
Reference in New Issue
Block a user