pdfjs-dist 2.1.266 → 2.2.228

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pdfjs-dist might be problematic. Click here for more details.

Files changed (166) hide show
  1. package/CODE_OF_CONDUCT.md +15 -0
  2. package/bower.json +1 -1
  3. package/build/pdf.js +3349 -2324
  4. package/build/pdf.js.map +1 -1
  5. package/build/pdf.min.js +1 -1
  6. package/build/pdf.worker.js +2804 -1975
  7. package/build/pdf.worker.js.map +1 -1
  8. package/build/pdf.worker.min.js +1 -1
  9. package/image_decoders/pdf.image_decoders.js +431 -511
  10. package/image_decoders/pdf.image_decoders.js.map +1 -1
  11. package/image_decoders/pdf.image_decoders.min.js +1 -1
  12. package/lib/core/annotation.js +294 -224
  13. package/lib/core/arithmetic_decoder.js +1 -1
  14. package/lib/core/bidi.js +1 -1
  15. package/lib/core/ccitt.js +1 -1
  16. package/lib/core/ccitt_stream.js +1 -1
  17. package/lib/core/cff_parser.js +61 -12
  18. package/lib/core/charsets.js +1 -1
  19. package/lib/core/chunked_stream.js +24 -14
  20. package/lib/core/cmap.js +17 -13
  21. package/lib/core/colorspace.js +1 -1
  22. package/lib/core/core_utils.js +147 -0
  23. package/lib/core/crypto.js +1 -1
  24. package/lib/core/document.js +47 -40
  25. package/lib/core/encodings.js +1 -1
  26. package/lib/core/evaluator.js +346 -279
  27. package/lib/core/font_renderer.js +1 -1
  28. package/lib/core/fonts.js +23 -11
  29. package/lib/core/function.js +1 -1
  30. package/lib/core/glyphlist.js +2 -2
  31. package/lib/core/image.js +2 -2
  32. package/lib/core/image_utils.js +111 -0
  33. package/lib/core/jbig2.js +1 -1
  34. package/lib/core/jbig2_stream.js +1 -1
  35. package/lib/core/jpeg_stream.js +1 -1
  36. package/lib/core/jpg.js +2 -1
  37. package/lib/core/jpx.js +1 -1
  38. package/lib/core/jpx_stream.js +1 -1
  39. package/lib/core/metrics.js +13 -13
  40. package/lib/core/murmurhash3.js +37 -33
  41. package/lib/core/obj.js +245 -41
  42. package/lib/core/operator_list.js +43 -32
  43. package/lib/core/parser.js +228 -133
  44. package/lib/core/pattern.js +4 -2
  45. package/lib/core/pdf_manager.js +17 -15
  46. package/lib/core/primitives.js +40 -6
  47. package/lib/core/ps_parser.js +1 -1
  48. package/lib/core/standard_fonts.js +9 -9
  49. package/lib/core/stream.js +1 -1
  50. package/lib/core/type1_parser.js +1 -1
  51. package/lib/core/unicode.js +2 -2
  52. package/lib/core/worker.js +54 -171
  53. package/lib/core/worker_stream.js +277 -0
  54. package/lib/display/annotation_layer.js +112 -33
  55. package/lib/display/api.js +211 -123
  56. package/lib/display/api_compatibility.js +1 -1
  57. package/lib/display/canvas.js +40 -19
  58. package/lib/display/content_disposition.js +1 -1
  59. package/lib/display/display_utils.js +747 -0
  60. package/lib/display/fetch_stream.js +19 -12
  61. package/lib/display/font_loader.js +11 -8
  62. package/lib/display/metadata.js +1 -1
  63. package/lib/display/network.js +563 -521
  64. package/lib/display/network_utils.js +1 -1
  65. package/lib/display/node_stream.js +21 -12
  66. package/lib/display/pattern_helper.js +24 -25
  67. package/lib/display/svg.js +1068 -565
  68. package/lib/display/text_layer.js +24 -14
  69. package/lib/display/transport_stream.js +192 -70
  70. package/lib/display/webgl.js +1 -1
  71. package/lib/display/worker_options.js +1 -1
  72. package/lib/display/xml_parser.js +1 -1
  73. package/lib/examples/node/domstubs.js +4 -1
  74. package/lib/pdf.js +20 -15
  75. package/lib/pdf.worker.js +3 -3
  76. package/lib/shared/compatibility.js +6 -6
  77. package/lib/shared/global_scope.js +1 -1
  78. package/lib/shared/is_node.js +2 -2
  79. package/lib/shared/message_handler.js +7 -7
  80. package/lib/shared/streams_polyfill.js +1 -1
  81. package/lib/shared/url_polyfill.js +1 -1
  82. package/lib/shared/util.js +13 -125
  83. package/lib/test/unit/annotation_spec.js +278 -93
  84. package/lib/test/unit/api_spec.js +198 -188
  85. package/lib/test/unit/bidi_spec.js +1 -1
  86. package/lib/test/unit/cff_parser_spec.js +15 -1
  87. package/lib/test/unit/clitests_helper.js +3 -3
  88. package/lib/test/unit/cmap_spec.js +20 -20
  89. package/lib/test/unit/colorspace_spec.js +17 -12
  90. package/lib/test/unit/core_utils_spec.js +191 -0
  91. package/lib/test/unit/crypto_spec.js +1 -1
  92. package/lib/test/unit/custom_spec.js +8 -8
  93. package/lib/test/unit/display_svg_spec.js +8 -8
  94. package/lib/test/unit/display_utils_spec.js +273 -0
  95. package/lib/test/unit/document_spec.js +7 -12
  96. package/lib/test/unit/encodings_spec.js +5 -5
  97. package/lib/test/unit/evaluator_spec.js +8 -10
  98. package/lib/test/unit/fetch_stream_spec.js +109 -0
  99. package/lib/test/unit/function_spec.js +1 -1
  100. package/lib/test/unit/jasmine-boot.js +4 -4
  101. package/lib/test/unit/message_handler_spec.js +1 -1
  102. package/lib/test/unit/metadata_spec.js +1 -1
  103. package/lib/test/unit/murmurhash3_spec.js +1 -1
  104. package/lib/test/unit/network_spec.js +5 -55
  105. package/lib/test/unit/network_utils_spec.js +51 -1
  106. package/lib/test/unit/node_stream_spec.js +8 -8
  107. package/lib/test/unit/parser_spec.js +150 -86
  108. package/lib/test/unit/pdf_find_controller_spec.js +1 -1
  109. package/lib/test/unit/pdf_find_utils_spec.js +1 -1
  110. package/lib/test/unit/pdf_history_spec.js +1 -1
  111. package/lib/test/unit/primitives_spec.js +30 -17
  112. package/lib/test/unit/stream_spec.js +1 -1
  113. package/lib/test/unit/test_utils.js +197 -43
  114. package/lib/test/unit/testreporter.js +1 -1
  115. package/lib/test/unit/type1_parser_spec.js +1 -1
  116. package/lib/test/unit/ui_utils_spec.js +20 -20
  117. package/lib/test/unit/unicode_spec.js +5 -5
  118. package/lib/test/unit/util_spec.js +1 -164
  119. package/lib/web/annotation_layer_builder.js +1 -1
  120. package/lib/web/app.js +104 -60
  121. package/lib/web/app_options.js +45 -37
  122. package/lib/web/base_viewer.js +7 -7
  123. package/lib/web/chromecom.js +8 -8
  124. package/lib/web/debugger.js +7 -7
  125. package/lib/web/download_manager.js +3 -2
  126. package/lib/web/firefox_print_service.js +4 -2
  127. package/lib/web/firefoxcom.js +50 -19
  128. package/lib/web/genericcom.js +8 -8
  129. package/lib/web/genericl10n.js +10 -10
  130. package/lib/web/grab_to_pan.js +3 -1
  131. package/lib/web/interfaces.js +13 -13
  132. package/lib/web/overlay_manager.js +10 -10
  133. package/lib/web/password_prompt.js +2 -2
  134. package/lib/web/pdf_attachment_viewer.js +1 -1
  135. package/lib/web/pdf_cursor_tools.js +1 -1
  136. package/lib/web/pdf_document_properties.js +188 -119
  137. package/lib/web/pdf_find_bar.js +1 -1
  138. package/lib/web/pdf_find_controller.js +3 -3
  139. package/lib/web/pdf_find_utils.js +1 -1
  140. package/lib/web/pdf_history.js +1 -1
  141. package/lib/web/pdf_link_service.js +2 -2
  142. package/lib/web/pdf_outline_viewer.js +53 -28
  143. package/lib/web/pdf_page_view.js +9 -18
  144. package/lib/web/pdf_presentation_mode.js +1 -1
  145. package/lib/web/pdf_print_service.js +5 -3
  146. package/lib/web/pdf_rendering_queue.js +4 -7
  147. package/lib/web/pdf_sidebar.js +24 -17
  148. package/lib/web/pdf_sidebar_resizer.js +1 -1
  149. package/lib/web/pdf_single_page_viewer.js +1 -1
  150. package/lib/web/pdf_thumbnail_view.js +2 -2
  151. package/lib/web/pdf_thumbnail_viewer.js +3 -3
  152. package/lib/web/pdf_viewer.component.js +3 -3
  153. package/lib/web/pdf_viewer.js +3 -3
  154. package/lib/web/preferences.js +30 -30
  155. package/lib/web/secondary_toolbar.js +1 -1
  156. package/lib/web/text_layer_builder.js +23 -45
  157. package/lib/web/toolbar.js +1 -1
  158. package/lib/web/ui_utils.js +14 -14
  159. package/lib/web/view_history.js +15 -15
  160. package/lib/web/viewer_compatibility.js +1 -1
  161. package/package.json +1 -1
  162. package/web/pdf_viewer.css +21 -10
  163. package/web/pdf_viewer.js +126 -194
  164. package/web/pdf_viewer.js.map +1 -1
  165. package/lib/display/dom_utils.js +0 -494
  166. package/lib/test/unit/dom_utils_spec.js +0 -89
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -175,4 +175,6 @@ function isLeftMouseReleased(event) {
175
175
  if (isChrome15OrOpera15plus || isSafari6plus) {
176
176
  return event.which === 0;
177
177
  }
178
+
179
+ return false;
178
180
  }
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -204,8 +204,8 @@ function () {
204
204
  value: function () {
205
205
  var _getLanguage = _asyncToGenerator(
206
206
  /*#__PURE__*/
207
- _regenerator.default.mark(function _callee() {
208
- return _regenerator.default.wrap(function _callee$(_context) {
207
+ _regenerator["default"].mark(function _callee() {
208
+ return _regenerator["default"].wrap(function _callee$(_context) {
209
209
  while (1) {
210
210
  switch (_context.prev = _context.next) {
211
211
  case 0:
@@ -213,7 +213,7 @@ function () {
213
213
  return _context.stop();
214
214
  }
215
215
  }
216
- }, _callee, this);
216
+ }, _callee);
217
217
  }));
218
218
 
219
219
  function getLanguage() {
@@ -227,8 +227,8 @@ function () {
227
227
  value: function () {
228
228
  var _getDirection = _asyncToGenerator(
229
229
  /*#__PURE__*/
230
- _regenerator.default.mark(function _callee2() {
231
- return _regenerator.default.wrap(function _callee2$(_context2) {
230
+ _regenerator["default"].mark(function _callee2() {
231
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
232
232
  while (1) {
233
233
  switch (_context2.prev = _context2.next) {
234
234
  case 0:
@@ -236,7 +236,7 @@ function () {
236
236
  return _context2.stop();
237
237
  }
238
238
  }
239
- }, _callee2, this);
239
+ }, _callee2);
240
240
  }));
241
241
 
242
242
  function getDirection() {
@@ -250,8 +250,8 @@ function () {
250
250
  value: function () {
251
251
  var _get = _asyncToGenerator(
252
252
  /*#__PURE__*/
253
- _regenerator.default.mark(function _callee3(key, args, fallback) {
254
- return _regenerator.default.wrap(function _callee3$(_context3) {
253
+ _regenerator["default"].mark(function _callee3(key, args, fallback) {
254
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
255
255
  while (1) {
256
256
  switch (_context3.prev = _context3.next) {
257
257
  case 0:
@@ -259,7 +259,7 @@ function () {
259
259
  return _context3.stop();
260
260
  }
261
261
  }
262
- }, _callee3, this);
262
+ }, _callee3);
263
263
  }));
264
264
 
265
265
  function get(_x, _x2, _x3) {
@@ -273,8 +273,8 @@ function () {
273
273
  value: function () {
274
274
  var _translate = _asyncToGenerator(
275
275
  /*#__PURE__*/
276
- _regenerator.default.mark(function _callee4(element) {
277
- return _regenerator.default.wrap(function _callee4$(_context4) {
276
+ _regenerator["default"].mark(function _callee4(element) {
277
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
278
278
  while (1) {
279
279
  switch (_context4.prev = _context4.next) {
280
280
  case 0:
@@ -282,7 +282,7 @@ function () {
282
282
  return _context4.stop();
283
283
  }
284
284
  }
285
- }, _callee4, this);
285
+ }, _callee4);
286
286
  }));
287
287
 
288
288
  function translate(_x4) {
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@ exports.OverlayManager = void 0;
28
28
 
29
29
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
30
30
 
31
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
32
32
 
33
33
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
34
34
 
@@ -56,12 +56,12 @@ function () {
56
56
  value: function () {
57
57
  var _register = _asyncToGenerator(
58
58
  /*#__PURE__*/
59
- _regenerator.default.mark(function _callee(name, element) {
59
+ _regenerator["default"].mark(function _callee(name, element) {
60
60
  var callerCloseMethod,
61
61
  canForceClose,
62
62
  container,
63
63
  _args = arguments;
64
- return _regenerator.default.wrap(function _callee$(_context) {
64
+ return _regenerator["default"].wrap(function _callee$(_context) {
65
65
  while (1) {
66
66
  switch (_context.prev = _context.next) {
67
67
  case 0:
@@ -110,8 +110,8 @@ function () {
110
110
  value: function () {
111
111
  var _unregister = _asyncToGenerator(
112
112
  /*#__PURE__*/
113
- _regenerator.default.mark(function _callee2(name) {
114
- return _regenerator.default.wrap(function _callee2$(_context2) {
113
+ _regenerator["default"].mark(function _callee2(name) {
114
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
115
115
  while (1) {
116
116
  switch (_context2.prev = _context2.next) {
117
117
  case 0:
@@ -152,8 +152,8 @@ function () {
152
152
  value: function () {
153
153
  var _open = _asyncToGenerator(
154
154
  /*#__PURE__*/
155
- _regenerator.default.mark(function _callee3(name) {
156
- return _regenerator.default.wrap(function _callee3$(_context3) {
155
+ _regenerator["default"].mark(function _callee3(name) {
156
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
157
157
  while (1) {
158
158
  switch (_context3.prev = _context3.next) {
159
159
  case 0:
@@ -219,8 +219,8 @@ function () {
219
219
  value: function () {
220
220
  var _close = _asyncToGenerator(
221
221
  /*#__PURE__*/
222
- _regenerator.default.mark(function _callee4(name) {
223
- return _regenerator.default.wrap(function _callee4$(_context4) {
222
+ _regenerator["default"].mark(function _callee4(name) {
223
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
224
224
  while (1) {
225
225
  switch (_context4.prev = _context4.next) {
226
226
  case 0:
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -103,7 +103,7 @@ function () {
103
103
 
104
104
  if (password && password.length > 0) {
105
105
  this.close();
106
- return this.updateCallback(password);
106
+ this.updateCallback(password);
107
107
  }
108
108
  }
109
109
  }, {
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -26,10 +26,18 @@ Object.defineProperty(exports, "__esModule", {
26
26
  });
27
27
  exports.PDFDocumentProperties = void 0;
28
28
 
29
- var _ui_utils = require("./ui_utils");
29
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
30
30
 
31
31
  var _pdf = require("../pdf");
32
32
 
33
+ var _ui_utils = require("./ui_utils");
34
+
35
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
36
+
37
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
38
+
39
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
40
+
33
41
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
34
42
 
35
43
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
@@ -252,136 +260,197 @@ function () {
252
260
  }
253
261
  }, {
254
262
  key: "_parseFileSize",
255
- value: function _parseFileSize() {
256
- var fileSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
257
- var kb = fileSize / 1024;
258
-
259
- if (!kb) {
260
- return Promise.resolve(undefined);
261
- } else if (kb < 1024) {
262
- return this.l10n.get('document_properties_kb', {
263
- size_kb: (+kb.toPrecision(3)).toLocaleString(),
264
- size_b: fileSize.toLocaleString()
265
- }, '{{size_kb}} KB ({{size_b}} bytes)');
263
+ value: function () {
264
+ var _parseFileSize2 = _asyncToGenerator(
265
+ /*#__PURE__*/
266
+ _regenerator["default"].mark(function _callee() {
267
+ var fileSize,
268
+ kb,
269
+ _args = arguments;
270
+ return _regenerator["default"].wrap(function _callee$(_context) {
271
+ while (1) {
272
+ switch (_context.prev = _context.next) {
273
+ case 0:
274
+ fileSize = _args.length > 0 && _args[0] !== undefined ? _args[0] : 0;
275
+ kb = fileSize / 1024;
276
+
277
+ if (kb) {
278
+ _context.next = 6;
279
+ break;
280
+ }
281
+
282
+ return _context.abrupt("return", undefined);
283
+
284
+ case 6:
285
+ if (!(kb < 1024)) {
286
+ _context.next = 8;
287
+ break;
288
+ }
289
+
290
+ return _context.abrupt("return", this.l10n.get('document_properties_kb', {
291
+ size_kb: (+kb.toPrecision(3)).toLocaleString(),
292
+ size_b: fileSize.toLocaleString()
293
+ }, '{{size_kb}} KB ({{size_b}} bytes)'));
294
+
295
+ case 8:
296
+ return _context.abrupt("return", this.l10n.get('document_properties_mb', {
297
+ size_mb: (+(kb / 1024).toPrecision(3)).toLocaleString(),
298
+ size_b: fileSize.toLocaleString()
299
+ }, '{{size_mb}} MB ({{size_b}} bytes)'));
300
+
301
+ case 9:
302
+ case "end":
303
+ return _context.stop();
304
+ }
305
+ }
306
+ }, _callee, this);
307
+ }));
308
+
309
+ function _parseFileSize() {
310
+ return _parseFileSize2.apply(this, arguments);
266
311
  }
267
312
 
268
- return this.l10n.get('document_properties_mb', {
269
- size_mb: (+(kb / 1024).toPrecision(3)).toLocaleString(),
270
- size_b: fileSize.toLocaleString()
271
- }, '{{size_mb}} MB ({{size_b}} bytes)');
272
- }
313
+ return _parseFileSize;
314
+ }()
273
315
  }, {
274
316
  key: "_parsePageSize",
275
- value: function _parsePageSize(pageSizeInches, pagesRotation) {
276
- var _this3 = this;
277
-
278
- if (!pageSizeInches) {
279
- return Promise.resolve(undefined);
280
- }
281
-
282
- if (pagesRotation % 180 !== 0) {
283
- pageSizeInches = {
284
- width: pageSizeInches.height,
285
- height: pageSizeInches.width
286
- };
287
- }
288
-
289
- var isPortrait = (0, _ui_utils.isPortraitOrientation)(pageSizeInches);
290
- var sizeInches = {
291
- width: Math.round(pageSizeInches.width * 100) / 100,
292
- height: Math.round(pageSizeInches.height * 100) / 100
293
- };
294
- var sizeMillimeters = {
295
- width: Math.round(pageSizeInches.width * 25.4 * 10) / 10,
296
- height: Math.round(pageSizeInches.height * 25.4 * 10) / 10
297
- };
298
- var pageName = null;
299
- var name = getPageName(sizeInches, isPortrait, US_PAGE_NAMES) || getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES);
300
-
301
- if (!name && !(Number.isInteger(sizeMillimeters.width) && Number.isInteger(sizeMillimeters.height))) {
302
- var exactMillimeters = {
303
- width: pageSizeInches.width * 25.4,
304
- height: pageSizeInches.height * 25.4
305
- };
306
- var intMillimeters = {
307
- width: Math.round(sizeMillimeters.width),
308
- height: Math.round(sizeMillimeters.height)
309
- };
310
-
311
- if (Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 && Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1) {
312
- name = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES);
313
-
314
- if (name) {
315
- sizeInches = {
316
- width: Math.round(intMillimeters.width / 25.4 * 100) / 100,
317
- height: Math.round(intMillimeters.height / 25.4 * 100) / 100
318
- };
319
- sizeMillimeters = intMillimeters;
317
+ value: function () {
318
+ var _parsePageSize2 = _asyncToGenerator(
319
+ /*#__PURE__*/
320
+ _regenerator["default"].mark(function _callee2(pageSizeInches, pagesRotation) {
321
+ var _this3 = this;
322
+
323
+ var isPortrait, sizeInches, sizeMillimeters, pageName, name, exactMillimeters, intMillimeters;
324
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
325
+ while (1) {
326
+ switch (_context2.prev = _context2.next) {
327
+ case 0:
328
+ if (pageSizeInches) {
329
+ _context2.next = 2;
330
+ break;
331
+ }
332
+
333
+ return _context2.abrupt("return", undefined);
334
+
335
+ case 2:
336
+ if (pagesRotation % 180 !== 0) {
337
+ pageSizeInches = {
338
+ width: pageSizeInches.height,
339
+ height: pageSizeInches.width
340
+ };
341
+ }
342
+
343
+ isPortrait = (0, _ui_utils.isPortraitOrientation)(pageSizeInches);
344
+ sizeInches = {
345
+ width: Math.round(pageSizeInches.width * 100) / 100,
346
+ height: Math.round(pageSizeInches.height * 100) / 100
347
+ };
348
+ sizeMillimeters = {
349
+ width: Math.round(pageSizeInches.width * 25.4 * 10) / 10,
350
+ height: Math.round(pageSizeInches.height * 25.4 * 10) / 10
351
+ };
352
+ pageName = null;
353
+ name = getPageName(sizeInches, isPortrait, US_PAGE_NAMES) || getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES);
354
+
355
+ if (!name && !(Number.isInteger(sizeMillimeters.width) && Number.isInteger(sizeMillimeters.height))) {
356
+ exactMillimeters = {
357
+ width: pageSizeInches.width * 25.4,
358
+ height: pageSizeInches.height * 25.4
359
+ };
360
+ intMillimeters = {
361
+ width: Math.round(sizeMillimeters.width),
362
+ height: Math.round(sizeMillimeters.height)
363
+ };
364
+
365
+ if (Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 && Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1) {
366
+ name = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES);
367
+
368
+ if (name) {
369
+ sizeInches = {
370
+ width: Math.round(intMillimeters.width / 25.4 * 100) / 100,
371
+ height: Math.round(intMillimeters.height / 25.4 * 100) / 100
372
+ };
373
+ sizeMillimeters = intMillimeters;
374
+ }
375
+ }
376
+ }
377
+
378
+ if (name) {
379
+ pageName = this.l10n.get('document_properties_page_size_name_' + name.toLowerCase(), null, name);
380
+ }
381
+
382
+ return _context2.abrupt("return", Promise.all([this._isNonMetricLocale ? sizeInches : sizeMillimeters, this.l10n.get('document_properties_page_size_unit_' + (this._isNonMetricLocale ? 'inches' : 'millimeters'), null, this._isNonMetricLocale ? 'in' : 'mm'), pageName, this.l10n.get('document_properties_page_size_orientation_' + (isPortrait ? 'portrait' : 'landscape'), null, isPortrait ? 'portrait' : 'landscape')]).then(function (_ref6) {
383
+ var _ref7 = _slicedToArray(_ref6, 4),
384
+ _ref7$ = _ref7[0],
385
+ width = _ref7$.width,
386
+ height = _ref7$.height,
387
+ unit = _ref7[1],
388
+ name = _ref7[2],
389
+ orientation = _ref7[3];
390
+
391
+ return _this3.l10n.get('document_properties_page_size_dimension_' + (name ? 'name_' : '') + 'string', {
392
+ width: width.toLocaleString(),
393
+ height: height.toLocaleString(),
394
+ unit: unit,
395
+ name: name,
396
+ orientation: orientation
397
+ }, '{{width}} × {{height}} {{unit}} (' + (name ? '{{name}}, ' : '') + '{{orientation}})');
398
+ }));
399
+
400
+ case 11:
401
+ case "end":
402
+ return _context2.stop();
403
+ }
320
404
  }
321
- }
322
- }
405
+ }, _callee2, this);
406
+ }));
323
407
 
324
- if (name) {
325
- pageName = this.l10n.get('document_properties_page_size_name_' + name.toLowerCase(), null, name);
408
+ function _parsePageSize(_x, _x2) {
409
+ return _parsePageSize2.apply(this, arguments);
326
410
  }
327
411
 
328
- return Promise.all([this._isNonMetricLocale ? sizeInches : sizeMillimeters, this.l10n.get('document_properties_page_size_unit_' + (this._isNonMetricLocale ? 'inches' : 'millimeters'), null, this._isNonMetricLocale ? 'in' : 'mm'), pageName, this.l10n.get('document_properties_page_size_orientation_' + (isPortrait ? 'portrait' : 'landscape'), null, isPortrait ? 'portrait' : 'landscape')]).then(function (_ref6) {
329
- var _ref7 = _slicedToArray(_ref6, 4),
330
- _ref7$ = _ref7[0],
331
- width = _ref7$.width,
332
- height = _ref7$.height,
333
- unit = _ref7[1],
334
- name = _ref7[2],
335
- orientation = _ref7[3];
336
-
337
- return _this3.l10n.get('document_properties_page_size_dimension_' + (name ? 'name_' : '') + 'string', {
338
- width: width.toLocaleString(),
339
- height: height.toLocaleString(),
340
- unit: unit,
341
- name: name,
342
- orientation: orientation
343
- }, '{{width}} × {{height}} {{unit}} (' + (name ? '{{name}}, ' : '') + '{{orientation}})');
344
- });
345
- }
412
+ return _parsePageSize;
413
+ }()
346
414
  }, {
347
415
  key: "_parseDate",
348
- value: function _parseDate(inputDate) {
349
- if (!inputDate) {
350
- return;
351
- }
352
-
353
- var dateToParse = inputDate;
354
-
355
- if (dateToParse.substring(0, 2) === 'D:') {
356
- dateToParse = dateToParse.substring(2);
357
- }
416
+ value: function () {
417
+ var _parseDate2 = _asyncToGenerator(
418
+ /*#__PURE__*/
419
+ _regenerator["default"].mark(function _callee3(inputDate) {
420
+ var dateObject;
421
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
422
+ while (1) {
423
+ switch (_context3.prev = _context3.next) {
424
+ case 0:
425
+ dateObject = _pdf.PDFDateString.toDateObject(inputDate);
426
+
427
+ if (dateObject) {
428
+ _context3.next = 3;
429
+ break;
430
+ }
431
+
432
+ return _context3.abrupt("return", undefined);
433
+
434
+ case 3:
435
+ return _context3.abrupt("return", this.l10n.get('document_properties_date_string', {
436
+ date: dateObject.toLocaleDateString(),
437
+ time: dateObject.toLocaleTimeString()
438
+ }, '{{date}}, {{time}}'));
439
+
440
+ case 4:
441
+ case "end":
442
+ return _context3.stop();
443
+ }
444
+ }
445
+ }, _callee3, this);
446
+ }));
358
447
 
359
- var year = parseInt(dateToParse.substring(0, 4), 10);
360
- var month = parseInt(dateToParse.substring(4, 6), 10) - 1;
361
- var day = parseInt(dateToParse.substring(6, 8), 10);
362
- var hours = parseInt(dateToParse.substring(8, 10), 10);
363
- var minutes = parseInt(dateToParse.substring(10, 12), 10);
364
- var seconds = parseInt(dateToParse.substring(12, 14), 10);
365
- var utRel = dateToParse.substring(14, 15);
366
- var offsetHours = parseInt(dateToParse.substring(15, 17), 10);
367
- var offsetMinutes = parseInt(dateToParse.substring(18, 20), 10);
368
-
369
- if (utRel === '-') {
370
- hours += offsetHours;
371
- minutes += offsetMinutes;
372
- } else if (utRel === '+') {
373
- hours -= offsetHours;
374
- minutes -= offsetMinutes;
448
+ function _parseDate(_x3) {
449
+ return _parseDate2.apply(this, arguments);
375
450
  }
376
451
 
377
- var date = new Date(Date.UTC(year, month, day, hours, minutes, seconds));
378
- var dateString = date.toLocaleDateString();
379
- var timeString = date.toLocaleTimeString();
380
- return this.l10n.get('document_properties_date_string', {
381
- date: dateString,
382
- time: timeString
383
- }, '{{date}}, {{time}}');
384
- }
452
+ return _parseDate;
453
+ }()
385
454
  }, {
386
455
  key: "_parseLinearization",
387
456
  value: function _parseLinearization(isLinearized) {
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -236,8 +236,8 @@ function () {
236
236
  var pageNumber = this._selected.pageIdx + 1;
237
237
  var linkService = this._linkService;
238
238
 
239
- if (pageNumber >= 1 && pageNumber <= linkService.pagesCount && linkService.page !== pageNumber && linkService.isPageVisible && !linkService.isPageVisible(pageNumber)) {
240
- break;
239
+ if (pageNumber >= 1 && pageNumber <= linkService.pagesCount && pageNumber !== linkService.page && !linkService.isPageVisible(pageNumber)) {
240
+ return true;
241
241
  }
242
242
 
243
243
  return false;
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -99,7 +99,7 @@ function () {
99
99
  namedDest: namedDest,
100
100
  explicitDest: explicitDest
101
101
  });
102
- }).catch(function () {
102
+ })["catch"](function () {
103
103
  console.error("PDFLinkService.navigateTo: \"".concat(destRef, "\" is not ") + "a valid page reference, for dest=\"".concat(dest, "\"."));
104
104
  });
105
105