util.js 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409
  1. /* Copyright 2017 Mozilla Foundation
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. 'use strict';
  16. var compatibility = require('./compatibility.js');
  17. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
  18. var FONT_IDENTITY_MATRIX = [
  19. 0.001,
  20. 0,
  21. 0,
  22. 0.001,
  23. 0,
  24. 0
  25. ];
  26. var TextRenderingMode = {
  27. FILL: 0,
  28. STROKE: 1,
  29. FILL_STROKE: 2,
  30. INVISIBLE: 3,
  31. FILL_ADD_TO_PATH: 4,
  32. STROKE_ADD_TO_PATH: 5,
  33. FILL_STROKE_ADD_TO_PATH: 6,
  34. ADD_TO_PATH: 7,
  35. FILL_STROKE_MASK: 3,
  36. ADD_TO_PATH_FLAG: 4
  37. };
  38. var ImageKind = {
  39. GRAYSCALE_1BPP: 1,
  40. RGB_24BPP: 2,
  41. RGBA_32BPP: 3
  42. };
  43. var AnnotationType = {
  44. TEXT: 1,
  45. LINK: 2,
  46. FREETEXT: 3,
  47. LINE: 4,
  48. SQUARE: 5,
  49. CIRCLE: 6,
  50. POLYGON: 7,
  51. POLYLINE: 8,
  52. HIGHLIGHT: 9,
  53. UNDERLINE: 10,
  54. SQUIGGLY: 11,
  55. STRIKEOUT: 12,
  56. STAMP: 13,
  57. CARET: 14,
  58. INK: 15,
  59. POPUP: 16,
  60. FILEATTACHMENT: 17,
  61. SOUND: 18,
  62. MOVIE: 19,
  63. WIDGET: 20,
  64. SCREEN: 21,
  65. PRINTERMARK: 22,
  66. TRAPNET: 23,
  67. WATERMARK: 24,
  68. THREED: 25,
  69. REDACT: 26
  70. };
  71. var AnnotationFlag = {
  72. INVISIBLE: 0x01,
  73. HIDDEN: 0x02,
  74. PRINT: 0x04,
  75. NOZOOM: 0x08,
  76. NOROTATE: 0x10,
  77. NOVIEW: 0x20,
  78. READONLY: 0x40,
  79. LOCKED: 0x80,
  80. TOGGLENOVIEW: 0x100,
  81. LOCKEDCONTENTS: 0x200
  82. };
  83. var AnnotationFieldFlag = {
  84. READONLY: 0x0000001,
  85. REQUIRED: 0x0000002,
  86. NOEXPORT: 0x0000004,
  87. MULTILINE: 0x0001000,
  88. PASSWORD: 0x0002000,
  89. NOTOGGLETOOFF: 0x0004000,
  90. RADIO: 0x0008000,
  91. PUSHBUTTON: 0x0010000,
  92. COMBO: 0x0020000,
  93. EDIT: 0x0040000,
  94. SORT: 0x0080000,
  95. FILESELECT: 0x0100000,
  96. MULTISELECT: 0x0200000,
  97. DONOTSPELLCHECK: 0x0400000,
  98. DONOTSCROLL: 0x0800000,
  99. COMB: 0x1000000,
  100. RICHTEXT: 0x2000000,
  101. RADIOSINUNISON: 0x2000000,
  102. COMMITONSELCHANGE: 0x4000000
  103. };
  104. var AnnotationBorderStyleType = {
  105. SOLID: 1,
  106. DASHED: 2,
  107. BEVELED: 3,
  108. INSET: 4,
  109. UNDERLINE: 5
  110. };
  111. var StreamType = {
  112. UNKNOWN: 0,
  113. FLATE: 1,
  114. LZW: 2,
  115. DCT: 3,
  116. JPX: 4,
  117. JBIG: 5,
  118. A85: 6,
  119. AHX: 7,
  120. CCF: 8,
  121. RL: 9
  122. };
  123. var FontType = {
  124. UNKNOWN: 0,
  125. TYPE1: 1,
  126. TYPE1C: 2,
  127. CIDFONTTYPE0: 3,
  128. CIDFONTTYPE0C: 4,
  129. TRUETYPE: 5,
  130. CIDFONTTYPE2: 6,
  131. TYPE3: 7,
  132. OPENTYPE: 8,
  133. TYPE0: 9,
  134. MMTYPE1: 10
  135. };
  136. var VERBOSITY_LEVELS = {
  137. errors: 0,
  138. warnings: 1,
  139. infos: 5
  140. };
  141. var CMapCompressionType = {
  142. NONE: 0,
  143. BINARY: 1,
  144. STREAM: 2
  145. };
  146. var OPS = {
  147. dependency: 1,
  148. setLineWidth: 2,
  149. setLineCap: 3,
  150. setLineJoin: 4,
  151. setMiterLimit: 5,
  152. setDash: 6,
  153. setRenderingIntent: 7,
  154. setFlatness: 8,
  155. setGState: 9,
  156. save: 10,
  157. restore: 11,
  158. transform: 12,
  159. moveTo: 13,
  160. lineTo: 14,
  161. curveTo: 15,
  162. curveTo2: 16,
  163. curveTo3: 17,
  164. closePath: 18,
  165. rectangle: 19,
  166. stroke: 20,
  167. closeStroke: 21,
  168. fill: 22,
  169. eoFill: 23,
  170. fillStroke: 24,
  171. eoFillStroke: 25,
  172. closeFillStroke: 26,
  173. closeEOFillStroke: 27,
  174. endPath: 28,
  175. clip: 29,
  176. eoClip: 30,
  177. beginText: 31,
  178. endText: 32,
  179. setCharSpacing: 33,
  180. setWordSpacing: 34,
  181. setHScale: 35,
  182. setLeading: 36,
  183. setFont: 37,
  184. setTextRenderingMode: 38,
  185. setTextRise: 39,
  186. moveText: 40,
  187. setLeadingMoveText: 41,
  188. setTextMatrix: 42,
  189. nextLine: 43,
  190. showText: 44,
  191. showSpacedText: 45,
  192. nextLineShowText: 46,
  193. nextLineSetSpacingShowText: 47,
  194. setCharWidth: 48,
  195. setCharWidthAndBounds: 49,
  196. setStrokeColorSpace: 50,
  197. setFillColorSpace: 51,
  198. setStrokeColor: 52,
  199. setStrokeColorN: 53,
  200. setFillColor: 54,
  201. setFillColorN: 55,
  202. setStrokeGray: 56,
  203. setFillGray: 57,
  204. setStrokeRGBColor: 58,
  205. setFillRGBColor: 59,
  206. setStrokeCMYKColor: 60,
  207. setFillCMYKColor: 61,
  208. shadingFill: 62,
  209. beginInlineImage: 63,
  210. beginImageData: 64,
  211. endInlineImage: 65,
  212. paintXObject: 66,
  213. markPoint: 67,
  214. markPointProps: 68,
  215. beginMarkedContent: 69,
  216. beginMarkedContentProps: 70,
  217. endMarkedContent: 71,
  218. beginCompat: 72,
  219. endCompat: 73,
  220. paintFormXObjectBegin: 74,
  221. paintFormXObjectEnd: 75,
  222. beginGroup: 76,
  223. endGroup: 77,
  224. beginAnnotations: 78,
  225. endAnnotations: 79,
  226. beginAnnotation: 80,
  227. endAnnotation: 81,
  228. paintJpegXObject: 82,
  229. paintImageMaskXObject: 83,
  230. paintImageMaskXObjectGroup: 84,
  231. paintImageXObject: 85,
  232. paintInlineImageXObject: 86,
  233. paintInlineImageXObjectGroup: 87,
  234. paintImageXObjectRepeat: 88,
  235. paintImageMaskXObjectRepeat: 89,
  236. paintSolidColorImageMask: 90,
  237. constructPath: 91
  238. };
  239. var verbosity = VERBOSITY_LEVELS.warnings;
  240. function setVerbosityLevel(level) {
  241. verbosity = level;
  242. }
  243. function getVerbosityLevel() {
  244. return verbosity;
  245. }
  246. function info(msg) {
  247. if (verbosity >= VERBOSITY_LEVELS.infos) {
  248. console.log('Info: ' + msg);
  249. }
  250. }
  251. function warn(msg) {
  252. if (verbosity >= VERBOSITY_LEVELS.warnings) {
  253. console.log('Warning: ' + msg);
  254. }
  255. }
  256. function deprecated(details) {
  257. console.log('Deprecated API usage: ' + details);
  258. }
  259. function error(msg) {
  260. if (verbosity >= VERBOSITY_LEVELS.errors) {
  261. console.log('Error: ' + msg);
  262. console.log(backtrace());
  263. }
  264. throw new Error(msg);
  265. }
  266. function backtrace() {
  267. try {
  268. throw new Error();
  269. } catch (e) {
  270. return e.stack ? e.stack.split('\n').slice(2).join('\n') : '';
  271. }
  272. }
  273. function assert(cond, msg) {
  274. if (!cond) {
  275. error(msg);
  276. }
  277. }
  278. var UNSUPPORTED_FEATURES = {
  279. unknown: 'unknown',
  280. forms: 'forms',
  281. javaScript: 'javaScript',
  282. smask: 'smask',
  283. shadingPattern: 'shadingPattern',
  284. font: 'font'
  285. };
  286. function isSameOrigin(baseUrl, otherUrl) {
  287. try {
  288. var base = new URL(baseUrl);
  289. if (!base.origin || base.origin === 'null') {
  290. return false;
  291. }
  292. } catch (e) {
  293. return false;
  294. }
  295. var other = new URL(otherUrl, base);
  296. return base.origin === other.origin;
  297. }
  298. function isValidProtocol(url) {
  299. if (!url) {
  300. return false;
  301. }
  302. switch (url.protocol) {
  303. case 'http:':
  304. case 'https:':
  305. case 'ftp:':
  306. case 'mailto:':
  307. case 'tel:':
  308. return true;
  309. default:
  310. return false;
  311. }
  312. }
  313. function createValidAbsoluteUrl(url, baseUrl) {
  314. if (!url) {
  315. return null;
  316. }
  317. try {
  318. var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  319. if (isValidProtocol(absoluteUrl)) {
  320. return absoluteUrl;
  321. }
  322. } catch (ex) {
  323. }
  324. return null;
  325. }
  326. function shadow(obj, prop, value) {
  327. Object.defineProperty(obj, prop, {
  328. value: value,
  329. enumerable: true,
  330. configurable: true,
  331. writable: false
  332. });
  333. return value;
  334. }
  335. function getLookupTableFactory(initializer) {
  336. var lookup;
  337. return function () {
  338. if (initializer) {
  339. lookup = Object.create(null);
  340. initializer(lookup);
  341. initializer = null;
  342. }
  343. return lookup;
  344. };
  345. }
  346. var PasswordResponses = {
  347. NEED_PASSWORD: 1,
  348. INCORRECT_PASSWORD: 2
  349. };
  350. var PasswordException = function PasswordExceptionClosure() {
  351. function PasswordException(msg, code) {
  352. this.name = 'PasswordException';
  353. this.message = msg;
  354. this.code = code;
  355. }
  356. PasswordException.prototype = new Error();
  357. PasswordException.constructor = PasswordException;
  358. return PasswordException;
  359. }();
  360. var UnknownErrorException = function UnknownErrorExceptionClosure() {
  361. function UnknownErrorException(msg, details) {
  362. this.name = 'UnknownErrorException';
  363. this.message = msg;
  364. this.details = details;
  365. }
  366. UnknownErrorException.prototype = new Error();
  367. UnknownErrorException.constructor = UnknownErrorException;
  368. return UnknownErrorException;
  369. }();
  370. var InvalidPDFException = function InvalidPDFExceptionClosure() {
  371. function InvalidPDFException(msg) {
  372. this.name = 'InvalidPDFException';
  373. this.message = msg;
  374. }
  375. InvalidPDFException.prototype = new Error();
  376. InvalidPDFException.constructor = InvalidPDFException;
  377. return InvalidPDFException;
  378. }();
  379. var MissingPDFException = function MissingPDFExceptionClosure() {
  380. function MissingPDFException(msg) {
  381. this.name = 'MissingPDFException';
  382. this.message = msg;
  383. }
  384. MissingPDFException.prototype = new Error();
  385. MissingPDFException.constructor = MissingPDFException;
  386. return MissingPDFException;
  387. }();
  388. var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
  389. function UnexpectedResponseException(msg, status) {
  390. this.name = 'UnexpectedResponseException';
  391. this.message = msg;
  392. this.status = status;
  393. }
  394. UnexpectedResponseException.prototype = new Error();
  395. UnexpectedResponseException.constructor = UnexpectedResponseException;
  396. return UnexpectedResponseException;
  397. }();
  398. var NotImplementedException = function NotImplementedExceptionClosure() {
  399. function NotImplementedException(msg) {
  400. this.message = msg;
  401. }
  402. NotImplementedException.prototype = new Error();
  403. NotImplementedException.prototype.name = 'NotImplementedException';
  404. NotImplementedException.constructor = NotImplementedException;
  405. return NotImplementedException;
  406. }();
  407. var MissingDataException = function MissingDataExceptionClosure() {
  408. function MissingDataException(begin, end) {
  409. this.begin = begin;
  410. this.end = end;
  411. this.message = 'Missing data [' + begin + ', ' + end + ')';
  412. }
  413. MissingDataException.prototype = new Error();
  414. MissingDataException.prototype.name = 'MissingDataException';
  415. MissingDataException.constructor = MissingDataException;
  416. return MissingDataException;
  417. }();
  418. var XRefParseException = function XRefParseExceptionClosure() {
  419. function XRefParseException(msg) {
  420. this.message = msg;
  421. }
  422. XRefParseException.prototype = new Error();
  423. XRefParseException.prototype.name = 'XRefParseException';
  424. XRefParseException.constructor = XRefParseException;
  425. return XRefParseException;
  426. }();
  427. var NullCharactersRegExp = /\x00/g;
  428. function removeNullCharacters(str) {
  429. if (typeof str !== 'string') {
  430. warn('The argument for removeNullCharacters must be a string.');
  431. return str;
  432. }
  433. return str.replace(NullCharactersRegExp, '');
  434. }
  435. function bytesToString(bytes) {
  436. assert(bytes !== null && typeof bytes === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
  437. var length = bytes.length;
  438. var MAX_ARGUMENT_COUNT = 8192;
  439. if (length < MAX_ARGUMENT_COUNT) {
  440. return String.fromCharCode.apply(null, bytes);
  441. }
  442. var strBuf = [];
  443. for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  444. var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  445. var chunk = bytes.subarray(i, chunkEnd);
  446. strBuf.push(String.fromCharCode.apply(null, chunk));
  447. }
  448. return strBuf.join('');
  449. }
  450. function stringToBytes(str) {
  451. assert(typeof str === 'string', 'Invalid argument for stringToBytes');
  452. var length = str.length;
  453. var bytes = new Uint8Array(length);
  454. for (var i = 0; i < length; ++i) {
  455. bytes[i] = str.charCodeAt(i) & 0xFF;
  456. }
  457. return bytes;
  458. }
  459. function arrayByteLength(arr) {
  460. if (arr.length !== undefined) {
  461. return arr.length;
  462. }
  463. assert(arr.byteLength !== undefined);
  464. return arr.byteLength;
  465. }
  466. function arraysToBytes(arr) {
  467. if (arr.length === 1 && arr[0] instanceof Uint8Array) {
  468. return arr[0];
  469. }
  470. var resultLength = 0;
  471. var i, ii = arr.length;
  472. var item, itemLength;
  473. for (i = 0; i < ii; i++) {
  474. item = arr[i];
  475. itemLength = arrayByteLength(item);
  476. resultLength += itemLength;
  477. }
  478. var pos = 0;
  479. var data = new Uint8Array(resultLength);
  480. for (i = 0; i < ii; i++) {
  481. item = arr[i];
  482. if (!(item instanceof Uint8Array)) {
  483. if (typeof item === 'string') {
  484. item = stringToBytes(item);
  485. } else {
  486. item = new Uint8Array(item);
  487. }
  488. }
  489. itemLength = item.byteLength;
  490. data.set(item, pos);
  491. pos += itemLength;
  492. }
  493. return data;
  494. }
  495. function string32(value) {
  496. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  497. }
  498. function log2(x) {
  499. var n = 1, i = 0;
  500. while (x > n) {
  501. n <<= 1;
  502. i++;
  503. }
  504. return i;
  505. }
  506. function readInt8(data, start) {
  507. return data[start] << 24 >> 24;
  508. }
  509. function readUint16(data, offset) {
  510. return data[offset] << 8 | data[offset + 1];
  511. }
  512. function readUint32(data, offset) {
  513. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  514. }
  515. function isLittleEndian() {
  516. var buffer8 = new Uint8Array(2);
  517. buffer8[0] = 1;
  518. var buffer16 = new Uint16Array(buffer8.buffer);
  519. return buffer16[0] === 1;
  520. }
  521. function isEvalSupported() {
  522. try {
  523. new Function('');
  524. return true;
  525. } catch (e) {
  526. return false;
  527. }
  528. }
  529. var Uint32ArrayView = function Uint32ArrayViewClosure() {
  530. function Uint32ArrayView(buffer, length) {
  531. this.buffer = buffer;
  532. this.byteLength = buffer.length;
  533. this.length = length === undefined ? this.byteLength >> 2 : length;
  534. ensureUint32ArrayViewProps(this.length);
  535. }
  536. Uint32ArrayView.prototype = Object.create(null);
  537. var uint32ArrayViewSetters = 0;
  538. function createUint32ArrayProp(index) {
  539. return {
  540. get: function () {
  541. var buffer = this.buffer, offset = index << 2;
  542. return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
  543. },
  544. set: function (value) {
  545. var buffer = this.buffer, offset = index << 2;
  546. buffer[offset] = value & 255;
  547. buffer[offset + 1] = value >> 8 & 255;
  548. buffer[offset + 2] = value >> 16 & 255;
  549. buffer[offset + 3] = value >>> 24 & 255;
  550. }
  551. };
  552. }
  553. function ensureUint32ArrayViewProps(length) {
  554. while (uint32ArrayViewSetters < length) {
  555. Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
  556. uint32ArrayViewSetters++;
  557. }
  558. }
  559. return Uint32ArrayView;
  560. }();
  561. exports.Uint32ArrayView = Uint32ArrayView;
  562. var IDENTITY_MATRIX = [
  563. 1,
  564. 0,
  565. 0,
  566. 1,
  567. 0,
  568. 0
  569. ];
  570. var Util = function UtilClosure() {
  571. function Util() {
  572. }
  573. var rgbBuf = [
  574. 'rgb(',
  575. 0,
  576. ',',
  577. 0,
  578. ',',
  579. 0,
  580. ')'
  581. ];
  582. Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
  583. rgbBuf[1] = r;
  584. rgbBuf[3] = g;
  585. rgbBuf[5] = b;
  586. return rgbBuf.join('');
  587. };
  588. Util.transform = function Util_transform(m1, m2) {
  589. return [
  590. m1[0] * m2[0] + m1[2] * m2[1],
  591. m1[1] * m2[0] + m1[3] * m2[1],
  592. m1[0] * m2[2] + m1[2] * m2[3],
  593. m1[1] * m2[2] + m1[3] * m2[3],
  594. m1[0] * m2[4] + m1[2] * m2[5] + m1[4],
  595. m1[1] * m2[4] + m1[3] * m2[5] + m1[5]
  596. ];
  597. };
  598. Util.applyTransform = function Util_applyTransform(p, m) {
  599. var xt = p[0] * m[0] + p[1] * m[2] + m[4];
  600. var yt = p[0] * m[1] + p[1] * m[3] + m[5];
  601. return [
  602. xt,
  603. yt
  604. ];
  605. };
  606. Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
  607. var d = m[0] * m[3] - m[1] * m[2];
  608. var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  609. var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  610. return [
  611. xt,
  612. yt
  613. ];
  614. };
  615. Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
  616. var p1 = Util.applyTransform(r, m);
  617. var p2 = Util.applyTransform(r.slice(2, 4), m);
  618. var p3 = Util.applyTransform([
  619. r[0],
  620. r[3]
  621. ], m);
  622. var p4 = Util.applyTransform([
  623. r[2],
  624. r[1]
  625. ], m);
  626. return [
  627. Math.min(p1[0], p2[0], p3[0], p4[0]),
  628. Math.min(p1[1], p2[1], p3[1], p4[1]),
  629. Math.max(p1[0], p2[0], p3[0], p4[0]),
  630. Math.max(p1[1], p2[1], p3[1], p4[1])
  631. ];
  632. };
  633. Util.inverseTransform = function Util_inverseTransform(m) {
  634. var d = m[0] * m[3] - m[1] * m[2];
  635. return [
  636. m[3] / d,
  637. -m[1] / d,
  638. -m[2] / d,
  639. m[0] / d,
  640. (m[2] * m[5] - m[4] * m[3]) / d,
  641. (m[4] * m[1] - m[5] * m[0]) / d
  642. ];
  643. };
  644. Util.apply3dTransform = function Util_apply3dTransform(m, v) {
  645. return [
  646. m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
  647. m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
  648. m[6] * v[0] + m[7] * v[1] + m[8] * v[2]
  649. ];
  650. };
  651. Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
  652. var transpose = [
  653. m[0],
  654. m[2],
  655. m[1],
  656. m[3]
  657. ];
  658. var a = m[0] * transpose[0] + m[1] * transpose[2];
  659. var b = m[0] * transpose[1] + m[1] * transpose[3];
  660. var c = m[2] * transpose[0] + m[3] * transpose[2];
  661. var d = m[2] * transpose[1] + m[3] * transpose[3];
  662. var first = (a + d) / 2;
  663. var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  664. var sx = first + second || 1;
  665. var sy = first - second || 1;
  666. return [
  667. Math.sqrt(sx),
  668. Math.sqrt(sy)
  669. ];
  670. };
  671. Util.normalizeRect = function Util_normalizeRect(rect) {
  672. var r = rect.slice(0);
  673. if (rect[0] > rect[2]) {
  674. r[0] = rect[2];
  675. r[2] = rect[0];
  676. }
  677. if (rect[1] > rect[3]) {
  678. r[1] = rect[3];
  679. r[3] = rect[1];
  680. }
  681. return r;
  682. };
  683. Util.intersect = function Util_intersect(rect1, rect2) {
  684. function compare(a, b) {
  685. return a - b;
  686. }
  687. var orderedX = [
  688. rect1[0],
  689. rect1[2],
  690. rect2[0],
  691. rect2[2]
  692. ].sort(compare), orderedY = [
  693. rect1[1],
  694. rect1[3],
  695. rect2[1],
  696. rect2[3]
  697. ].sort(compare), result = [];
  698. rect1 = Util.normalizeRect(rect1);
  699. rect2 = Util.normalizeRect(rect2);
  700. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  701. result[0] = orderedX[1];
  702. result[2] = orderedX[2];
  703. } else {
  704. return false;
  705. }
  706. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  707. result[1] = orderedY[1];
  708. result[3] = orderedY[2];
  709. } else {
  710. return false;
  711. }
  712. return result;
  713. };
  714. Util.sign = function Util_sign(num) {
  715. return num < 0 ? -1 : 1;
  716. };
  717. var ROMAN_NUMBER_MAP = [
  718. '',
  719. 'C',
  720. 'CC',
  721. 'CCC',
  722. 'CD',
  723. 'D',
  724. 'DC',
  725. 'DCC',
  726. 'DCCC',
  727. 'CM',
  728. '',
  729. 'X',
  730. 'XX',
  731. 'XXX',
  732. 'XL',
  733. 'L',
  734. 'LX',
  735. 'LXX',
  736. 'LXXX',
  737. 'XC',
  738. '',
  739. 'I',
  740. 'II',
  741. 'III',
  742. 'IV',
  743. 'V',
  744. 'VI',
  745. 'VII',
  746. 'VIII',
  747. 'IX'
  748. ];
  749. Util.toRoman = function Util_toRoman(number, lowerCase) {
  750. assert(isInt(number) && number > 0, 'The number should be a positive integer.');
  751. var pos, romanBuf = [];
  752. while (number >= 1000) {
  753. number -= 1000;
  754. romanBuf.push('M');
  755. }
  756. pos = number / 100 | 0;
  757. number %= 100;
  758. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  759. pos = number / 10 | 0;
  760. number %= 10;
  761. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  762. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  763. var romanStr = romanBuf.join('');
  764. return lowerCase ? romanStr.toLowerCase() : romanStr;
  765. };
  766. Util.appendToArray = function Util_appendToArray(arr1, arr2) {
  767. Array.prototype.push.apply(arr1, arr2);
  768. };
  769. Util.prependToArray = function Util_prependToArray(arr1, arr2) {
  770. Array.prototype.unshift.apply(arr1, arr2);
  771. };
  772. Util.extendObj = function extendObj(obj1, obj2) {
  773. for (var key in obj2) {
  774. obj1[key] = obj2[key];
  775. }
  776. };
  777. Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) {
  778. while (dict && !dict.has(name)) {
  779. dict = dict.get('Parent');
  780. }
  781. if (!dict) {
  782. return null;
  783. }
  784. return getArray ? dict.getArray(name) : dict.get(name);
  785. };
  786. Util.inherit = function Util_inherit(sub, base, prototype) {
  787. sub.prototype = Object.create(base.prototype);
  788. sub.prototype.constructor = sub;
  789. for (var prop in prototype) {
  790. sub.prototype[prop] = prototype[prop];
  791. }
  792. };
  793. Util.loadScript = function Util_loadScript(src, callback) {
  794. var script = document.createElement('script');
  795. var loaded = false;
  796. script.setAttribute('src', src);
  797. if (callback) {
  798. script.onload = function () {
  799. if (!loaded) {
  800. callback();
  801. }
  802. loaded = true;
  803. };
  804. }
  805. document.getElementsByTagName('head')[0].appendChild(script);
  806. };
  807. return Util;
  808. }();
  809. var PageViewport = function PageViewportClosure() {
  810. function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
  811. this.viewBox = viewBox;
  812. this.scale = scale;
  813. this.rotation = rotation;
  814. this.offsetX = offsetX;
  815. this.offsetY = offsetY;
  816. var centerX = (viewBox[2] + viewBox[0]) / 2;
  817. var centerY = (viewBox[3] + viewBox[1]) / 2;
  818. var rotateA, rotateB, rotateC, rotateD;
  819. rotation = rotation % 360;
  820. rotation = rotation < 0 ? rotation + 360 : rotation;
  821. switch (rotation) {
  822. case 180:
  823. rotateA = -1;
  824. rotateB = 0;
  825. rotateC = 0;
  826. rotateD = 1;
  827. break;
  828. case 90:
  829. rotateA = 0;
  830. rotateB = 1;
  831. rotateC = 1;
  832. rotateD = 0;
  833. break;
  834. case 270:
  835. rotateA = 0;
  836. rotateB = -1;
  837. rotateC = -1;
  838. rotateD = 0;
  839. break;
  840. default:
  841. rotateA = 1;
  842. rotateB = 0;
  843. rotateC = 0;
  844. rotateD = -1;
  845. break;
  846. }
  847. if (dontFlip) {
  848. rotateC = -rotateC;
  849. rotateD = -rotateD;
  850. }
  851. var offsetCanvasX, offsetCanvasY;
  852. var width, height;
  853. if (rotateA === 0) {
  854. offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
  855. offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
  856. width = Math.abs(viewBox[3] - viewBox[1]) * scale;
  857. height = Math.abs(viewBox[2] - viewBox[0]) * scale;
  858. } else {
  859. offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
  860. offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
  861. width = Math.abs(viewBox[2] - viewBox[0]) * scale;
  862. height = Math.abs(viewBox[3] - viewBox[1]) * scale;
  863. }
  864. this.transform = [
  865. rotateA * scale,
  866. rotateB * scale,
  867. rotateC * scale,
  868. rotateD * scale,
  869. offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY,
  870. offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY
  871. ];
  872. this.width = width;
  873. this.height = height;
  874. this.fontScale = scale;
  875. }
  876. PageViewport.prototype = {
  877. clone: function PageViewPort_clone(args) {
  878. args = args || {};
  879. var scale = 'scale' in args ? args.scale : this.scale;
  880. var rotation = 'rotation' in args ? args.rotation : this.rotation;
  881. return new PageViewport(this.viewBox.slice(), scale, rotation, this.offsetX, this.offsetY, args.dontFlip);
  882. },
  883. convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) {
  884. return Util.applyTransform([
  885. x,
  886. y
  887. ], this.transform);
  888. },
  889. convertToViewportRectangle: function PageViewport_convertToViewportRectangle(rect) {
  890. var tl = Util.applyTransform([
  891. rect[0],
  892. rect[1]
  893. ], this.transform);
  894. var br = Util.applyTransform([
  895. rect[2],
  896. rect[3]
  897. ], this.transform);
  898. return [
  899. tl[0],
  900. tl[1],
  901. br[0],
  902. br[1]
  903. ];
  904. },
  905. convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
  906. return Util.applyInverseTransform([
  907. x,
  908. y
  909. ], this.transform);
  910. }
  911. };
  912. return PageViewport;
  913. }();
  914. var PDFStringTranslateTable = [
  915. 0,
  916. 0,
  917. 0,
  918. 0,
  919. 0,
  920. 0,
  921. 0,
  922. 0,
  923. 0,
  924. 0,
  925. 0,
  926. 0,
  927. 0,
  928. 0,
  929. 0,
  930. 0,
  931. 0,
  932. 0,
  933. 0,
  934. 0,
  935. 0,
  936. 0,
  937. 0,
  938. 0,
  939. 0x2D8,
  940. 0x2C7,
  941. 0x2C6,
  942. 0x2D9,
  943. 0x2DD,
  944. 0x2DB,
  945. 0x2DA,
  946. 0x2DC,
  947. 0,
  948. 0,
  949. 0,
  950. 0,
  951. 0,
  952. 0,
  953. 0,
  954. 0,
  955. 0,
  956. 0,
  957. 0,
  958. 0,
  959. 0,
  960. 0,
  961. 0,
  962. 0,
  963. 0,
  964. 0,
  965. 0,
  966. 0,
  967. 0,
  968. 0,
  969. 0,
  970. 0,
  971. 0,
  972. 0,
  973. 0,
  974. 0,
  975. 0,
  976. 0,
  977. 0,
  978. 0,
  979. 0,
  980. 0,
  981. 0,
  982. 0,
  983. 0,
  984. 0,
  985. 0,
  986. 0,
  987. 0,
  988. 0,
  989. 0,
  990. 0,
  991. 0,
  992. 0,
  993. 0,
  994. 0,
  995. 0,
  996. 0,
  997. 0,
  998. 0,
  999. 0,
  1000. 0,
  1001. 0,
  1002. 0,
  1003. 0,
  1004. 0,
  1005. 0,
  1006. 0,
  1007. 0,
  1008. 0,
  1009. 0,
  1010. 0,
  1011. 0,
  1012. 0,
  1013. 0,
  1014. 0,
  1015. 0,
  1016. 0,
  1017. 0,
  1018. 0,
  1019. 0,
  1020. 0,
  1021. 0,
  1022. 0,
  1023. 0,
  1024. 0,
  1025. 0,
  1026. 0,
  1027. 0,
  1028. 0,
  1029. 0,
  1030. 0,
  1031. 0,
  1032. 0,
  1033. 0,
  1034. 0,
  1035. 0,
  1036. 0,
  1037. 0,
  1038. 0,
  1039. 0,
  1040. 0,
  1041. 0,
  1042. 0,
  1043. 0x2022,
  1044. 0x2020,
  1045. 0x2021,
  1046. 0x2026,
  1047. 0x2014,
  1048. 0x2013,
  1049. 0x192,
  1050. 0x2044,
  1051. 0x2039,
  1052. 0x203A,
  1053. 0x2212,
  1054. 0x2030,
  1055. 0x201E,
  1056. 0x201C,
  1057. 0x201D,
  1058. 0x2018,
  1059. 0x2019,
  1060. 0x201A,
  1061. 0x2122,
  1062. 0xFB01,
  1063. 0xFB02,
  1064. 0x141,
  1065. 0x152,
  1066. 0x160,
  1067. 0x178,
  1068. 0x17D,
  1069. 0x131,
  1070. 0x142,
  1071. 0x153,
  1072. 0x161,
  1073. 0x17E,
  1074. 0,
  1075. 0x20AC
  1076. ];
  1077. function stringToPDFString(str) {
  1078. var i, n = str.length, strBuf = [];
  1079. if (str[0] === '\xFE' && str[1] === '\xFF') {
  1080. for (i = 2; i < n; i += 2) {
  1081. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1082. }
  1083. } else {
  1084. for (i = 0; i < n; ++i) {
  1085. var code = PDFStringTranslateTable[str.charCodeAt(i)];
  1086. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1087. }
  1088. }
  1089. return strBuf.join('');
  1090. }
  1091. function stringToUTF8String(str) {
  1092. return decodeURIComponent(escape(str));
  1093. }
  1094. function utf8StringToString(str) {
  1095. return unescape(encodeURIComponent(str));
  1096. }
  1097. function isEmptyObj(obj) {
  1098. for (var key in obj) {
  1099. return false;
  1100. }
  1101. return true;
  1102. }
  1103. function isBool(v) {
  1104. return typeof v === 'boolean';
  1105. }
  1106. function isInt(v) {
  1107. return typeof v === 'number' && (v | 0) === v;
  1108. }
  1109. function isNum(v) {
  1110. return typeof v === 'number';
  1111. }
  1112. function isString(v) {
  1113. return typeof v === 'string';
  1114. }
  1115. function isArray(v) {
  1116. return v instanceof Array;
  1117. }
  1118. function isArrayBuffer(v) {
  1119. return typeof v === 'object' && v !== null && v.byteLength !== undefined;
  1120. }
  1121. function isSpace(ch) {
  1122. return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
  1123. }
  1124. function isNodeJS() {
  1125. if (typeof __pdfjsdev_webpack__ === 'undefined') {
  1126. return typeof process === 'object' && process + '' === '[object process]';
  1127. }
  1128. return false;
  1129. }
  1130. function createPromiseCapability() {
  1131. var capability = {};
  1132. capability.promise = new Promise(function (resolve, reject) {
  1133. capability.resolve = resolve;
  1134. capability.reject = reject;
  1135. });
  1136. return capability;
  1137. }
  1138. var StatTimer = function StatTimerClosure() {
  1139. function rpad(str, pad, length) {
  1140. while (str.length < length) {
  1141. str += pad;
  1142. }
  1143. return str;
  1144. }
  1145. function StatTimer() {
  1146. this.started = Object.create(null);
  1147. this.times = [];
  1148. this.enabled = true;
  1149. }
  1150. StatTimer.prototype = {
  1151. time: function StatTimer_time(name) {
  1152. if (!this.enabled) {
  1153. return;
  1154. }
  1155. if (name in this.started) {
  1156. warn('Timer is already running for ' + name);
  1157. }
  1158. this.started[name] = Date.now();
  1159. },
  1160. timeEnd: function StatTimer_timeEnd(name) {
  1161. if (!this.enabled) {
  1162. return;
  1163. }
  1164. if (!(name in this.started)) {
  1165. warn('Timer has not been started for ' + name);
  1166. }
  1167. this.times.push({
  1168. 'name': name,
  1169. 'start': this.started[name],
  1170. 'end': Date.now()
  1171. });
  1172. delete this.started[name];
  1173. },
  1174. toString: function StatTimer_toString() {
  1175. var i, ii;
  1176. var times = this.times;
  1177. var out = '';
  1178. var longest = 0;
  1179. for (i = 0, ii = times.length; i < ii; ++i) {
  1180. var name = times[i]['name'];
  1181. if (name.length > longest) {
  1182. longest = name.length;
  1183. }
  1184. }
  1185. for (i = 0, ii = times.length; i < ii; ++i) {
  1186. var span = times[i];
  1187. var duration = span.end - span.start;
  1188. out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n';
  1189. }
  1190. return out;
  1191. }
  1192. };
  1193. return StatTimer;
  1194. }();
  1195. var createBlob = function createBlob(data, contentType) {
  1196. if (typeof Blob !== 'undefined') {
  1197. return new Blob([data], { type: contentType });
  1198. }
  1199. warn('The "Blob" constructor is not supported.');
  1200. };
  1201. var createObjectURL = function createObjectURLClosure() {
  1202. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  1203. return function createObjectURL(data, contentType, forceDataSchema) {
  1204. if (!forceDataSchema && typeof URL !== 'undefined' && URL.createObjectURL) {
  1205. var blob = createBlob(data, contentType);
  1206. return URL.createObjectURL(blob);
  1207. }
  1208. var buffer = 'data:' + contentType + ';base64,';
  1209. for (var i = 0, ii = data.length; i < ii; i += 3) {
  1210. var b1 = data[i] & 0xFF;
  1211. var b2 = data[i + 1] & 0xFF;
  1212. var b3 = data[i + 2] & 0xFF;
  1213. var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4;
  1214. var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  1215. var d4 = i + 2 < ii ? b3 & 0x3F : 64;
  1216. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1217. }
  1218. return buffer;
  1219. };
  1220. }();
  1221. function MessageHandler(sourceName, targetName, comObj) {
  1222. this.sourceName = sourceName;
  1223. this.targetName = targetName;
  1224. this.comObj = comObj;
  1225. this.callbackIndex = 1;
  1226. this.postMessageTransfers = true;
  1227. var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
  1228. var ah = this.actionHandler = Object.create(null);
  1229. this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
  1230. var data = event.data;
  1231. if (data.targetName !== this.sourceName) {
  1232. return;
  1233. }
  1234. if (data.isReply) {
  1235. var callbackId = data.callbackId;
  1236. if (data.callbackId in callbacksCapabilities) {
  1237. var callback = callbacksCapabilities[callbackId];
  1238. delete callbacksCapabilities[callbackId];
  1239. if ('error' in data) {
  1240. callback.reject(data.error);
  1241. } else {
  1242. callback.resolve(data.data);
  1243. }
  1244. } else {
  1245. error('Cannot resolve callback ' + callbackId);
  1246. }
  1247. } else if (data.action in ah) {
  1248. var action = ah[data.action];
  1249. if (data.callbackId) {
  1250. var sourceName = this.sourceName;
  1251. var targetName = data.sourceName;
  1252. Promise.resolve().then(function () {
  1253. return action[0].call(action[1], data.data);
  1254. }).then(function (result) {
  1255. comObj.postMessage({
  1256. sourceName: sourceName,
  1257. targetName: targetName,
  1258. isReply: true,
  1259. callbackId: data.callbackId,
  1260. data: result
  1261. });
  1262. }, function (reason) {
  1263. if (reason instanceof Error) {
  1264. reason = reason + '';
  1265. }
  1266. comObj.postMessage({
  1267. sourceName: sourceName,
  1268. targetName: targetName,
  1269. isReply: true,
  1270. callbackId: data.callbackId,
  1271. error: reason
  1272. });
  1273. });
  1274. } else {
  1275. action[0].call(action[1], data.data);
  1276. }
  1277. } else {
  1278. error('Unknown action from worker: ' + data.action);
  1279. }
  1280. }.bind(this);
  1281. comObj.addEventListener('message', this._onComObjOnMessage);
  1282. }
  1283. MessageHandler.prototype = {
  1284. on: function messageHandlerOn(actionName, handler, scope) {
  1285. var ah = this.actionHandler;
  1286. if (ah[actionName]) {
  1287. error('There is already an actionName called "' + actionName + '"');
  1288. }
  1289. ah[actionName] = [
  1290. handler,
  1291. scope
  1292. ];
  1293. },
  1294. send: function messageHandlerSend(actionName, data, transfers) {
  1295. var message = {
  1296. sourceName: this.sourceName,
  1297. targetName: this.targetName,
  1298. action: actionName,
  1299. data: data
  1300. };
  1301. this.postMessage(message, transfers);
  1302. },
  1303. sendWithPromise: function messageHandlerSendWithPromise(actionName, data, transfers) {
  1304. var callbackId = this.callbackIndex++;
  1305. var message = {
  1306. sourceName: this.sourceName,
  1307. targetName: this.targetName,
  1308. action: actionName,
  1309. data: data,
  1310. callbackId: callbackId
  1311. };
  1312. var capability = createPromiseCapability();
  1313. this.callbacksCapabilities[callbackId] = capability;
  1314. try {
  1315. this.postMessage(message, transfers);
  1316. } catch (e) {
  1317. capability.reject(e);
  1318. }
  1319. return capability.promise;
  1320. },
  1321. postMessage: function (message, transfers) {
  1322. if (transfers && this.postMessageTransfers) {
  1323. this.comObj.postMessage(message, transfers);
  1324. } else {
  1325. this.comObj.postMessage(message);
  1326. }
  1327. },
  1328. destroy: function () {
  1329. this.comObj.removeEventListener('message', this._onComObjOnMessage);
  1330. }
  1331. };
  1332. function loadJpegStream(id, imageUrl, objs) {
  1333. var img = new Image();
  1334. img.onload = function loadJpegStream_onloadClosure() {
  1335. objs.resolve(id, img);
  1336. };
  1337. img.onerror = function loadJpegStream_onerrorClosure() {
  1338. objs.resolve(id, null);
  1339. warn('Error during JPEG image loading');
  1340. };
  1341. img.src = imageUrl;
  1342. }
  1343. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  1344. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  1345. exports.OPS = OPS;
  1346. exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
  1347. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1348. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  1349. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  1350. exports.AnnotationFlag = AnnotationFlag;
  1351. exports.AnnotationType = AnnotationType;
  1352. exports.FontType = FontType;
  1353. exports.ImageKind = ImageKind;
  1354. exports.CMapCompressionType = CMapCompressionType;
  1355. exports.InvalidPDFException = InvalidPDFException;
  1356. exports.MessageHandler = MessageHandler;
  1357. exports.MissingDataException = MissingDataException;
  1358. exports.MissingPDFException = MissingPDFException;
  1359. exports.NotImplementedException = NotImplementedException;
  1360. exports.PageViewport = PageViewport;
  1361. exports.PasswordException = PasswordException;
  1362. exports.PasswordResponses = PasswordResponses;
  1363. exports.StatTimer = StatTimer;
  1364. exports.StreamType = StreamType;
  1365. exports.TextRenderingMode = TextRenderingMode;
  1366. exports.UnexpectedResponseException = UnexpectedResponseException;
  1367. exports.UnknownErrorException = UnknownErrorException;
  1368. exports.Util = Util;
  1369. exports.XRefParseException = XRefParseException;
  1370. exports.arrayByteLength = arrayByteLength;
  1371. exports.arraysToBytes = arraysToBytes;
  1372. exports.assert = assert;
  1373. exports.bytesToString = bytesToString;
  1374. exports.createBlob = createBlob;
  1375. exports.createPromiseCapability = createPromiseCapability;
  1376. exports.createObjectURL = createObjectURL;
  1377. exports.deprecated = deprecated;
  1378. exports.error = error;
  1379. exports.getLookupTableFactory = getLookupTableFactory;
  1380. exports.getVerbosityLevel = getVerbosityLevel;
  1381. exports.globalScope = globalScope;
  1382. exports.info = info;
  1383. exports.isArray = isArray;
  1384. exports.isArrayBuffer = isArrayBuffer;
  1385. exports.isBool = isBool;
  1386. exports.isEmptyObj = isEmptyObj;
  1387. exports.isInt = isInt;
  1388. exports.isNum = isNum;
  1389. exports.isString = isString;
  1390. exports.isSpace = isSpace;
  1391. exports.isNodeJS = isNodeJS;
  1392. exports.isSameOrigin = isSameOrigin;
  1393. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  1394. exports.isLittleEndian = isLittleEndian;
  1395. exports.isEvalSupported = isEvalSupported;
  1396. exports.loadJpegStream = loadJpegStream;
  1397. exports.log2 = log2;
  1398. exports.readInt8 = readInt8;
  1399. exports.readUint16 = readUint16;
  1400. exports.readUint32 = readUint32;
  1401. exports.removeNullCharacters = removeNullCharacters;
  1402. exports.setVerbosityLevel = setVerbosityLevel;
  1403. exports.shadow = shadow;
  1404. exports.string32 = string32;
  1405. exports.stringToBytes = stringToBytes;
  1406. exports.stringToPDFString = stringToPDFString;
  1407. exports.stringToUTF8String = stringToUTF8String;
  1408. exports.utf8StringToString = utf8StringToString;
  1409. exports.warn = warn;