api.d.ts 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190
  1. export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
  2. /**
  3. * Document initialization / loading parameters object.
  4. */
  5. export type DocumentInitParameters = {
  6. /**
  7. * - The URL of the PDF.
  8. */
  9. url?: string | URL | undefined;
  10. /**
  11. * - Binary PDF data. Use
  12. * typed arrays (Uint8Array) to improve the memory usage. If PDF data is
  13. * BASE64-encoded, use `atob()` to convert it to a binary string first.
  14. */
  15. data?: string | number[] | TypedArray | undefined;
  16. /**
  17. * - Basic authentication headers.
  18. */
  19. httpHeaders?: Object | undefined;
  20. /**
  21. * - Indicates whether or not
  22. * cross-site Access-Control requests should be made using credentials such
  23. * as cookies or authorization headers. The default is `false`.
  24. */
  25. withCredentials?: boolean | undefined;
  26. /**
  27. * - For decrypting password-protected PDFs.
  28. */
  29. password?: string | undefined;
  30. /**
  31. * - A typed array with the first portion
  32. * or all of the pdf data. Used by the extension since some data is already
  33. * loaded before the switch to range requests.
  34. */
  35. initialData?: TypedArray | undefined;
  36. /**
  37. * - The PDF file length. It's used for progress
  38. * reports and range requests operations.
  39. */
  40. length?: number | undefined;
  41. /**
  42. * - Allows for using a custom range
  43. * transport implementation.
  44. */
  45. range?: PDFDataRangeTransport | undefined;
  46. /**
  47. * - Specify maximum number of bytes fetched
  48. * per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.
  49. */
  50. rangeChunkSize?: number | undefined;
  51. /**
  52. * - The worker that will be used for loading and
  53. * parsing the PDF data.
  54. */
  55. worker?: any;
  56. /**
  57. * - Controls the logging level; the constants
  58. * from {@link VerbosityLevel} should be used.
  59. */
  60. verbosity?: number | undefined;
  61. /**
  62. * - The base URL of the document, used when
  63. * attempting to recover valid absolute URLs for annotations, and outline
  64. * items, that (incorrectly) only specify relative URLs.
  65. */
  66. docBaseUrl?: string | undefined;
  67. /**
  68. * - The URL where the predefined Adobe CMaps are
  69. * located. Include the trailing slash.
  70. */
  71. cMapUrl?: string | undefined;
  72. /**
  73. * - Specifies if the Adobe CMaps are binary
  74. * packed or not.
  75. */
  76. cMapPacked?: boolean | undefined;
  77. /**
  78. * - The factory that will be used when
  79. * reading built-in CMap files. Providing a custom factory is useful for
  80. * environments without Fetch API or `XMLHttpRequest` support, such as
  81. * Node.js. The default value is {DOMCMapReaderFactory}.
  82. */
  83. CMapReaderFactory?: Object | undefined;
  84. /**
  85. * - Reject certain promises, e.g.
  86. * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
  87. * PDF data cannot be successfully parsed, instead of attempting to recover
  88. * whatever possible of the data. The default value is `false`.
  89. */
  90. stopAtErrors?: boolean | undefined;
  91. /**
  92. * - The maximum allowed image size in total
  93. * pixels, i.e. width * height. Images above this value will not be rendered.
  94. * Use -1 for no limit, which is also the default value.
  95. */
  96. maxImageSize?: number | undefined;
  97. /**
  98. * - Determines if we can evaluate strings
  99. * as JavaScript. Primarily used to improve performance of font rendering, and
  100. * when parsing PDF functions. The default value is `true`.
  101. */
  102. isEvalSupported?: boolean | undefined;
  103. /**
  104. * - By default fonts are converted to
  105. * OpenType fonts and loaded via `@font-face` rules. If disabled, fonts will
  106. * be rendered using a built-in font renderer that constructs the glyphs with
  107. * primitive path commands. The default value is `false`.
  108. */
  109. disableFontFace?: boolean | undefined;
  110. /**
  111. * - Include additional properties,
  112. * which are unused during rendering of PDF documents, when exporting the
  113. * parsed font data from the worker-thread. This may be useful for debugging
  114. * purposes (and backwards compatibility), but note that it will lead to
  115. * increased memory usage. The default value is `false`.
  116. */
  117. fontExtraProperties?: boolean | undefined;
  118. /**
  119. * - Render Xfa forms if any.
  120. * The default value is `false`.
  121. */
  122. enableXfa?: boolean | undefined;
  123. /**
  124. * - Specify an explicit document
  125. * context to create elements with and to load resources, such as fonts,
  126. * into. Defaults to the current document.
  127. */
  128. ownerDocument?: HTMLDocument | undefined;
  129. /**
  130. * - Disable range request loading of PDF
  131. * files. When enabled, and if the server supports partial content requests,
  132. * then the PDF will be fetched in chunks. The default value is `false`.
  133. */
  134. disableRange?: boolean | undefined;
  135. /**
  136. * - Disable streaming of PDF file data.
  137. * By default PDF.js attempts to load PDF files in chunks. The default value
  138. * is `false`.
  139. */
  140. disableStream?: boolean | undefined;
  141. /**
  142. * - Disable pre-fetching of PDF file
  143. * data. When range requests are enabled PDF.js will automatically keep
  144. * fetching more data even if it isn't needed to display the current page.
  145. * The default value is `false`.
  146. *
  147. * NOTE: It is also necessary to disable streaming, see above, in order for
  148. * disabling of pre-fetching to work correctly.
  149. */
  150. disableAutoFetch?: boolean | undefined;
  151. /**
  152. * - Enables special hooks for debugging PDF.js
  153. * (see `web/debugger.js`). The default value is `false`.
  154. */
  155. pdfBug?: boolean | undefined;
  156. };
  157. export type IPDFStreamFactory = Function;
  158. /**
  159. * The loading task controls the operations required to load a PDF document
  160. * (such as network requests) and provides a way to listen for completion,
  161. * after which individual pages can be rendered.
  162. */
  163. export type PDFDocumentLoadingTask = {
  164. /**
  165. * - Unique identifier for the document loading task.
  166. */
  167. docId: string;
  168. /**
  169. * - Whether the loading task is destroyed or not.
  170. */
  171. destroyed: boolean;
  172. /**
  173. * - Callback to request a password if a wrong
  174. * or no password was provided. The callback receives two parameters: a
  175. * function that should be called with the new password, and a reason (see
  176. * {@link PasswordResponses}).
  177. */
  178. onPassword?: Function | undefined;
  179. /**
  180. * - Callback to be able to monitor the
  181. * loading progress of the PDF file (necessary to implement e.g. a loading
  182. * bar). The callback receives an {Object} with the properties `loaded`
  183. * ({number}) and `total` ({number}) that indicate how many bytes are loaded.
  184. */
  185. onProgress?: Function | undefined;
  186. /**
  187. * - Callback for when an
  188. * unsupported feature is used in the PDF document. The callback receives an
  189. * {@link UNSUPPORTED_FEATURES} argument.
  190. */
  191. onUnsupportedFeature?: Function | undefined;
  192. /**
  193. * - Promise for document loading
  194. * task completion.
  195. */
  196. promise: Promise<PDFDocumentProxy>;
  197. /**
  198. * - Abort all network requests and destroy
  199. * the worker. Returns a promise that is resolved when destruction is
  200. * completed.
  201. */
  202. destroy: Function;
  203. };
  204. export type OutlineNode = {
  205. title: string;
  206. bold: boolean;
  207. italic: boolean;
  208. /**
  209. * - The color in RGB format to use for
  210. * display purposes.
  211. */
  212. color: Uint8ClampedArray;
  213. dest: string | Array<any> | null;
  214. url: string | null;
  215. unsafeUrl: string | undefined;
  216. newWindow: boolean | undefined;
  217. count: number | undefined;
  218. items: Array<OutlineNode>;
  219. };
  220. /**
  221. * Properties correspond to Table 321 of the PDF 32000-1:2008 spec.
  222. */
  223. export type MarkInfo = {
  224. Marked: boolean;
  225. UserProperties: boolean;
  226. Suspects: boolean;
  227. };
  228. export type PDFDocumentStats = {
  229. /**
  230. * - Used stream types in the
  231. * document (an item is set to true if specific stream ID was used in the
  232. * document).
  233. */
  234. streamTypes: {
  235. [x: string]: boolean;
  236. };
  237. /**
  238. * - Used font types in the
  239. * document (an item is set to true if specific font ID was used in the
  240. * document).
  241. */
  242. fontTypes: {
  243. [x: string]: boolean;
  244. };
  245. };
  246. /**
  247. * Page getViewport parameters.
  248. */
  249. export type GetViewportParameters = {
  250. /**
  251. * - The desired scale of the viewport.
  252. */
  253. scale: number;
  254. /**
  255. * - The desired rotation, in degrees, of
  256. * the viewport. If omitted it defaults to the page rotation.
  257. */
  258. rotation?: number | undefined;
  259. /**
  260. * - The horizontal, i.e. x-axis, offset.
  261. * The default value is `0`.
  262. */
  263. offsetX?: number | undefined;
  264. /**
  265. * - The vertical, i.e. y-axis, offset.
  266. * The default value is `0`.
  267. */
  268. offsetY?: number | undefined;
  269. /**
  270. * - If true, the y-axis will not be
  271. * flipped. The default value is `false`.
  272. */
  273. dontFlip?: boolean | undefined;
  274. };
  275. /**
  276. * Page getTextContent parameters.
  277. */
  278. export type getTextContentParameters = {
  279. /**
  280. * - Replaces all occurrences of
  281. * whitespace with standard spaces (0x20). The default value is `false`.
  282. */
  283. normalizeWhitespace: boolean;
  284. /**
  285. * - Do not attempt to combine
  286. * same line {@link TextItem}'s. The default value is `false`.
  287. */
  288. disableCombineTextItems: boolean;
  289. };
  290. /**
  291. * Page text content.
  292. */
  293. export type TextContent = {
  294. /**
  295. * - Array of {@link TextItem} objects.
  296. */
  297. items: Array<TextItem>;
  298. /**
  299. * - {@link TextStyle} objects,
  300. * indexed by font name.
  301. */
  302. styles: {
  303. [x: string]: TextStyle;
  304. };
  305. };
  306. /**
  307. * Page text content part.
  308. */
  309. export type TextItem = {
  310. /**
  311. * - Text content.
  312. */
  313. str: string;
  314. /**
  315. * - Text direction: 'ttb', 'ltr' or 'rtl'.
  316. */
  317. dir: string;
  318. /**
  319. * - Transformation matrix.
  320. */
  321. transform: Array<any>;
  322. /**
  323. * - Width in device space.
  324. */
  325. width: number;
  326. /**
  327. * - Height in device space.
  328. */
  329. height: number;
  330. /**
  331. * - Font name used by PDF.js for converted font.
  332. */
  333. fontName: string;
  334. };
  335. /**
  336. * Text style.
  337. */
  338. export type TextStyle = {
  339. /**
  340. * - Font ascent.
  341. */
  342. ascent: number;
  343. /**
  344. * - Font descent.
  345. */
  346. descent: number;
  347. /**
  348. * - Whether or not the text is in vertical mode.
  349. */
  350. vertical: boolean;
  351. /**
  352. * - The possible font family.
  353. */
  354. fontFamily: string;
  355. };
  356. /**
  357. * Page annotation parameters.
  358. */
  359. export type GetAnnotationsParameters = {
  360. /**
  361. * - Determines the annotations that will be fetched,
  362. * can be either 'display' (viewable annotations) or 'print' (printable
  363. * annotations). If the parameter is omitted, all annotations are fetched.
  364. */
  365. intent: string;
  366. };
  367. /**
  368. * Page render parameters.
  369. */
  370. export type RenderParameters = {
  371. /**
  372. * - A 2D context of a DOM Canvas object.
  373. */
  374. canvasContext: Object;
  375. /**
  376. * - Rendering viewport obtained by calling
  377. * the `PDFPageProxy.getViewport` method.
  378. */
  379. viewport: PageViewport;
  380. /**
  381. * - Rendering intent, can be 'display' or 'print'.
  382. * The default value is 'display'.
  383. */
  384. intent?: string | undefined;
  385. /**
  386. * - Enables WebGL accelerated rendering for
  387. * some operations. The default value is `false`.
  388. */
  389. enableWebGL?: boolean | undefined;
  390. /**
  391. * - Whether or not interactive
  392. * form elements are rendered in the display layer. If so, we do not render
  393. * them on the canvas as well.
  394. */
  395. renderInteractiveForms?: boolean | undefined;
  396. /**
  397. * - Additional transform, applied just
  398. * before viewport transform.
  399. */
  400. transform?: any[] | undefined;
  401. /**
  402. * - An object that has `beginLayout`,
  403. * `endLayout` and `appendImage` functions.
  404. */
  405. imageLayer?: Object | undefined;
  406. /**
  407. * - The factory instance that will be used
  408. * when creating canvases. The default value is {new DOMCanvasFactory()}.
  409. */
  410. canvasFactory?: Object | undefined;
  411. /**
  412. * - Background to use for the canvas.
  413. * Any valid `canvas.fillStyle` can be used: a `DOMString` parsed as CSS
  414. * <color> value, a `CanvasGradient` object (a linear or radial gradient) or
  415. * a `CanvasPattern` object (a repetitive image). The default value is
  416. * 'rgb(255,255,255)'.
  417. */
  418. background?: string | Object | undefined;
  419. /**
  420. * - Storage for annotation
  421. * data in forms.
  422. */
  423. annotationStorage?: AnnotationStorage | undefined;
  424. /**
  425. * -
  426. * A promise that should resolve with an {@link OptionalContentConfig}
  427. * created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`,
  428. * the configuration will be fetched automatically with the default visibility
  429. * states set.
  430. */
  431. optionalContentConfigPromise?: Promise<OptionalContentConfig> | undefined;
  432. };
  433. /**
  434. * PDF page operator list.
  435. */
  436. export type PDFOperatorList = {
  437. /**
  438. * - Array containing the operator functions.
  439. */
  440. fnArray: Array<number>;
  441. /**
  442. * - Array containing the arguments of the
  443. * functions.
  444. */
  445. argsArray: Array<any>;
  446. };
  447. export type PDFWorkerParameters = {
  448. /**
  449. * - The name of the worker.
  450. */
  451. name?: string | undefined;
  452. /**
  453. * - The `workerPort` object.
  454. */
  455. port?: Object | undefined;
  456. /**
  457. * - Controls the logging level; the
  458. * constants from {@link VerbosityLevel} should be used.
  459. */
  460. verbosity?: number | undefined;
  461. };
  462. /** @type {string} */
  463. export const build: string;
  464. export const DefaultCanvasFactory: typeof DOMCanvasFactory | {
  465. new (): {};
  466. };
  467. export const DefaultCMapReaderFactory: typeof DOMCMapReaderFactory | {
  468. new (): {};
  469. };
  470. /**
  471. * @typedef { Int8Array | Uint8Array | Uint8ClampedArray |
  472. * Int16Array | Uint16Array |
  473. * Int32Array | Uint32Array | Float32Array |
  474. * Float64Array
  475. * } TypedArray
  476. */
  477. /**
  478. * Document initialization / loading parameters object.
  479. *
  480. * @typedef {Object} DocumentInitParameters
  481. * @property {string|URL} [url] - The URL of the PDF.
  482. * @property {TypedArray|Array<number>|string} [data] - Binary PDF data. Use
  483. * typed arrays (Uint8Array) to improve the memory usage. If PDF data is
  484. * BASE64-encoded, use `atob()` to convert it to a binary string first.
  485. * @property {Object} [httpHeaders] - Basic authentication headers.
  486. * @property {boolean} [withCredentials] - Indicates whether or not
  487. * cross-site Access-Control requests should be made using credentials such
  488. * as cookies or authorization headers. The default is `false`.
  489. * @property {string} [password] - For decrypting password-protected PDFs.
  490. * @property {TypedArray} [initialData] - A typed array with the first portion
  491. * or all of the pdf data. Used by the extension since some data is already
  492. * loaded before the switch to range requests.
  493. * @property {number} [length] - The PDF file length. It's used for progress
  494. * reports and range requests operations.
  495. * @property {PDFDataRangeTransport} [range] - Allows for using a custom range
  496. * transport implementation.
  497. * @property {number} [rangeChunkSize] - Specify maximum number of bytes fetched
  498. * per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.
  499. * @property {PDFWorker} [worker] - The worker that will be used for loading and
  500. * parsing the PDF data.
  501. * @property {number} [verbosity] - Controls the logging level; the constants
  502. * from {@link VerbosityLevel} should be used.
  503. * @property {string} [docBaseUrl] - The base URL of the document, used when
  504. * attempting to recover valid absolute URLs for annotations, and outline
  505. * items, that (incorrectly) only specify relative URLs.
  506. * @property {string} [cMapUrl] - The URL where the predefined Adobe CMaps are
  507. * located. Include the trailing slash.
  508. * @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are binary
  509. * packed or not.
  510. * @property {Object} [CMapReaderFactory] - The factory that will be used when
  511. * reading built-in CMap files. Providing a custom factory is useful for
  512. * environments without Fetch API or `XMLHttpRequest` support, such as
  513. * Node.js. The default value is {DOMCMapReaderFactory}.
  514. * @property {boolean} [stopAtErrors] - Reject certain promises, e.g.
  515. * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
  516. * PDF data cannot be successfully parsed, instead of attempting to recover
  517. * whatever possible of the data. The default value is `false`.
  518. * @property {number} [maxImageSize] - The maximum allowed image size in total
  519. * pixels, i.e. width * height. Images above this value will not be rendered.
  520. * Use -1 for no limit, which is also the default value.
  521. * @property {boolean} [isEvalSupported] - Determines if we can evaluate strings
  522. * as JavaScript. Primarily used to improve performance of font rendering, and
  523. * when parsing PDF functions. The default value is `true`.
  524. * @property {boolean} [disableFontFace] - By default fonts are converted to
  525. * OpenType fonts and loaded via `@font-face` rules. If disabled, fonts will
  526. * be rendered using a built-in font renderer that constructs the glyphs with
  527. * primitive path commands. The default value is `false`.
  528. * @property {boolean} [fontExtraProperties] - Include additional properties,
  529. * which are unused during rendering of PDF documents, when exporting the
  530. * parsed font data from the worker-thread. This may be useful for debugging
  531. * purposes (and backwards compatibility), but note that it will lead to
  532. * increased memory usage. The default value is `false`.
  533. * @property {boolean} [enableXfa] - Render Xfa forms if any.
  534. * The default value is `false`.
  535. * @property {HTMLDocument} [ownerDocument] - Specify an explicit document
  536. * context to create elements with and to load resources, such as fonts,
  537. * into. Defaults to the current document.
  538. * @property {boolean} [disableRange] - Disable range request loading of PDF
  539. * files. When enabled, and if the server supports partial content requests,
  540. * then the PDF will be fetched in chunks. The default value is `false`.
  541. * @property {boolean} [disableStream] - Disable streaming of PDF file data.
  542. * By default PDF.js attempts to load PDF files in chunks. The default value
  543. * is `false`.
  544. * @property {boolean} [disableAutoFetch] - Disable pre-fetching of PDF file
  545. * data. When range requests are enabled PDF.js will automatically keep
  546. * fetching more data even if it isn't needed to display the current page.
  547. * The default value is `false`.
  548. *
  549. * NOTE: It is also necessary to disable streaming, see above, in order for
  550. * disabling of pre-fetching to work correctly.
  551. * @property {boolean} [pdfBug] - Enables special hooks for debugging PDF.js
  552. * (see `web/debugger.js`). The default value is `false`.
  553. */
  554. /**
  555. * This is the main entry point for loading a PDF and interacting with it.
  556. *
  557. * NOTE: If a URL is used to fetch the PDF data a standard Fetch API call (or
  558. * XHR as fallback) is used, which means it must follow same origin rules,
  559. * e.g. no cross-domain requests without CORS.
  560. *
  561. * @param {string|URL|TypedArray|PDFDataRangeTransport|DocumentInitParameters}
  562. * src - Can be a URL where a PDF file is located, a typed array (Uint8Array)
  563. * already populated with data, or a parameter object.
  564. * @returns {PDFDocumentLoadingTask}
  565. */
  566. export function getDocument(src: string | URL | TypedArray | PDFDataRangeTransport | DocumentInitParameters): PDFDocumentLoadingTask;
  567. export class LoopbackPort {
  568. _listeners: any[];
  569. _deferred: Promise<undefined>;
  570. postMessage(obj: any, transfers: any): void;
  571. addEventListener(name: any, listener: any): void;
  572. removeEventListener(name: any, listener: any): void;
  573. terminate(): void;
  574. }
  575. /**
  576. * Abstract class to support range requests file loading.
  577. */
  578. export class PDFDataRangeTransport {
  579. /**
  580. * @param {number} length
  581. * @param {Uint8Array} initialData
  582. * @param {boolean} [progressiveDone]
  583. * @param {string} [contentDispositionFilename]
  584. */
  585. constructor(length: number, initialData: Uint8Array, progressiveDone?: boolean | undefined, contentDispositionFilename?: string | undefined);
  586. length: number;
  587. initialData: Uint8Array;
  588. progressiveDone: boolean;
  589. contentDispositionFilename: string;
  590. _rangeListeners: any[];
  591. _progressListeners: any[];
  592. _progressiveReadListeners: any[];
  593. _progressiveDoneListeners: any[];
  594. _readyCapability: import("../shared/util.js").PromiseCapability;
  595. addRangeListener(listener: any): void;
  596. addProgressListener(listener: any): void;
  597. addProgressiveReadListener(listener: any): void;
  598. addProgressiveDoneListener(listener: any): void;
  599. onDataRange(begin: any, chunk: any): void;
  600. onDataProgress(loaded: any, total: any): void;
  601. onDataProgressiveRead(chunk: any): void;
  602. onDataProgressiveDone(): void;
  603. transportReady(): void;
  604. requestDataRange(begin: any, end: any): void;
  605. abort(): void;
  606. }
  607. /**
  608. * Proxy to a `PDFDocument` in the worker thread.
  609. */
  610. export class PDFDocumentProxy {
  611. constructor(pdfInfo: any, transport: any);
  612. _pdfInfo: any;
  613. _transport: any;
  614. /**
  615. * @type {AnnotationStorage} Storage for annotation data in forms.
  616. */
  617. get annotationStorage(): AnnotationStorage;
  618. /**
  619. * @type {number} Total number of pages in the PDF file.
  620. */
  621. get numPages(): number;
  622. /**
  623. * @type {string} A (not guaranteed to be) unique ID to identify a PDF.
  624. */
  625. get fingerprint(): string;
  626. /**
  627. * @type {boolean} True if only XFA form.
  628. */
  629. get isPureXfa(): boolean;
  630. /**
  631. * @param {number} pageNumber - The page number to get. The first page is 1.
  632. * @returns {Promise<PDFPageProxy>} A promise that is resolved with
  633. * a {@link PDFPageProxy} object.
  634. */
  635. getPage(pageNumber: number): Promise<PDFPageProxy>;
  636. /**
  637. * @param {{num: number, gen: number}} ref - The page reference. Must have
  638. * the `num` and `gen` properties.
  639. * @returns {Promise<{num: number, gen: number}>} A promise that is resolved
  640. * with the page index (starting from zero) that is associated with the
  641. * reference.
  642. */
  643. getPageIndex(ref: {
  644. num: number;
  645. gen: number;
  646. }): Promise<{
  647. num: number;
  648. gen: number;
  649. }>;
  650. /**
  651. * @returns {Promise<Object<string, Array<any>>>} A promise that is resolved
  652. * with a mapping from named destinations to references.
  653. *
  654. * This can be slow for large documents. Use `getDestination` instead.
  655. */
  656. getDestinations(): Promise<{
  657. [x: string]: Array<any>;
  658. }>;
  659. /**
  660. * @param {string} id - The named destination to get.
  661. * @returns {Promise<Array<any>>} A promise that is resolved with all
  662. * information of the given named destination.
  663. */
  664. getDestination(id: string): Promise<Array<any>>;
  665. /**
  666. * @returns {Promise<Array<string> | null>} A promise that is resolved with
  667. * an {Array} containing the page labels that correspond to the page
  668. * indexes, or `null` when no page labels are present in the PDF file.
  669. */
  670. getPageLabels(): Promise<Array<string> | null>;
  671. /**
  672. * @returns {Promise<string>} A promise that is resolved with a {string}
  673. * containing the page layout name.
  674. */
  675. getPageLayout(): Promise<string>;
  676. /**
  677. * @returns {Promise<string>} A promise that is resolved with a {string}
  678. * containing the page mode name.
  679. */
  680. getPageMode(): Promise<string>;
  681. /**
  682. * @returns {Promise<Object | null>} A promise that is resolved with an
  683. * {Object} containing the viewer preferences, or `null` when no viewer
  684. * preferences are present in the PDF file.
  685. */
  686. getViewerPreferences(): Promise<Object | null>;
  687. /**
  688. * @returns {Promise<any | null>} A promise that is resolved with an {Array}
  689. * containing the destination, or `null` when no open action is present
  690. * in the PDF.
  691. */
  692. getOpenAction(): Promise<any | null>;
  693. /**
  694. * @returns {Promise<any>} A promise that is resolved with a lookup table
  695. * for mapping named attachments to their content.
  696. */
  697. getAttachments(): Promise<any>;
  698. /**
  699. * @returns {Promise<Array<string> | null>} A promise that is resolved with
  700. * an {Array} of all the JavaScript strings in the name tree, or `null`
  701. * if no JavaScript exists.
  702. */
  703. getJavaScript(): Promise<Array<string> | null>;
  704. /**
  705. * @returns {Promise<Object | null>} A promise that is resolved with
  706. * an {Object} with the JavaScript actions:
  707. * - from the name tree (like getJavaScript);
  708. * - from A or AA entries in the catalog dictionary.
  709. * , or `null` if no JavaScript exists.
  710. */
  711. getJSActions(): Promise<Object | null>;
  712. /**
  713. * @typedef {Object} OutlineNode
  714. * @property {string} title
  715. * @property {boolean} bold
  716. * @property {boolean} italic
  717. * @property {Uint8ClampedArray} color - The color in RGB format to use for
  718. * display purposes.
  719. * @property {string | Array<any> | null} dest
  720. * @property {string | null} url
  721. * @property {string | undefined} unsafeUrl
  722. * @property {boolean | undefined} newWindow
  723. * @property {number | undefined} count
  724. * @property {Array<OutlineNode>} items
  725. */
  726. /**
  727. * @returns {Promise<Array<OutlineNode>>} A promise that is resolved with an
  728. * {Array} that is a tree outline (if it has one) of the PDF file.
  729. */
  730. getOutline(): Promise<Array<OutlineNode>>;
  731. /**
  732. * @returns {Promise<OptionalContentConfig>} A promise that is resolved with
  733. * an {@link OptionalContentConfig} that contains all the optional content
  734. * groups (assuming that the document has any).
  735. */
  736. getOptionalContentConfig(): Promise<OptionalContentConfig>;
  737. /**
  738. * @returns {Promise<Array<number> | null>} A promise that is resolved with
  739. * an {Array} that contains the permission flags for the PDF document, or
  740. * `null` when no permissions are present in the PDF file.
  741. */
  742. getPermissions(): Promise<Array<number> | null>;
  743. /**
  744. * @returns {Promise<{ info: Object, metadata: Metadata }>} A promise that is
  745. * resolved with an {Object} that has `info` and `metadata` properties.
  746. * `info` is an {Object} filled with anything available in the information
  747. * dictionary and similarly `metadata` is a {Metadata} object with
  748. * information from the metadata section of the PDF.
  749. */
  750. getMetadata(): Promise<{
  751. info: Object;
  752. metadata: Metadata;
  753. }>;
  754. /**
  755. * @typedef {Object} MarkInfo
  756. * Properties correspond to Table 321 of the PDF 32000-1:2008 spec.
  757. * @property {boolean} Marked
  758. * @property {boolean} UserProperties
  759. * @property {boolean} Suspects
  760. */
  761. /**
  762. * @returns {Promise<MarkInfo | null>} A promise that is resolved with
  763. * a {MarkInfo} object that contains the MarkInfo flags for the PDF
  764. * document, or `null` when no MarkInfo values are present in the PDF file.
  765. */
  766. getMarkInfo(): Promise<MarkInfo | null>;
  767. /**
  768. * @returns {Promise<TypedArray>} A promise that is resolved with a
  769. * {TypedArray} that has the raw data from the PDF.
  770. */
  771. getData(): Promise<TypedArray>;
  772. /**
  773. * @returns {Promise<{ length: number }>} A promise that is resolved when the
  774. * document's data is loaded. It is resolved with an {Object} that contains
  775. * the `length` property that indicates size of the PDF data in bytes.
  776. */
  777. getDownloadInfo(): Promise<{
  778. length: number;
  779. }>;
  780. /**
  781. * @typedef {Object} PDFDocumentStats
  782. * @property {Object<string, boolean>} streamTypes - Used stream types in the
  783. * document (an item is set to true if specific stream ID was used in the
  784. * document).
  785. * @property {Object<string, boolean>} fontTypes - Used font types in the
  786. * document (an item is set to true if specific font ID was used in the
  787. * document).
  788. */
  789. /**
  790. * @returns {Promise<PDFDocumentStats>} A promise this is resolved with
  791. * current statistics about document structures (see
  792. * {@link PDFDocumentStats}).
  793. */
  794. getStats(): Promise<PDFDocumentStats>;
  795. /**
  796. * Cleans up resources allocated by the document on both the main and worker
  797. * threads.
  798. *
  799. * NOTE: Do not, under any circumstances, call this method when rendering is
  800. * currently ongoing since that may lead to rendering errors.
  801. *
  802. * @param {boolean} [keepLoadedFonts] - Let fonts remain attached to the DOM.
  803. * NOTE: This will increase persistent memory usage, hence don't use this
  804. * option unless absolutely necessary. The default value is `false`.
  805. * @returns {Promise} A promise that is resolved when clean-up has finished.
  806. */
  807. cleanup(keepLoadedFonts?: boolean | undefined): Promise<any>;
  808. /**
  809. * Destroys the current document instance and terminates the worker.
  810. */
  811. destroy(): any;
  812. /**
  813. * @type {DocumentInitParameters} A subset of the current
  814. * {DocumentInitParameters}, which are either needed in the viewer and/or
  815. * whose default values may be affected by the `apiCompatibilityParams`.
  816. */
  817. get loadingParams(): DocumentInitParameters;
  818. /**
  819. * @type {PDFDocumentLoadingTask} The loadingTask for the current document.
  820. */
  821. get loadingTask(): PDFDocumentLoadingTask;
  822. /**
  823. * @param {AnnotationStorage} annotationStorage - Storage for annotation
  824. * data in forms.
  825. * @returns {Promise<Uint8Array>} A promise that is resolved with a
  826. * {Uint8Array} containing the full data of the saved document.
  827. */
  828. saveDocument(annotationStorage: AnnotationStorage): Promise<Uint8Array>;
  829. /**
  830. * @returns {Promise<Array<Object> | null>} A promise that is resolved with an
  831. * {Array<Object>} containing /AcroForm field data for the JS sandbox,
  832. * or `null` when no field data is present in the PDF file.
  833. */
  834. getFieldObjects(): Promise<Array<Object> | null>;
  835. /**
  836. * @returns {Promise<boolean>} A promise that is resolved with `true`
  837. * if some /AcroForm fields have JavaScript actions.
  838. */
  839. hasJSActions(): Promise<boolean>;
  840. /**
  841. * @returns {Promise<Array<string> | null>} A promise that is resolved with an
  842. * {Array<string>} containing IDs of annotations that have a calculation
  843. * action, or `null` when no such annotations are present in the PDF file.
  844. */
  845. getCalculationOrderIds(): Promise<Array<string> | null>;
  846. }
  847. /**
  848. * Page getViewport parameters.
  849. *
  850. * @typedef {Object} GetViewportParameters
  851. * @property {number} scale - The desired scale of the viewport.
  852. * @property {number} [rotation] - The desired rotation, in degrees, of
  853. * the viewport. If omitted it defaults to the page rotation.
  854. * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset.
  855. * The default value is `0`.
  856. * @property {number} [offsetY] - The vertical, i.e. y-axis, offset.
  857. * The default value is `0`.
  858. * @property {boolean} [dontFlip] - If true, the y-axis will not be
  859. * flipped. The default value is `false`.
  860. */
  861. /**
  862. * Page getTextContent parameters.
  863. *
  864. * @typedef {Object} getTextContentParameters
  865. * @property {boolean} normalizeWhitespace - Replaces all occurrences of
  866. * whitespace with standard spaces (0x20). The default value is `false`.
  867. * @property {boolean} disableCombineTextItems - Do not attempt to combine
  868. * same line {@link TextItem}'s. The default value is `false`.
  869. */
  870. /**
  871. * Page text content.
  872. *
  873. * @typedef {Object} TextContent
  874. * @property {Array<TextItem>} items - Array of {@link TextItem} objects.
  875. * @property {Object<string, TextStyle>} styles - {@link TextStyle} objects,
  876. * indexed by font name.
  877. */
  878. /**
  879. * Page text content part.
  880. *
  881. * @typedef {Object} TextItem
  882. * @property {string} str - Text content.
  883. * @property {string} dir - Text direction: 'ttb', 'ltr' or 'rtl'.
  884. * @property {Array<any>} transform - Transformation matrix.
  885. * @property {number} width - Width in device space.
  886. * @property {number} height - Height in device space.
  887. * @property {string} fontName - Font name used by PDF.js for converted font.
  888. */
  889. /**
  890. * Text style.
  891. *
  892. * @typedef {Object} TextStyle
  893. * @property {number} ascent - Font ascent.
  894. * @property {number} descent - Font descent.
  895. * @property {boolean} vertical - Whether or not the text is in vertical mode.
  896. * @property {string} fontFamily - The possible font family.
  897. */
  898. /**
  899. * Page annotation parameters.
  900. *
  901. * @typedef {Object} GetAnnotationsParameters
  902. * @property {string} intent - Determines the annotations that will be fetched,
  903. * can be either 'display' (viewable annotations) or 'print' (printable
  904. * annotations). If the parameter is omitted, all annotations are fetched.
  905. */
  906. /**
  907. * Page render parameters.
  908. *
  909. * @typedef {Object} RenderParameters
  910. * @property {Object} canvasContext - A 2D context of a DOM Canvas object.
  911. * @property {PageViewport} viewport - Rendering viewport obtained by calling
  912. * the `PDFPageProxy.getViewport` method.
  913. * @property {string} [intent] - Rendering intent, can be 'display' or 'print'.
  914. * The default value is 'display'.
  915. * @property {boolean} [enableWebGL] - Enables WebGL accelerated rendering for
  916. * some operations. The default value is `false`.
  917. * @property {boolean} [renderInteractiveForms] - Whether or not interactive
  918. * form elements are rendered in the display layer. If so, we do not render
  919. * them on the canvas as well.
  920. * @property {Array<any>} [transform] - Additional transform, applied just
  921. * before viewport transform.
  922. * @property {Object} [imageLayer] - An object that has `beginLayout`,
  923. * `endLayout` and `appendImage` functions.
  924. * @property {Object} [canvasFactory] - The factory instance that will be used
  925. * when creating canvases. The default value is {new DOMCanvasFactory()}.
  926. * @property {Object | string} [background] - Background to use for the canvas.
  927. * Any valid `canvas.fillStyle` can be used: a `DOMString` parsed as CSS
  928. * <color> value, a `CanvasGradient` object (a linear or radial gradient) or
  929. * a `CanvasPattern` object (a repetitive image). The default value is
  930. * 'rgb(255,255,255)'.
  931. * @property {AnnotationStorage} [annotationStorage] - Storage for annotation
  932. * data in forms.
  933. * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -
  934. * A promise that should resolve with an {@link OptionalContentConfig}
  935. * created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`,
  936. * the configuration will be fetched automatically with the default visibility
  937. * states set.
  938. */
  939. /**
  940. * PDF page operator list.
  941. *
  942. * @typedef {Object} PDFOperatorList
  943. * @property {Array<number>} fnArray - Array containing the operator functions.
  944. * @property {Array<any>} argsArray - Array containing the arguments of the
  945. * functions.
  946. */
  947. /**
  948. * Proxy to a `PDFPage` in the worker thread.
  949. */
  950. export class PDFPageProxy {
  951. constructor(pageIndex: any, pageInfo: any, transport: any, ownerDocument: any, pdfBug?: boolean);
  952. _pageIndex: any;
  953. _pageInfo: any;
  954. _ownerDocument: any;
  955. _transport: any;
  956. _stats: StatTimer | null;
  957. _pdfBug: boolean;
  958. commonObjs: any;
  959. objs: PDFObjects;
  960. cleanupAfterRender: boolean;
  961. pendingCleanup: boolean;
  962. _intentStates: Map<any, any>;
  963. destroyed: boolean;
  964. /**
  965. * @type {number} Page number of the page. First page is 1.
  966. */
  967. get pageNumber(): number;
  968. /**
  969. * @type {number} The number of degrees the page is rotated clockwise.
  970. */
  971. get rotate(): number;
  972. /**
  973. * @type {Object} The reference that points to this page. It has `num` and
  974. * `gen` properties.
  975. */
  976. get ref(): Object;
  977. /**
  978. * @type {number} The default size of units in 1/72nds of an inch.
  979. */
  980. get userUnit(): number;
  981. /**
  982. * @type {Array<number>} An array of the visible portion of the PDF page in
  983. * user space units [x1, y1, x2, y2].
  984. */
  985. get view(): number[];
  986. /**
  987. * @param {GetViewportParameters} params - Viewport parameters.
  988. * @returns {PageViewport} Contains 'width' and 'height' properties
  989. * along with transforms required for rendering.
  990. */
  991. getViewport({ scale, rotation, offsetX, offsetY, dontFlip, }?: GetViewportParameters): PageViewport;
  992. /**
  993. * @param {GetAnnotationsParameters} params - Annotation parameters.
  994. * @returns {Promise<Array<any>>} A promise that is resolved with an
  995. * {Array} of the annotation objects.
  996. */
  997. getAnnotations({ intent }?: GetAnnotationsParameters): Promise<Array<any>>;
  998. _annotationsPromise: any;
  999. _annotationsIntent: string | undefined;
  1000. /**
  1001. * @returns {Promise<Object>} A promise that is resolved with an
  1002. * {Object} with JS actions.
  1003. */
  1004. getJSActions(): Promise<Object>;
  1005. /**
  1006. * @returns {Promise<Object | null>} A promise that is resolved with
  1007. * an {Object} with a fake DOM object (a tree structure where elements
  1008. * are {Object} with a name, attributes (class, style, ...), value and
  1009. * children, very similar to a HTML DOM tree), or `null` if no XFA exists.
  1010. */
  1011. getXfa(): Promise<Object | null>;
  1012. /**
  1013. * Begins the process of rendering a page to the desired context.
  1014. *
  1015. * @param {RenderParameters} params Page render parameters.
  1016. * @returns {RenderTask} An object that contains a promise that is
  1017. * resolved when the page finishes rendering.
  1018. */
  1019. render({ canvasContext, viewport, intent, enableWebGL, renderInteractiveForms, transform, imageLayer, canvasFactory, background, annotationStorage, optionalContentConfigPromise, }: RenderParameters): RenderTask;
  1020. /**
  1021. * @returns {Promise<PDFOperatorList>} A promise resolved with an
  1022. * {@link PDFOperatorList} object that represents page's operator list.
  1023. */
  1024. getOperatorList(): Promise<PDFOperatorList>;
  1025. /**
  1026. * @param {getTextContentParameters} params - getTextContent parameters.
  1027. * @returns {ReadableStream} Stream for reading text content chunks.
  1028. */
  1029. streamTextContent({ normalizeWhitespace, disableCombineTextItems, }?: getTextContentParameters): ReadableStream;
  1030. /**
  1031. * @param {getTextContentParameters} params - getTextContent parameters.
  1032. * @returns {Promise<TextContent>} A promise that is resolved with a
  1033. * {@link TextContent} object that represents the page's text content.
  1034. */
  1035. getTextContent(params?: getTextContentParameters): Promise<TextContent>;
  1036. /**
  1037. * Destroys the page object.
  1038. * @private
  1039. */
  1040. private _destroy;
  1041. _jsActionsPromise: any;
  1042. _xfaPromise: any;
  1043. /**
  1044. * Cleans up resources allocated by the page.
  1045. *
  1046. * @param {boolean} [resetStats] - Reset page stats, if enabled.
  1047. * The default value is `false`.
  1048. * @returns {boolean} Indicates if clean-up was successfully run.
  1049. */
  1050. cleanup(resetStats?: boolean | undefined): boolean;
  1051. /**
  1052. * Attempts to clean up if rendering is in a state where that's possible.
  1053. * @private
  1054. */
  1055. private _tryCleanup;
  1056. /**
  1057. * @private
  1058. */
  1059. private _startRenderPage;
  1060. /**
  1061. * @private
  1062. */
  1063. private _renderPageChunk;
  1064. /**
  1065. * @private
  1066. */
  1067. private _pumpOperatorList;
  1068. /**
  1069. * @private
  1070. */
  1071. private _abortOperatorList;
  1072. /**
  1073. * @type {Object} Returns page stats, if enabled; returns `null` otherwise.
  1074. */
  1075. get stats(): Object;
  1076. }
  1077. /**
  1078. * @typedef {Object} PDFWorkerParameters
  1079. * @property {string} [name] - The name of the worker.
  1080. * @property {Object} [port] - The `workerPort` object.
  1081. * @property {number} [verbosity] - Controls the logging level; the
  1082. * constants from {@link VerbosityLevel} should be used.
  1083. */
  1084. /** @type {any} */
  1085. export const PDFWorker: any;
  1086. /**
  1087. * Sets the function that instantiates an {IPDFStream} as an alternative PDF
  1088. * data transport.
  1089. *
  1090. * @param {IPDFStreamFactory} pdfNetworkStreamFactory - The factory function
  1091. * that takes document initialization parameters (including a "url") and
  1092. * returns a promise which is resolved with an instance of {IPDFStream}.
  1093. * @ignore
  1094. */
  1095. export function setPDFNetworkStreamFactory(pdfNetworkStreamFactory: IPDFStreamFactory): void;
  1096. /** @type {string} */
  1097. export const version: string;
  1098. import { PageViewport } from "./display_utils.js";
  1099. import { AnnotationStorage } from "./annotation_storage.js";
  1100. import { OptionalContentConfig } from "./optional_content_config.js";
  1101. import { DOMCanvasFactory } from "./display_utils.js";
  1102. import { DOMCMapReaderFactory } from "./display_utils.js";
  1103. /**
  1104. * The loading task controls the operations required to load a PDF document
  1105. * (such as network requests) and provides a way to listen for completion,
  1106. * after which individual pages can be rendered.
  1107. *
  1108. * @typedef {Object} PDFDocumentLoadingTask
  1109. * @property {string} docId - Unique identifier for the document loading task.
  1110. * @property {boolean} destroyed - Whether the loading task is destroyed or not.
  1111. * @property {function} [onPassword] - Callback to request a password if a wrong
  1112. * or no password was provided. The callback receives two parameters: a
  1113. * function that should be called with the new password, and a reason (see
  1114. * {@link PasswordResponses}).
  1115. * @property {function} [onProgress] - Callback to be able to monitor the
  1116. * loading progress of the PDF file (necessary to implement e.g. a loading
  1117. * bar). The callback receives an {Object} with the properties `loaded`
  1118. * ({number}) and `total` ({number}) that indicate how many bytes are loaded.
  1119. * @property {function} [onUnsupportedFeature] - Callback for when an
  1120. * unsupported feature is used in the PDF document. The callback receives an
  1121. * {@link UNSUPPORTED_FEATURES} argument.
  1122. * @property {Promise<PDFDocumentProxy>} promise - Promise for document loading
  1123. * task completion.
  1124. * @property {function} destroy - Abort all network requests and destroy
  1125. * the worker. Returns a promise that is resolved when destruction is
  1126. * completed.
  1127. */
  1128. /**
  1129. * @type {any}
  1130. * @ignore
  1131. */
  1132. declare const PDFDocumentLoadingTask: any;
  1133. import { info } from "../shared/util.js";
  1134. import { Metadata } from "./metadata.js";
  1135. import { StatTimer } from "./display_utils.js";
  1136. /**
  1137. * A PDF document and page is built of many objects. E.g. there are objects for
  1138. * fonts, images, rendering code, etc. These objects may get processed inside of
  1139. * a worker. This class implements some basic methods to manage these objects.
  1140. * @ignore
  1141. */
  1142. declare class PDFObjects {
  1143. _objs: any;
  1144. /**
  1145. * Ensures there is an object defined for `objId`.
  1146. * @private
  1147. */
  1148. private _ensureObj;
  1149. /**
  1150. * If called *without* callback, this returns the data of `objId` but the
  1151. * object needs to be resolved. If it isn't, this method throws.
  1152. *
  1153. * If called *with* a callback, the callback is called with the data of the
  1154. * object once the object is resolved. That means, if you call this method
  1155. * and the object is already resolved, the callback gets called right away.
  1156. */
  1157. get(objId: any, callback?: any): any;
  1158. has(objId: any): any;
  1159. /**
  1160. * Resolves the object `objId` with optional `data`.
  1161. */
  1162. resolve(objId: any, data: any): void;
  1163. clear(): void;
  1164. }
  1165. /**
  1166. * Allows controlling of the rendering tasks.
  1167. */
  1168. declare class RenderTask {
  1169. constructor(internalRenderTask: any);
  1170. _internalRenderTask: any;
  1171. /**
  1172. * Callback for incremental rendering -- a function that will be called
  1173. * each time the rendering is paused. To continue rendering call the
  1174. * function that is the first argument to the callback.
  1175. * @type {function}
  1176. */
  1177. onContinue: Function;
  1178. /**
  1179. * Promise for rendering task completion.
  1180. * @type {Promise<void>}
  1181. */
  1182. get promise(): Promise<void>;
  1183. /**
  1184. * Cancels the rendering task. If the task is currently rendering it will
  1185. * not be cancelled until graphics pauses with a timeout. The promise that
  1186. * this object extends will be rejected when cancelled.
  1187. */
  1188. cancel(): void;
  1189. }
  1190. export {};