@types/pdfjs-dist
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -47,7 +47,199 @@ // Type definitions for PDF.js v2.1 | ||
interface PDFDataRangeTransportListener { | ||
(loaded: number, total: number): void | ||
} | ||
declare enum VerbosityLevel { | ||
ERRORS = 0, | ||
WARNINGS= 1, | ||
INFOS= 5, | ||
} | ||
declare class PDFDataRangeTransport { | ||
constructor(length: number, initialData: Uint8Array|BufferSource, progressiveDone?: boolean); | ||
addRangeListener(listener: PDFDataRangeTransportListener):void | ||
addProgressListener(listener: PDFDataRangeTransportListener): void | ||
addProgressiveReadListener(listener: PDFDataRangeTransportListener): void | ||
addProgressiveDoneListener(listener: PDFDataRangeTransportListener): void | ||
onDataRange(begin: number, chunk: unknown): void | ||
onDataProgress(loaded: number, total: number): void | ||
onDataProgressiveRead(chunk: unknown): void | ||
onDataProgressiveDone(): void | ||
transportReady() : void | ||
requestDataRange(begin: number, end: number): void | ||
abort(): void | ||
} | ||
interface PDFWorkerParameters { | ||
name?: string | ||
port?: any | ||
verbosity?: VerbosityLevel | ||
} | ||
declare class PDFWorker { | ||
constructor(params?: PDFWorkerParameters) | ||
readonly promise: Promise<unknown> | ||
readonly port: any |null | ||
readonly messageHandler: unknown | null | ||
destroy(): void | ||
static fromPort(params?: PDFWorkerParameters): PDFWorker | ||
static getWorkerSrc(): string | ||
} | ||
declare enum CMapCompressionType { | ||
NONE = 0, | ||
BINARY= 1, | ||
STREAM= 2, | ||
} | ||
interface CMapReaderFactory { | ||
new (params: {baseUrl: string, isCompressed: boolean}): CMapReader | ||
} | ||
interface CMapReader { | ||
fetch(params: {name: string}): Promise<{ | ||
cMapData: any, | ||
compressionType: CMapCompressionType | ||
}> | ||
} | ||
interface PDFSource { | ||
/** The URL of the PDF. */ | ||
url?: string; | ||
data?: Uint8Array; | ||
httpHeaders?: any; | ||
/** | ||
* Binary PDF data. Use typed arrays | ||
* (Uint8Array) to improve the memory usage. If PDF data is BASE64-encoded, | ||
* use atob() to convert it to a binary string first. | ||
*/ | ||
data?: Uint8Array | BufferSource | string; | ||
/** | ||
* Basic authentication headers. | ||
*/ | ||
httpHeaders?: { | ||
[key: string]: string | ||
}; | ||
/** | ||
* For decrypting password-protected PDFs. | ||
*/ | ||
password?: string; | ||
/** | ||
* Indicates whether or not cross-site | ||
* Access-Control requests should be made using credentials such as cookies | ||
* or authorization headers. The default is false. | ||
*/ | ||
withCredentials?: boolean; | ||
/* | ||
* A typed array with the first portion or | ||
* all of the pdf data. Used by the extension since some data is already | ||
* loaded before the switch to range requests. */ | ||
initialData?: Uint8Array | BufferSource; | ||
/* | ||
* The PDF file length. It's used for progress | ||
* reports and range requests operations. | ||
*/ | ||
length?: number; | ||
/** range */ | ||
range?: PDFDataRangeTransport; | ||
/** | ||
* Optional parameter to specify | ||
* maximum number of bytes fetched per range request. The default value is | ||
* 2^16 = 65536. */ | ||
rangeChunkSize?: number | ||
/** | ||
* The worker that will be used for | ||
* the loading and parsing of the PDF data. | ||
*/ | ||
worker?: PDFWorker; | ||
/** | ||
* Controls the logging level; the | ||
* constants from {VerbosityLevel} should be used. | ||
*/ | ||
verbosity?: number; | ||
/** | ||
* The base URL of the document, | ||
* used when attempting to recover valid absolute URLs for annotations, and | ||
* outline items, that (incorrectly) only specify relative URLs. | ||
*/ | ||
docBaseUrl?: string; | ||
/** | ||
* Strategy for | ||
* decoding certain (simple) JPEG images in the browser. This is useful for | ||
* environments without DOM image and canvas support, such as e.g. Node.js. | ||
* Valid values are 'decode', 'display' or 'none'; where 'decode' is intended | ||
* for browsers with full image/canvas support, 'display' for environments | ||
* with limited image support through stubs (useful for SVG conversion), | ||
* and 'none' where JPEG images will be decoded entirely by PDF.js. | ||
* The default value is 'decode'. | ||
*/ | ||
nativeImageDecoderSupport?: "decode"|"display"|"none" | ||
/** | ||
* The URL where the predefined | ||
* Adobe CMaps are located. Include trailing slash. */ | ||
cMapUrl?: string | ||
/** | ||
* Specifies if the Adobe CMaps are | ||
* binary packed. */ | ||
cMapPacked?: boolean | ||
/** | ||
* The factory that will be | ||
* used when reading built-in CMap files. Providing a custom factory is useful | ||
* for environments without `XMLHttpRequest` support, such as e.g. Node.js. | ||
* The default value is {DOMCMapReaderFactory}. | ||
*/ | ||
CMapReaderFactory?: any | ||
/** | ||
* Reject certain promises, e.g. | ||
* `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated | ||
* PDF data cannot be successfully parsed, instead of attempting to recover | ||
* whatever possible of the data. The default value is `false`. | ||
*/ | ||
stopAtErrors?: boolean | ||
/** | ||
* The maximum allowed image size | ||
* in total pixels, i.e. width * height. Images above this value will not be | ||
* rendered. Use -1 for no limit, which is also the default value. | ||
*/ | ||
maxImageSize?: number | ||
/** | ||
* Determines if we can eval | ||
* strings as JS. Primarily used to improve performance of font rendering, | ||
* and when parsing PDF functions. The default value is `true`. | ||
*/ | ||
isEvalSupported?: boolean | ||
/** | ||
* By default fonts are | ||
* converted to OpenType fonts and loaded via font face rules. If disabled, | ||
* fonts will be rendered using a built-in font renderer that constructs the | ||
* glyphs with primitive path commands. The default value is `false`. | ||
*/ | ||
disableFontFace?: boolean | ||
/** | ||
* Disable range request loading | ||
* of PDF files. When enabled, and if the server supports partial content | ||
* requests, then the PDF will be fetched in chunks. | ||
* The default value is `false`. | ||
*/ | ||
disableRange?: boolean | ||
/** | ||
* Disable streaming of PDF file | ||
* data. By default PDF.js attempts to load PDFs in chunks. | ||
* The default value is `false`. | ||
*/ | ||
disableStream?: boolean | ||
/** | ||
* Disable pre-fetching of PDF | ||
* 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. | ||
* 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. | ||
*/ | ||
disableAutoFetch?: boolean | ||
/** | ||
* Disable the use of | ||
* `URL.createObjectURL`, for compatibility with older browsers. | ||
* The default value is `false`. | ||
*/ | ||
disableCreateObjectURL?: boolean | ||
/** | ||
* Enables special hooks for debugging | ||
* PDF.js (see `web/debugger.js`). The default value is `false`. | ||
*/ | ||
pdfBug?: boolean | ||
} | ||
@@ -465,4 +657,4 @@ | ||
declare function getDocument( | ||
source: string, | ||
pdfDataRangeTransport?: any, | ||
url: string, | ||
pdfDataRangeTransport?: PDFDataRangeTransport, | ||
passwordCallback?: (fn: (password: string) => void, reason: string) => string, | ||
@@ -473,4 +665,4 @@ progressCallback?: (progressData: PDFProgressData) => void | ||
declare function getDocument( | ||
source: Uint8Array, | ||
pdfDataRangeTransport?: any, | ||
data: Uint8Array | BufferSource, | ||
pdfDataRangeTransport?: PDFDataRangeTransport, | ||
passwordCallback?: (fn: (password: string) => void, reason: string) => string, | ||
@@ -482,5 +674,5 @@ progressCallback?: (progressData: PDFProgressData) => void | ||
source: PDFSource, | ||
pdfDataRangeTransport?: any, | ||
pdfDataRangeTransport?: PDFDataRangeTransport, | ||
passwordCallback?: (fn: (password: string) => void, reason: string) => string, | ||
progressCallback?: (progressData: PDFProgressData) => void | ||
): PDFLoadingTask<PDFDocumentProxy>; |
{ | ||
"name": "@types/pdfjs-dist", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "TypeScript definitions for PDF.js", | ||
@@ -27,4 +27,4 @@ "license": "MIT", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "e9281a559ce83770a91fa888b8965ea0b4160e613e44563fa2b4f2c9137978fe", | ||
"typesPublisherContentHash": "384a146c42ace9bc0a2fe6d7ee7cba79199b2af7313eb5ca5ff31c3ba344f97a", | ||
"typeScriptVersion": "3.0" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Mon, 09 Sep 2019 14:08:32 GMT | ||
* Last updated: Wed, 02 Oct 2019 22:17:23 GMT | ||
* Dependencies: none | ||
@@ -14,0 +14,0 @@ * Global values: none |
23289
593