global.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. Object.defineProperty(exports, "__esModule", {
  17. value: true
  18. });
  19. exports.PDFJS = exports.isWorker = exports.globalScope = undefined;
  20. var _api = require('./api');
  21. var _dom_utils = require('./dom_utils');
  22. var _util = require('../shared/util');
  23. var _annotation_layer = require('./annotation_layer');
  24. var _metadata = require('./metadata');
  25. var _text_layer = require('./text_layer');
  26. var _svg = require('./svg');
  27. var isWorker = typeof window === 'undefined';
  28. if (!_util.globalScope.PDFJS) {
  29. _util.globalScope.PDFJS = {};
  30. }
  31. var PDFJS = _util.globalScope.PDFJS;
  32. {
  33. PDFJS.version = '1.9.430';
  34. PDFJS.build = '60225003';
  35. }
  36. PDFJS.pdfBug = false;
  37. if (PDFJS.verbosity !== undefined) {
  38. (0, _util.setVerbosityLevel)(PDFJS.verbosity);
  39. }
  40. delete PDFJS.verbosity;
  41. Object.defineProperty(PDFJS, 'verbosity', {
  42. get: function get() {
  43. return (0, _util.getVerbosityLevel)();
  44. },
  45. set: function set(level) {
  46. (0, _util.setVerbosityLevel)(level);
  47. },
  48. enumerable: true,
  49. configurable: true
  50. });
  51. PDFJS.VERBOSITY_LEVELS = _util.VERBOSITY_LEVELS;
  52. PDFJS.OPS = _util.OPS;
  53. PDFJS.UNSUPPORTED_FEATURES = _util.UNSUPPORTED_FEATURES;
  54. PDFJS.isValidUrl = _dom_utils.isValidUrl;
  55. PDFJS.shadow = _util.shadow;
  56. PDFJS.createBlob = _util.createBlob;
  57. PDFJS.createObjectURL = function PDFJS_createObjectURL(data, contentType) {
  58. return (0, _util.createObjectURL)(data, contentType, PDFJS.disableCreateObjectURL);
  59. };
  60. Object.defineProperty(PDFJS, 'isLittleEndian', {
  61. configurable: true,
  62. get: function PDFJS_isLittleEndian() {
  63. return (0, _util.shadow)(PDFJS, 'isLittleEndian', (0, _util.isLittleEndian)());
  64. }
  65. });
  66. PDFJS.removeNullCharacters = _util.removeNullCharacters;
  67. PDFJS.PasswordResponses = _util.PasswordResponses;
  68. PDFJS.PasswordException = _util.PasswordException;
  69. PDFJS.UnknownErrorException = _util.UnknownErrorException;
  70. PDFJS.InvalidPDFException = _util.InvalidPDFException;
  71. PDFJS.MissingPDFException = _util.MissingPDFException;
  72. PDFJS.UnexpectedResponseException = _util.UnexpectedResponseException;
  73. PDFJS.Util = _util.Util;
  74. PDFJS.PageViewport = _util.PageViewport;
  75. PDFJS.createPromiseCapability = _util.createPromiseCapability;
  76. PDFJS.maxImageSize = PDFJS.maxImageSize === undefined ? -1 : PDFJS.maxImageSize;
  77. PDFJS.cMapUrl = PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl;
  78. PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked;
  79. PDFJS.disableFontFace = PDFJS.disableFontFace === undefined ? false : PDFJS.disableFontFace;
  80. PDFJS.imageResourcesPath = PDFJS.imageResourcesPath === undefined ? '' : PDFJS.imageResourcesPath;
  81. PDFJS.disableWorker = PDFJS.disableWorker === undefined ? false : PDFJS.disableWorker;
  82. PDFJS.workerSrc = PDFJS.workerSrc === undefined ? null : PDFJS.workerSrc;
  83. PDFJS.workerPort = PDFJS.workerPort === undefined ? null : PDFJS.workerPort;
  84. PDFJS.disableRange = PDFJS.disableRange === undefined ? false : PDFJS.disableRange;
  85. PDFJS.disableStream = PDFJS.disableStream === undefined ? false : PDFJS.disableStream;
  86. PDFJS.disableAutoFetch = PDFJS.disableAutoFetch === undefined ? false : PDFJS.disableAutoFetch;
  87. PDFJS.pdfBug = PDFJS.pdfBug === undefined ? false : PDFJS.pdfBug;
  88. PDFJS.postMessageTransfers = PDFJS.postMessageTransfers === undefined ? true : PDFJS.postMessageTransfers;
  89. PDFJS.disableCreateObjectURL = PDFJS.disableCreateObjectURL === undefined ? false : PDFJS.disableCreateObjectURL;
  90. PDFJS.disableWebGL = PDFJS.disableWebGL === undefined ? true : PDFJS.disableWebGL;
  91. PDFJS.externalLinkTarget = PDFJS.externalLinkTarget === undefined ? _dom_utils.LinkTarget.NONE : PDFJS.externalLinkTarget;
  92. PDFJS.externalLinkRel = PDFJS.externalLinkRel === undefined ? _dom_utils.DEFAULT_LINK_REL : PDFJS.externalLinkRel;
  93. PDFJS.isEvalSupported = PDFJS.isEvalSupported === undefined ? true : PDFJS.isEvalSupported;
  94. PDFJS.pdfjsNext = PDFJS.pdfjsNext === undefined ? false : PDFJS.pdfjsNext;
  95. {
  96. var savedOpenExternalLinksInNewWindow = PDFJS.openExternalLinksInNewWindow;
  97. delete PDFJS.openExternalLinksInNewWindow;
  98. Object.defineProperty(PDFJS, 'openExternalLinksInNewWindow', {
  99. get: function get() {
  100. return PDFJS.externalLinkTarget === _dom_utils.LinkTarget.BLANK;
  101. },
  102. set: function set(value) {
  103. if (value) {
  104. (0, _util.deprecated)('PDFJS.openExternalLinksInNewWindow, please use ' + '"PDFJS.externalLinkTarget = PDFJS.LinkTarget.BLANK" instead.');
  105. }
  106. if (PDFJS.externalLinkTarget !== _dom_utils.LinkTarget.NONE) {
  107. (0, _util.warn)('PDFJS.externalLinkTarget is already initialized');
  108. return;
  109. }
  110. PDFJS.externalLinkTarget = value ? _dom_utils.LinkTarget.BLANK : _dom_utils.LinkTarget.NONE;
  111. },
  112. enumerable: true,
  113. configurable: true
  114. });
  115. if (savedOpenExternalLinksInNewWindow) {
  116. PDFJS.openExternalLinksInNewWindow = savedOpenExternalLinksInNewWindow;
  117. }
  118. }
  119. PDFJS.getDocument = _api.getDocument;
  120. PDFJS.LoopbackPort = _api.LoopbackPort;
  121. PDFJS.PDFDataRangeTransport = _api.PDFDataRangeTransport;
  122. PDFJS.PDFWorker = _api.PDFWorker;
  123. PDFJS.hasCanvasTypedArrays = true;
  124. PDFJS.CustomStyle = _dom_utils.CustomStyle;
  125. PDFJS.LinkTarget = _dom_utils.LinkTarget;
  126. PDFJS.addLinkAttributes = _dom_utils.addLinkAttributes;
  127. PDFJS.getFilenameFromUrl = _dom_utils.getFilenameFromUrl;
  128. PDFJS.isExternalLinkTargetSet = _dom_utils.isExternalLinkTargetSet;
  129. PDFJS.AnnotationLayer = _annotation_layer.AnnotationLayer;
  130. PDFJS.renderTextLayer = _text_layer.renderTextLayer;
  131. PDFJS.Metadata = _metadata.Metadata;
  132. PDFJS.SVGGraphics = _svg.SVGGraphics;
  133. PDFJS.UnsupportedManager = _api._UnsupportedManager;
  134. exports.globalScope = _util.globalScope;
  135. exports.isWorker = isWorker;
  136. exports.PDFJS = PDFJS;