display_utils.d.ts 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. export type ExternalLinkParameters = any;
  2. export type PageViewportParameters = {
  3. /**
  4. * - The xMin, yMin, xMax and
  5. * yMax coordinates.
  6. */
  7. viewBox: Array<number>;
  8. /**
  9. * - The scale of the viewport.
  10. */
  11. scale: number;
  12. /**
  13. * - The rotation, in degrees, of the viewport.
  14. */
  15. rotation: number;
  16. /**
  17. * - The horizontal, i.e. x-axis, offset. The
  18. * default value is `0`.
  19. */
  20. offsetX?: number | undefined;
  21. /**
  22. * - The vertical, i.e. y-axis, offset. The
  23. * default value is `0`.
  24. */
  25. offsetY?: number | undefined;
  26. /**
  27. * - If true, the y-axis will not be flipped.
  28. * The default value is `false`.
  29. */
  30. dontFlip?: boolean | undefined;
  31. };
  32. export type PageViewportCloneParameters = {
  33. /**
  34. * - The scale, overriding the one in the cloned
  35. * viewport. The default value is `this.scale`.
  36. */
  37. scale?: number | undefined;
  38. /**
  39. * - The rotation, in degrees, overriding the one
  40. * in the cloned viewport. The default value is `this.rotation`.
  41. */
  42. rotation?: number | undefined;
  43. /**
  44. * - The horizontal, i.e. x-axis, offset.
  45. * The default value is `this.offsetX`.
  46. */
  47. offsetX?: number | undefined;
  48. /**
  49. * - The vertical, i.e. y-axis, offset.
  50. * The default value is `this.offsetY`.
  51. */
  52. offsetY?: number | undefined;
  53. /**
  54. * - If true, the x-axis will not be flipped.
  55. * The default value is `false`.
  56. */
  57. dontFlip?: boolean | undefined;
  58. };
  59. /**
  60. * @typedef ExternalLinkParameters
  61. * @typedef {Object} ExternalLinkParameters
  62. * @property {string} url - An absolute URL.
  63. * @property {LinkTarget} [target] - The link target. The default value is
  64. * `LinkTarget.NONE`.
  65. * @property {string} [rel] - The link relationship. The default value is
  66. * `DEFAULT_LINK_REL`.
  67. * @property {boolean} [enabled] - Whether the link should be enabled. The
  68. * default value is true.
  69. */
  70. /**
  71. * Adds various attributes (href, title, target, rel) to hyperlinks.
  72. * @param {HTMLLinkElement} link - The link element.
  73. * @param {ExternalLinkParameters} params
  74. */
  75. export function addLinkAttributes(link: HTMLLinkElement, { url, target, rel, enabled }?: any): void;
  76. export class BaseCanvasFactory {
  77. create(width: any, height: any): void;
  78. reset(canvasAndContext: any, width: any, height: any): void;
  79. destroy(canvasAndContext: any): void;
  80. }
  81. export class BaseCMapReaderFactory {
  82. constructor({ baseUrl, isCompressed }: {
  83. baseUrl?: any;
  84. isCompressed?: boolean | undefined;
  85. });
  86. baseUrl: any;
  87. isCompressed: boolean;
  88. fetch({ name }: {
  89. name: any;
  90. }): Promise<any>;
  91. /**
  92. * @private
  93. */
  94. private _fetchData;
  95. }
  96. export const DEFAULT_LINK_REL: "noopener noreferrer nofollow";
  97. export function deprecated(details: any): void;
  98. export class DOMCanvasFactory extends BaseCanvasFactory {
  99. constructor({ ownerDocument }?: {
  100. ownerDocument?: Document | undefined;
  101. });
  102. _document: Document;
  103. }
  104. export class DOMCMapReaderFactory extends BaseCMapReaderFactory {
  105. constructor({ baseUrl, isCompressed }: {
  106. baseUrl?: any;
  107. isCompressed?: boolean | undefined;
  108. });
  109. }
  110. export class DOMSVGFactory {
  111. create(width: any, height: any): SVGElement;
  112. createElement(type: any): any;
  113. }
  114. /**
  115. * Gets the file name from a given URL.
  116. * @param {string} url
  117. */
  118. export function getFilenameFromUrl(url: string): string;
  119. export function isFetchSupported(): boolean;
  120. export function isValidFetchUrl(url: any, baseUrl: any): boolean;
  121. export namespace LinkTarget {
  122. const NONE: number;
  123. const SELF: number;
  124. const BLANK: number;
  125. const PARENT: number;
  126. const TOP: number;
  127. }
  128. /**
  129. * @param {string} src
  130. * @param {boolean} [removeScriptElement]
  131. * @returns {Promise<void>}
  132. */
  133. export function loadScript(src: string, removeScriptElement?: boolean | undefined): Promise<void>;
  134. /**
  135. * @typedef {Object} PageViewportParameters
  136. * @property {Array<number>} viewBox - The xMin, yMin, xMax and
  137. * yMax coordinates.
  138. * @property {number} scale - The scale of the viewport.
  139. * @property {number} rotation - The rotation, in degrees, of the viewport.
  140. * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset. The
  141. * default value is `0`.
  142. * @property {number} [offsetY] - The vertical, i.e. y-axis, offset. The
  143. * default value is `0`.
  144. * @property {boolean} [dontFlip] - If true, the y-axis will not be flipped.
  145. * The default value is `false`.
  146. */
  147. /**
  148. * @typedef {Object} PageViewportCloneParameters
  149. * @property {number} [scale] - The scale, overriding the one in the cloned
  150. * viewport. The default value is `this.scale`.
  151. * @property {number} [rotation] - The rotation, in degrees, overriding the one
  152. * in the cloned viewport. The default value is `this.rotation`.
  153. * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset.
  154. * The default value is `this.offsetX`.
  155. * @property {number} [offsetY] - The vertical, i.e. y-axis, offset.
  156. * The default value is `this.offsetY`.
  157. * @property {boolean} [dontFlip] - If true, the x-axis will not be flipped.
  158. * The default value is `false`.
  159. */
  160. /**
  161. * PDF page viewport created based on scale, rotation and offset.
  162. */
  163. export class PageViewport {
  164. /**
  165. * @param {PageViewportParameters}
  166. */
  167. constructor({ viewBox, scale, rotation, offsetX, offsetY, dontFlip, }: PageViewportParameters);
  168. viewBox: number[];
  169. scale: number;
  170. rotation: number;
  171. offsetX: number;
  172. offsetY: number;
  173. transform: number[];
  174. width: number;
  175. height: number;
  176. /**
  177. * Clones viewport, with optional additional properties.
  178. * @param {PageViewportCloneParameters} [params]
  179. * @returns {PageViewport} Cloned viewport.
  180. */
  181. clone({ scale, rotation, offsetX, offsetY, dontFlip, }?: PageViewportCloneParameters | undefined): PageViewport;
  182. /**
  183. * Converts PDF point to the viewport coordinates. For examples, useful for
  184. * converting PDF location into canvas pixel coordinates.
  185. * @param {number} x - The x-coordinate.
  186. * @param {number} y - The y-coordinate.
  187. * @returns {Object} Object containing `x` and `y` properties of the
  188. * point in the viewport coordinate space.
  189. * @see {@link convertToPdfPoint}
  190. * @see {@link convertToViewportRectangle}
  191. */
  192. convertToViewportPoint(x: number, y: number): Object;
  193. /**
  194. * Converts PDF rectangle to the viewport coordinates.
  195. * @param {Array} rect - The xMin, yMin, xMax and yMax coordinates.
  196. * @returns {Array} Array containing corresponding coordinates of the
  197. * rectangle in the viewport coordinate space.
  198. * @see {@link convertToViewportPoint}
  199. */
  200. convertToViewportRectangle(rect: any[]): any[];
  201. /**
  202. * Converts viewport coordinates to the PDF location. For examples, useful
  203. * for converting canvas pixel location into PDF one.
  204. * @param {number} x - The x-coordinate.
  205. * @param {number} y - The y-coordinate.
  206. * @returns {Object} Object containing `x` and `y` properties of the
  207. * point in the PDF coordinate space.
  208. * @see {@link convertToViewportPoint}
  209. */
  210. convertToPdfPoint(x: number, y: number): Object;
  211. }
  212. export class PDFDateString {
  213. /**
  214. * Convert a PDF date string to a JavaScript `Date` object.
  215. *
  216. * The PDF date string format is described in section 7.9.4 of the official
  217. * PDF 32000-1:2008 specification. However, in the PDF 1.7 reference (sixth
  218. * edition) Adobe describes the same format including a trailing apostrophe.
  219. * This syntax in incorrect, but Adobe Acrobat creates PDF files that contain
  220. * them. We ignore all apostrophes as they are not necessary for date parsing.
  221. *
  222. * Moreover, Adobe Acrobat doesn't handle changing the date to universal time
  223. * and doesn't use the user's time zone (effectively ignoring the HH' and mm'
  224. * parts of the date string).
  225. *
  226. * @param {string} input
  227. * @returns {Date|null}
  228. */
  229. static toDateObject(input: string): Date | null;
  230. }
  231. declare const RenderingCancelledException_base: any;
  232. export class RenderingCancelledException extends RenderingCancelledException_base {
  233. [x: string]: any;
  234. constructor(msg: any, type: any);
  235. type: any;
  236. }
  237. export class StatTimer {
  238. started: any;
  239. times: any[];
  240. time(name: any): void;
  241. timeEnd(name: any): void;
  242. toString(): string;
  243. }
  244. export {};