util.d.ts 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. /**
  2. * Promise Capability object.
  3. */
  4. export type PromiseCapability = {
  5. /**
  6. * - A Promise object.
  7. */
  8. promise: Promise<any>;
  9. /**
  10. * - If the Promise has been fulfilled/rejected.
  11. */
  12. settled: boolean;
  13. /**
  14. * - Fulfills the Promise.
  15. */
  16. resolve: Function;
  17. /**
  18. * - Rejects the Promise.
  19. */
  20. reject: Function;
  21. };
  22. declare const AbortException_base: any;
  23. /**
  24. * Error used to indicate task cancellation.
  25. */
  26. export class AbortException extends AbortException_base {
  27. [x: string]: any;
  28. }
  29. export namespace AnnotationActionEventType {
  30. const E: string;
  31. const X: string;
  32. const D: string;
  33. const U: string;
  34. const Fo: string;
  35. const Bl: string;
  36. const PO: string;
  37. const PC: string;
  38. const PV: string;
  39. const PI: string;
  40. const K: string;
  41. const F: string;
  42. const V: string;
  43. const C: string;
  44. }
  45. export namespace AnnotationBorderStyleType {
  46. const SOLID: number;
  47. const DASHED: number;
  48. const BEVELED: number;
  49. const INSET: number;
  50. const UNDERLINE: number;
  51. }
  52. export namespace AnnotationFieldFlag {
  53. const READONLY: number;
  54. const REQUIRED: number;
  55. const NOEXPORT: number;
  56. const MULTILINE: number;
  57. const PASSWORD: number;
  58. const NOTOGGLETOOFF: number;
  59. const RADIO: number;
  60. const PUSHBUTTON: number;
  61. const COMBO: number;
  62. const EDIT: number;
  63. const SORT: number;
  64. const FILESELECT: number;
  65. const MULTISELECT: number;
  66. const DONOTSPELLCHECK: number;
  67. const DONOTSCROLL: number;
  68. const COMB: number;
  69. const RICHTEXT: number;
  70. const RADIOSINUNISON: number;
  71. const COMMITONSELCHANGE: number;
  72. }
  73. export namespace AnnotationFlag {
  74. export const INVISIBLE: number;
  75. export const HIDDEN: number;
  76. export const PRINT: number;
  77. export const NOZOOM: number;
  78. export const NOROTATE: number;
  79. export const NOVIEW: number;
  80. const READONLY_1: number;
  81. export { READONLY_1 as READONLY };
  82. export const LOCKED: number;
  83. export const TOGGLENOVIEW: number;
  84. export const LOCKEDCONTENTS: number;
  85. }
  86. export namespace AnnotationMarkedState {
  87. const MARKED: string;
  88. const UNMARKED: string;
  89. }
  90. export namespace AnnotationReplyType {
  91. const GROUP: string;
  92. const REPLY: string;
  93. }
  94. export namespace AnnotationReviewState {
  95. const ACCEPTED: string;
  96. const REJECTED: string;
  97. const CANCELLED: string;
  98. const COMPLETED: string;
  99. const NONE: string;
  100. }
  101. export namespace AnnotationStateModelType {
  102. const MARKED_1: string;
  103. export { MARKED_1 as MARKED };
  104. export const REVIEW: string;
  105. }
  106. export namespace AnnotationType {
  107. export const TEXT: number;
  108. export const LINK: number;
  109. export const FREETEXT: number;
  110. export const LINE: number;
  111. export const SQUARE: number;
  112. export const CIRCLE: number;
  113. export const POLYGON: number;
  114. export const POLYLINE: number;
  115. export const HIGHLIGHT: number;
  116. const UNDERLINE_1: number;
  117. export { UNDERLINE_1 as UNDERLINE };
  118. export const SQUIGGLY: number;
  119. export const STRIKEOUT: number;
  120. export const STAMP: number;
  121. export const CARET: number;
  122. export const INK: number;
  123. export const POPUP: number;
  124. export const FILEATTACHMENT: number;
  125. export const SOUND: number;
  126. export const MOVIE: number;
  127. export const WIDGET: number;
  128. export const SCREEN: number;
  129. export const PRINTERMARK: number;
  130. export const TRAPNET: number;
  131. export const WATERMARK: number;
  132. export const THREED: number;
  133. export const REDACT: number;
  134. }
  135. /**
  136. * Gets length of the array (Array, Uint8Array, or string) in bytes.
  137. * @param {Array<any>|Uint8Array|string} arr
  138. * @returns {number}
  139. */
  140. export function arrayByteLength(arr: Array<any> | Uint8Array | string): number;
  141. /**
  142. * Combines array items (arrays) into single Uint8Array object.
  143. * @param {Array<Array<any>|Uint8Array|string>} arr - the array of the arrays
  144. * (Array, Uint8Array, or string).
  145. * @returns {Uint8Array}
  146. */
  147. export function arraysToBytes(arr: Array<Array<any> | Uint8Array | string>): Uint8Array;
  148. export function assert(cond: any, msg: any): void;
  149. /**
  150. * @type {any}
  151. */
  152. export const BaseException: any;
  153. export function bytesToString(bytes: any): string;
  154. export namespace CMapCompressionType {
  155. const NONE_1: number;
  156. export { NONE_1 as NONE };
  157. export const BINARY: number;
  158. export const STREAM: number;
  159. }
  160. export function createObjectURL(data: any, contentType: any, forceDataSchema?: boolean): string;
  161. /**
  162. * Promise Capability object.
  163. *
  164. * @typedef {Object} PromiseCapability
  165. * @property {Promise<any>} promise - A Promise object.
  166. * @property {boolean} settled - If the Promise has been fulfilled/rejected.
  167. * @property {function} resolve - Fulfills the Promise.
  168. * @property {function} reject - Rejects the Promise.
  169. */
  170. /**
  171. * Creates a promise capability object.
  172. * @alias createPromiseCapability
  173. *
  174. * @returns {PromiseCapability}
  175. */
  176. export function createPromiseCapability(): PromiseCapability;
  177. /**
  178. * Attempts to create a valid absolute URL.
  179. *
  180. * @param {URL|string} url - An absolute, or relative, URL.
  181. * @param {URL|string} baseUrl - An absolute URL.
  182. * @returns Either a valid {URL}, or `null` otherwise.
  183. */
  184. export function createValidAbsoluteUrl(url: URL | string, baseUrl: URL | string): URL | null;
  185. export namespace DocumentActionEventType {
  186. const WC: string;
  187. const WS: string;
  188. const DS: string;
  189. const WP: string;
  190. const DP: string;
  191. }
  192. export function encodeToXmlString(str: any): any;
  193. export function escapeString(str: any): any;
  194. export const FONT_IDENTITY_MATRIX: number[];
  195. export namespace FontType {
  196. const UNKNOWN: string;
  197. const TYPE1: string;
  198. const TYPE1C: string;
  199. const CIDFONTTYPE0: string;
  200. const CIDFONTTYPE0C: string;
  201. const TRUETYPE: string;
  202. const CIDFONTTYPE2: string;
  203. const TYPE3: string;
  204. const OPENTYPE: string;
  205. const TYPE0: string;
  206. const MMTYPE1: string;
  207. }
  208. declare const FormatError_base: any;
  209. /**
  210. * Error caused during parsing PDF data.
  211. */
  212. export class FormatError extends FormatError_base {
  213. [x: string]: any;
  214. }
  215. export function getModificationDate(date?: Date): string;
  216. export function getVerbosityLevel(): number;
  217. export const IDENTITY_MATRIX: number[];
  218. export namespace ImageKind {
  219. const GRAYSCALE_1BPP: number;
  220. const RGB_24BPP: number;
  221. const RGBA_32BPP: number;
  222. }
  223. export function info(msg: any): void;
  224. declare const InvalidPDFException_base: any;
  225. export class InvalidPDFException extends InvalidPDFException_base {
  226. [x: string]: any;
  227. }
  228. export function isArrayBuffer(v: any): boolean;
  229. export function isArrayEqual(arr1: any, arr2: any): any;
  230. export function isAscii(str: any): boolean;
  231. export function isBool(v: any): boolean;
  232. export namespace IsEvalSupportedCached { }
  233. export namespace IsLittleEndianCached { }
  234. export function isNum(v: any): boolean;
  235. export function isSameOrigin(baseUrl: any, otherUrl: any): boolean;
  236. export function isString(v: any): boolean;
  237. declare const MissingPDFException_base: any;
  238. export class MissingPDFException extends MissingPDFException_base {
  239. [x: string]: any;
  240. }
  241. export function objectFromEntries(iterable: any): any;
  242. export function objectSize(obj: any): number;
  243. export namespace OPS {
  244. const dependency: number;
  245. const setLineWidth: number;
  246. const setLineCap: number;
  247. const setLineJoin: number;
  248. const setMiterLimit: number;
  249. const setDash: number;
  250. const setRenderingIntent: number;
  251. const setFlatness: number;
  252. const setGState: number;
  253. const save: number;
  254. const restore: number;
  255. const transform: number;
  256. const moveTo: number;
  257. const lineTo: number;
  258. const curveTo: number;
  259. const curveTo2: number;
  260. const curveTo3: number;
  261. const closePath: number;
  262. const rectangle: number;
  263. const stroke: number;
  264. const closeStroke: number;
  265. const fill: number;
  266. const eoFill: number;
  267. const fillStroke: number;
  268. const eoFillStroke: number;
  269. const closeFillStroke: number;
  270. const closeEOFillStroke: number;
  271. const endPath: number;
  272. const clip: number;
  273. const eoClip: number;
  274. const beginText: number;
  275. const endText: number;
  276. const setCharSpacing: number;
  277. const setWordSpacing: number;
  278. const setHScale: number;
  279. const setLeading: number;
  280. const setFont: number;
  281. const setTextRenderingMode: number;
  282. const setTextRise: number;
  283. const moveText: number;
  284. const setLeadingMoveText: number;
  285. const setTextMatrix: number;
  286. const nextLine: number;
  287. const showText: number;
  288. const showSpacedText: number;
  289. const nextLineShowText: number;
  290. const nextLineSetSpacingShowText: number;
  291. const setCharWidth: number;
  292. const setCharWidthAndBounds: number;
  293. const setStrokeColorSpace: number;
  294. const setFillColorSpace: number;
  295. const setStrokeColor: number;
  296. const setStrokeColorN: number;
  297. const setFillColor: number;
  298. const setFillColorN: number;
  299. const setStrokeGray: number;
  300. const setFillGray: number;
  301. const setStrokeRGBColor: number;
  302. const setFillRGBColor: number;
  303. const setStrokeCMYKColor: number;
  304. const setFillCMYKColor: number;
  305. const shadingFill: number;
  306. const beginInlineImage: number;
  307. const beginImageData: number;
  308. const endInlineImage: number;
  309. const paintXObject: number;
  310. const markPoint: number;
  311. const markPointProps: number;
  312. const beginMarkedContent: number;
  313. const beginMarkedContentProps: number;
  314. const endMarkedContent: number;
  315. const beginCompat: number;
  316. const endCompat: number;
  317. const paintFormXObjectBegin: number;
  318. const paintFormXObjectEnd: number;
  319. const beginGroup: number;
  320. const endGroup: number;
  321. const beginAnnotations: number;
  322. const endAnnotations: number;
  323. const beginAnnotation: number;
  324. const endAnnotation: number;
  325. const paintJpegXObject: number;
  326. const paintImageMaskXObject: number;
  327. const paintImageMaskXObjectGroup: number;
  328. const paintImageXObject: number;
  329. const paintInlineImageXObject: number;
  330. const paintInlineImageXObjectGroup: number;
  331. const paintImageXObjectRepeat: number;
  332. const paintImageMaskXObjectRepeat: number;
  333. const paintSolidColorImageMask: number;
  334. const constructPath: number;
  335. }
  336. export namespace PageActionEventType {
  337. export const O: string;
  338. const C_1: string;
  339. export { C_1 as C };
  340. }
  341. declare const PasswordException_base: any;
  342. export class PasswordException extends PasswordException_base {
  343. [x: string]: any;
  344. constructor(msg: any, code: any);
  345. code: any;
  346. }
  347. export namespace PasswordResponses {
  348. const NEED_PASSWORD: number;
  349. const INCORRECT_PASSWORD: number;
  350. }
  351. export namespace PermissionFlag {
  352. const PRINT_1: number;
  353. export { PRINT_1 as PRINT };
  354. export const MODIFY_CONTENTS: number;
  355. export const COPY: number;
  356. export const MODIFY_ANNOTATIONS: number;
  357. export const FILL_INTERACTIVE_FORMS: number;
  358. export const COPY_FOR_ACCESSIBILITY: number;
  359. export const ASSEMBLE: number;
  360. export const PRINT_HIGH_QUALITY: number;
  361. }
  362. /**
  363. * @param {string} str
  364. */
  365. export function removeNullCharacters(str: string): string;
  366. export function setVerbosityLevel(level: any): void;
  367. export function shadow(obj: any, prop: any, value: any): any;
  368. export namespace StreamType {
  369. const UNKNOWN_1: string;
  370. export { UNKNOWN_1 as UNKNOWN };
  371. export const FLATE: string;
  372. export const LZW: string;
  373. export const DCT: string;
  374. export const JPX: string;
  375. export const JBIG: string;
  376. export const A85: string;
  377. export const AHX: string;
  378. export const CCF: string;
  379. export const RLX: string;
  380. }
  381. export function string32(value: any): string;
  382. export function stringToBytes(str: any): Uint8Array;
  383. export function stringToPDFString(str: any): string;
  384. export function stringToUTF16BEString(str: any): string;
  385. export function stringToUTF8String(str: any): string;
  386. export namespace TextRenderingMode {
  387. export const FILL: number;
  388. export const STROKE: number;
  389. export const FILL_STROKE: number;
  390. const INVISIBLE_1: number;
  391. export { INVISIBLE_1 as INVISIBLE };
  392. export const FILL_ADD_TO_PATH: number;
  393. export const STROKE_ADD_TO_PATH: number;
  394. export const FILL_STROKE_ADD_TO_PATH: number;
  395. export const ADD_TO_PATH: number;
  396. export const FILL_STROKE_MASK: number;
  397. export const ADD_TO_PATH_FLAG: number;
  398. }
  399. declare const UnexpectedResponseException_base: any;
  400. export class UnexpectedResponseException extends UnexpectedResponseException_base {
  401. [x: string]: any;
  402. constructor(msg: any, status: any);
  403. status: any;
  404. }
  405. declare const UnknownErrorException_base: any;
  406. export class UnknownErrorException extends UnknownErrorException_base {
  407. [x: string]: any;
  408. constructor(msg: any, details: any);
  409. details: any;
  410. }
  411. export function unreachable(msg: any): void;
  412. export namespace UNSUPPORTED_FEATURES {
  413. const unknown: string;
  414. const forms: string;
  415. const javaScript: string;
  416. const smask: string;
  417. const shadingPattern: string;
  418. const font: string;
  419. const errorTilingPattern: string;
  420. const errorExtGState: string;
  421. const errorXObject: string;
  422. const errorFontLoadType3: string;
  423. const errorFontState: string;
  424. const errorFontMissing: string;
  425. const errorFontTranslate: string;
  426. const errorColorSpace: string;
  427. const errorOperatorList: string;
  428. const errorFontToUnicode: string;
  429. const errorFontLoadNative: string;
  430. const errorFontGetPath: string;
  431. const errorMarkedContent: string;
  432. }
  433. export function utf8StringToString(str: any): string;
  434. export class Util {
  435. static makeHexColor(r: any, g: any, b: any): string;
  436. static transform(m1: any, m2: any): any[];
  437. static applyTransform(p: any, m: any): any[];
  438. static applyInverseTransform(p: any, m: any): number[];
  439. static getAxialAlignedBoundingBox(r: any, m: any): number[];
  440. static inverseTransform(m: any): number[];
  441. static apply3dTransform(m: any, v: any): number[];
  442. static singularValueDecompose2dScale(m: any): number[];
  443. static normalizeRect(rect: any): any;
  444. static intersect(rect1: any, rect2: any): any[] | null;
  445. }
  446. export namespace VerbosityLevel {
  447. const ERRORS: number;
  448. const WARNINGS: number;
  449. const INFOS: number;
  450. }
  451. export function warn(msg: any): void;
  452. export {};