Bug 1444499 - Update pdf.js to version 2.0.447. r=yury

MozReview-Commit-ID: 1gbyxWQyGvK

--HG--
extra : rebase_source : ee52ae517979c650b33f2514a5fcb6b8c33eb159
This commit is contained in:
Brendan Dahl 2018-03-20 16:20:03 -07:00
Родитель 184bbb151f
Коммит 68af882f00
8 изменённых файлов: 3593 добавлений и 3340 удалений

Просмотреть файл

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.0.402 Current extension version is: 2.0.447
Taken from upstream commit: 401f3a9d Taken from upstream commit: c0b22da0

Просмотреть файл

@ -49,6 +49,8 @@ ChromeUtils.defineModuleGetter(this, "PdfjsChromeUtils",
"resource://pdf.js/PdfjsChromeUtils.jsm"); "resource://pdf.js/PdfjsChromeUtils.jsm");
ChromeUtils.defineModuleGetter(this, "PdfjsContentUtils", ChromeUtils.defineModuleGetter(this, "PdfjsContentUtils",
"resource://pdf.js/PdfjsContentUtils.jsm"); "resource://pdf.js/PdfjsContentUtils.jsm");
ChromeUtils.defineModuleGetter(this, "PdfJsDefaultPreferences",
"resource://pdf.js/PdfJsDefaultPreferences.jsm");
function getBoolPref(aPref, aDefaultValue) { function getBoolPref(aPref, aDefaultValue) {
try { try {
@ -75,35 +77,10 @@ function isDefaultHandler() {
} }
function initializeDefaultPreferences() { function initializeDefaultPreferences() {
/* eslint-disable semi */
var DEFAULT_PREFERENCES =
{
"showPreviousViewOnLoad": true,
"defaultZoomValue": "",
"sidebarViewOnLoad": 0,
"cursorToolOnLoad": 0,
"enableWebGL": false,
"pdfBugEnabled": false,
"disableRange": false,
"disableStream": false,
"disableAutoFetch": false,
"disableFontFace": false,
"textLayerMode": 1,
"useOnlyCssZoom": false,
"externalLinkTarget": 0,
"renderer": "canvas",
"renderInteractiveForms": false,
"enablePrintAutoRotate": false,
"disablePageMode": false,
"disablePageLabels": false
}
/* eslint-enable semi */
var defaultBranch = Services.prefs.getDefaultBranch(PREF_PREFIX + "."); var defaultBranch = Services.prefs.getDefaultBranch(PREF_PREFIX + ".");
var defaultValue; var defaultValue;
for (var key in DEFAULT_PREFERENCES) { for (var key in PdfJsDefaultPreferences) {
defaultValue = DEFAULT_PREFERENCES[key]; defaultValue = PdfJsDefaultPreferences[key];
switch (typeof defaultValue) { switch (typeof defaultValue) {
case "boolean": case "boolean":
defaultBranch.setBoolPref(key, defaultValue); defaultBranch.setBoolPref(key, defaultValue);

Просмотреть файл

@ -0,0 +1,41 @@
/* Copyright 2017 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT MANUALLY!
//
"use strict";
var EXPORTED_SYMBOLS = ["PdfJsDefaultPreferences"];
var PdfJsDefaultPreferences = Object.freeze({
"showPreviousViewOnLoad": true,
"defaultZoomValue": "",
"sidebarViewOnLoad": 0,
"cursorToolOnLoad": 0,
"enableWebGL": false,
"pdfBugEnabled": false,
"disableRange": false,
"disableStream": false,
"disableAutoFetch": false,
"disableFontFace": false,
"textLayerMode": 1,
"useOnlyCssZoom": false,
"externalLinkTarget": 0,
"renderer": "canvas",
"renderInteractiveForms": false,
"enablePrintAutoRotate": false,
"disablePageMode": false,
"disablePageLabels": false
});

Просмотреть файл

@ -23,40 +23,18 @@ const PDF_CONTENT_TYPE = "application/pdf";
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm"); ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "PdfJsDefaultPreferences",
"resource://pdf.js/PdfJsDefaultPreferences.jsm");
var Svc = {}; var Svc = {};
XPCOMUtils.defineLazyServiceGetter(Svc, "mime", XPCOMUtils.defineLazyServiceGetter(Svc, "mime",
"@mozilla.org/mime;1", "@mozilla.org/mime;1",
"nsIMIMEService"); "nsIMIMEService");
/* eslint-disable semi */
var DEFAULT_PREFERENCES =
{
"showPreviousViewOnLoad": true,
"defaultZoomValue": "",
"sidebarViewOnLoad": 0,
"cursorToolOnLoad": 0,
"enableWebGL": false,
"pdfBugEnabled": false,
"disableRange": false,
"disableStream": false,
"disableAutoFetch": false,
"disableFontFace": false,
"textLayerMode": 1,
"useOnlyCssZoom": false,
"externalLinkTarget": 0,
"renderer": "canvas",
"renderInteractiveForms": false,
"enablePrintAutoRotate": false,
"disablePageMode": false,
"disablePageLabels": false
}
/* eslint-enable semi */
var PdfjsChromeUtils = { var PdfjsChromeUtils = {
// For security purposes when running remote, we restrict preferences // For security purposes when running remote, we restrict preferences
// content can access. // content can access.
_allowedPrefNames: Object.keys(DEFAULT_PREFERENCES), _allowedPrefNames: Object.keys(PdfJsDefaultPreferences),
_ppmm: null, _ppmm: null,
_mmg: null, _mmg: null,

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -28,7 +28,7 @@
else if(typeof exports === 'object') else if(typeof exports === 'object')
exports["pdfjs-dist/build/pdf.worker"] = factory(); exports["pdfjs-dist/build/pdf.worker"] = factory();
else else
root["pdfjs-dist/build/pdf.worker"] = root.pdfjsDistBuildPdfWorker = factory(); root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory();
})(typeof self !== 'undefined' ? self : this, function() { })(typeof self !== 'undefined' ? self : this, function() {
return /******/ (function(modules) { // webpackBootstrap return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache /******/ // The module cache
@ -105,11 +105,11 @@ return /******/ (function(modules) { // webpackBootstrap
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined; exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.getInheritableProperty = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined;
__w_pdfjs_require__(21); __w_pdfjs_require__(21);
var _streams_polyfill = __w_pdfjs_require__(22); var _streams_polyfill = __w_pdfjs_require__(23);
var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
const NativeImageDecoding = { const NativeImageDecoding = {
@ -627,6 +627,29 @@ function isEvalSupported() {
return false; return false;
} }
} }
function getInheritableProperty({ dict, key, getArray = false, stopWhenFound = true }) {
const LOOP_LIMIT = 100;
let loopCount = 0;
let values;
while (dict) {
const value = getArray ? dict.getArray(key) : dict.get(key);
if (value !== undefined) {
if (stopWhenFound) {
return value;
}
if (!values) {
values = [];
}
values.push(value);
}
if (++loopCount > LOOP_LIMIT) {
warn(`getInheritableProperty: maximum loop count exceeded for "${key}"`);
break;
}
dict = dict.get('Parent');
}
return values;
}
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
var Util = function UtilClosure() { var Util = function UtilClosure() {
function Util() {} function Util() {}
@ -742,15 +765,6 @@ var Util = function UtilClosure() {
obj1[key] = obj2[key]; obj1[key] = obj2[key];
} }
}; };
Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) {
while (dict && !dict.has(name)) {
dict = dict.get('Parent');
}
if (!dict) {
return null;
}
return getArray ? dict.getArray(name) : dict.get(name);
};
Util.inherit = function Util_inherit(sub, base, prototype) { Util.inherit = function Util_inherit(sub, base, prototype) {
sub.prototype = Object.create(base.prototype); sub.prototype = Object.create(base.prototype);
sub.prototype.constructor = sub; sub.prototype.constructor = sub;
@ -1349,6 +1363,7 @@ exports.createBlob = createBlob;
exports.createPromiseCapability = createPromiseCapability; exports.createPromiseCapability = createPromiseCapability;
exports.createObjectURL = createObjectURL; exports.createObjectURL = createObjectURL;
exports.deprecated = deprecated; exports.deprecated = deprecated;
exports.getInheritableProperty = getInheritableProperty;
exports.getLookupTableFactory = getLookupTableFactory; exports.getLookupTableFactory = getLookupTableFactory;
exports.getVerbosityLevel = getVerbosityLevel; exports.getVerbosityLevel = getVerbosityLevel;
exports.info = info; exports.info = info;
@ -3606,13 +3621,13 @@ var _util = __w_pdfjs_require__(0);
var _primitives = __w_pdfjs_require__(1); var _primitives = __w_pdfjs_require__(1);
var _ccitt_stream = __w_pdfjs_require__(26); var _ccitt_stream = __w_pdfjs_require__(27);
var _jbig2_stream = __w_pdfjs_require__(27); var _jbig2_stream = __w_pdfjs_require__(28);
var _jpeg_stream = __w_pdfjs_require__(6); var _jpeg_stream = __w_pdfjs_require__(6);
var _jpx_stream = __w_pdfjs_require__(30); var _jpx_stream = __w_pdfjs_require__(31);
const MAX_LENGTH_TO_CACHE = 1000; const MAX_LENGTH_TO_CACHE = 1000;
const MAX_ADLER32_LENGTH = 5552; const MAX_ADLER32_LENGTH = 5552;
@ -4598,7 +4613,7 @@ var _stream = __w_pdfjs_require__(2);
var _primitives = __w_pdfjs_require__(1); var _primitives = __w_pdfjs_require__(1);
var _jpg = __w_pdfjs_require__(29); var _jpg = __w_pdfjs_require__(30);
let JpegStream = function JpegStreamClosure() { let JpegStream = function JpegStreamClosure() {
function JpegStream(stream, maybeLength, dict, params) { function JpegStream(stream, maybeLength, dict, params) {
@ -10648,16 +10663,26 @@ var Catalog = function CatalogClosure() {
return; return;
} }
count = currentNode.get('Count'); count = currentNode.get('Count');
var objId = currentNode.objId; if (Number.isInteger(count) && count >= 0) {
if (objId && !pageKidsCountCache.has(objId)) { var objId = currentNode.objId;
pageKidsCountCache.put(objId, count); if (objId && !pageKidsCountCache.has(objId)) {
} pageKidsCountCache.put(objId, count);
if (currentPageIndex + count <= pageIndex) { }
currentPageIndex += count; if (currentPageIndex + count <= pageIndex) {
continue; currentPageIndex += count;
continue;
}
} }
var kids = currentNode.get('Kids'); var kids = currentNode.get('Kids');
if (!Array.isArray(kids)) { if (!Array.isArray(kids)) {
if ((0, _primitives.isName)(currentNode.get('Type'), 'Page') || !currentNode.has('Type') && currentNode.has('Contents')) {
if (currentPageIndex === pageIndex) {
capability.resolve([currentNode, null]);
return;
}
currentPageIndex++;
continue;
}
capability.reject(new _util.FormatError('page dictionary kids object is not an array')); capability.reject(new _util.FormatError('page dictionary kids object is not an array'));
return; return;
} }
@ -10706,11 +10731,14 @@ var Catalog = function CatalogClosure() {
if (!(0, _primitives.isRef)(kid)) { if (!(0, _primitives.isRef)(kid)) {
throw new _util.FormatError('kid must be a Ref.'); throw new _util.FormatError('kid must be a Ref.');
} }
if (kid.num === kidRef.num) { if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
found = true; found = true;
break; break;
} }
kidPromises.push(xref.fetchAsync(kid).then(function (kid) { kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
if (!(0, _primitives.isDict)(kid)) {
throw new _util.FormatError('kid node must be a Dict.');
}
if (kid.has('Count')) { if (kid.has('Count')) {
var count = kid.get('Count'); var count = kid.get('Count');
total += count; total += count;
@ -15884,7 +15912,7 @@ exports.CFFCompiler = exports.CFFPrivateDict = exports.CFFTopDict = exports.CFFC
var _util = __w_pdfjs_require__(0); var _util = __w_pdfjs_require__(0);
var _charsets = __w_pdfjs_require__(35); var _charsets = __w_pdfjs_require__(36);
var _encodings = __w_pdfjs_require__(4); var _encodings = __w_pdfjs_require__(4);
@ -20026,7 +20054,7 @@ var _util = __w_pdfjs_require__(0);
var _primitives = __w_pdfjs_require__(1); var _primitives = __w_pdfjs_require__(1);
var _ps_parser = __w_pdfjs_require__(41); var _ps_parser = __w_pdfjs_require__(42);
let IsEvalSupportedCached = { let IsEvalSupportedCached = {
get value() { get value() {
@ -21073,8 +21101,8 @@ exports.PostScriptCompiler = PostScriptCompiler;
"use strict"; "use strict";
var pdfjsVersion = '2.0.402'; var pdfjsVersion = '2.0.447';
var pdfjsBuild = '401f3a9d'; var pdfjsBuild = 'c0b22da0';
var pdfjsCoreWorker = __w_pdfjs_require__(20); var pdfjsCoreWorker = __w_pdfjs_require__(20);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -21092,9 +21120,9 @@ exports.WorkerMessageHandler = exports.WorkerTask = undefined;
var _util = __w_pdfjs_require__(0); var _util = __w_pdfjs_require__(0);
var _pdf_manager = __w_pdfjs_require__(24); var _pdf_manager = __w_pdfjs_require__(25);
var _is_node = __w_pdfjs_require__(44); var _is_node = __w_pdfjs_require__(45);
var _is_node2 = _interopRequireDefault(_is_node); var _is_node2 = _interopRequireDefault(_is_node);
@ -21275,7 +21303,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null; var cancelXHRs = null;
var WorkerTasks = []; var WorkerTasks = [];
let apiVersion = docParams.apiVersion; let apiVersion = docParams.apiVersion;
let workerVersion = '2.0.402'; let workerVersion = '2.0.447';
if (apiVersion !== null && apiVersion !== workerVersion) { if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`); throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
} }
@ -21462,7 +21490,7 @@ var WorkerMessageHandler = {
ensureNotTerminated(); ensureNotTerminated();
var evaluatorOptions = { var evaluatorOptions = {
forceDataSchema: data.disableCreateObjectURL, forceDataSchema: data.disableCreateObjectURL,
maxImageSize: data.maxImageSize === undefined ? -1 : data.maxImageSize, maxImageSize: data.maxImageSize,
disableFontFace: data.disableFontFace, disableFontFace: data.disableFontFace,
nativeImageDecoderSupport: data.nativeImageDecoderSupport, nativeImageDecoderSupport: data.nativeImageDecoderSupport,
ignoreErrors: data.ignoreErrors, ignoreErrors: data.ignoreErrors,
@ -21665,6 +21693,7 @@ exports.WorkerMessageHandler = WorkerMessageHandler;
"use strict"; "use strict";
const globalScope = __w_pdfjs_require__(22);
; ;
/***/ }), /***/ }),
@ -21674,6 +21703,15 @@ exports.WorkerMessageHandler = WorkerMessageHandler;
"use strict"; "use strict";
module.exports = typeof window !== 'undefined' && window.Math === Math ? window : typeof global !== 'undefined' && global.Math === Math ? global : typeof self !== 'undefined' && self.Math === Math ? self : {};
/***/ }),
/* 23 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
let isReadableStreamSupported = false; let isReadableStreamSupported = false;
if (typeof ReadableStream !== 'undefined') { if (typeof ReadableStream !== 'undefined') {
try { try {
@ -21688,11 +21726,11 @@ if (typeof ReadableStream !== 'undefined') {
if (isReadableStreamSupported) { if (isReadableStreamSupported) {
exports.ReadableStream = ReadableStream; exports.ReadableStream = ReadableStream;
} else { } else {
exports.ReadableStream = __w_pdfjs_require__(23).ReadableStream; exports.ReadableStream = __w_pdfjs_require__(24).ReadableStream;
} }
/***/ }), /***/ }),
/* 23 */ /* 24 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -24708,7 +24746,7 @@ if (isReadableStreamSupported) {
}])); }]));
/***/ }), /***/ }),
/* 24 */ /* 25 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -24723,7 +24761,7 @@ var _util = __w_pdfjs_require__(0);
var _chunked_stream = __w_pdfjs_require__(9); var _chunked_stream = __w_pdfjs_require__(9);
var _document = __w_pdfjs_require__(25); var _document = __w_pdfjs_require__(26);
var _stream = __w_pdfjs_require__(2); var _stream = __w_pdfjs_require__(2);
@ -24892,7 +24930,7 @@ exports.LocalPdfManager = LocalPdfManager;
exports.NetworkPdfManager = NetworkPdfManager; exports.NetworkPdfManager = NetworkPdfManager;
/***/ }), /***/ }),
/* 25 */ /* 26 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -24911,7 +24949,7 @@ var _util = __w_pdfjs_require__(0);
var _stream = __w_pdfjs_require__(2); var _stream = __w_pdfjs_require__(2);
var _annotation = __w_pdfjs_require__(31); var _annotation = __w_pdfjs_require__(32);
var _crypto = __w_pdfjs_require__(14); var _crypto = __w_pdfjs_require__(14);
@ -24919,7 +24957,7 @@ var _parser = __w_pdfjs_require__(5);
var _operator_list = __w_pdfjs_require__(7); var _operator_list = __w_pdfjs_require__(7);
var _evaluator = __w_pdfjs_require__(32); var _evaluator = __w_pdfjs_require__(33);
var _function = __w_pdfjs_require__(18); var _function = __w_pdfjs_require__(18);
@ -24949,59 +24987,43 @@ var Page = function PageClosure() {
}; };
} }
Page.prototype = { Page.prototype = {
getPageProp: function Page_getPageProp(key) { _getInheritableProperty(key, getArray = false) {
return this.pageDict.get(key); let value = (0, _util.getInheritableProperty)({
}, dict: this.pageDict,
getInheritedPageProp: function Page_getInheritedPageProp(key, getArray) { key,
var dict = this.pageDict, getArray,
valueArray = null, stopWhenFound: false
loopCount = 0; });
var MAX_LOOP_COUNT = 100; if (!Array.isArray(value)) {
getArray = getArray || false; return value;
while (dict) {
var value = getArray ? dict.getArray(key) : dict.get(key);
if (value !== undefined) {
if (!valueArray) {
valueArray = [];
}
valueArray.push(value);
}
if (++loopCount > MAX_LOOP_COUNT) {
(0, _util.warn)('getInheritedPageProp: maximum loop count exceeded for ' + key);
return valueArray ? valueArray[0] : undefined;
}
dict = dict.get('Parent');
} }
if (!valueArray) { if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {
return undefined; return value[0];
} }
if (valueArray.length === 1 || !(0, _primitives.isDict)(valueArray[0])) { return _primitives.Dict.merge(this.xref, value);
return valueArray[0];
}
return _primitives.Dict.merge(this.xref, valueArray);
}, },
get content() { get content() {
return this.getPageProp('Contents'); return this.pageDict.get('Contents');
}, },
get resources() { get resources() {
return (0, _util.shadow)(this, 'resources', this.getInheritedPageProp('Resources') || _primitives.Dict.empty); return (0, _util.shadow)(this, 'resources', this._getInheritableProperty('Resources') || _primitives.Dict.empty);
}, },
get mediaBox() { get mediaBox() {
var mediaBox = this.getInheritedPageProp('MediaBox', true); var mediaBox = this._getInheritableProperty('MediaBox', true);
if (!Array.isArray(mediaBox) || mediaBox.length !== 4) { if (!Array.isArray(mediaBox) || mediaBox.length !== 4) {
return (0, _util.shadow)(this, 'mediaBox', LETTER_SIZE_MEDIABOX); return (0, _util.shadow)(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
} }
return (0, _util.shadow)(this, 'mediaBox', mediaBox); return (0, _util.shadow)(this, 'mediaBox', mediaBox);
}, },
get cropBox() { get cropBox() {
var cropBox = this.getInheritedPageProp('CropBox', true); var cropBox = this._getInheritableProperty('CropBox', true);
if (!Array.isArray(cropBox) || cropBox.length !== 4) { if (!Array.isArray(cropBox) || cropBox.length !== 4) {
return (0, _util.shadow)(this, 'cropBox', this.mediaBox); return (0, _util.shadow)(this, 'cropBox', this.mediaBox);
} }
return (0, _util.shadow)(this, 'cropBox', cropBox); return (0, _util.shadow)(this, 'cropBox', cropBox);
}, },
get userUnit() { get userUnit() {
var obj = this.getPageProp('UserUnit'); var obj = this.pageDict.get('UserUnit');
if (!(0, _util.isNum)(obj) || obj <= 0) { if (!(0, _util.isNum)(obj) || obj <= 0) {
obj = DEFAULT_USER_UNIT; obj = DEFAULT_USER_UNIT;
} }
@ -25017,7 +25039,7 @@ var Page = function PageClosure() {
return (0, _util.shadow)(this, 'view', intersection || mediaBox); return (0, _util.shadow)(this, 'view', intersection || mediaBox);
}, },
get rotate() { get rotate() {
var rotate = this.getInheritedPageProp('Rotate') || 0; var rotate = this._getInheritableProperty('Rotate') || 0;
if (rotate % 90 !== 0) { if (rotate % 90 !== 0) {
rotate = 0; rotate = 0;
} else if (rotate >= 360) { } else if (rotate >= 360) {
@ -25149,7 +25171,7 @@ var Page = function PageClosure() {
}, },
get annotations() { get annotations() {
var annotations = []; var annotations = [];
var annotationRefs = this.getInheritedPageProp('Annots') || []; var annotationRefs = this._getInheritableProperty('Annots') || [];
for (var i = 0, n = annotationRefs.length; i < n; ++i) { for (var i = 0, n = annotationRefs.length; i < n; ++i) {
var annotationRef = annotationRefs[i]; var annotationRef = annotationRefs[i];
var annotation = _annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory); var annotation = _annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
@ -25415,7 +25437,7 @@ exports.Page = Page;
exports.PDFDocument = PDFDocument; exports.PDFDocument = PDFDocument;
/***/ }), /***/ }),
/* 26 */ /* 27 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -25472,7 +25494,7 @@ var CCITTFaxStream = function CCITTFaxStreamClosure() {
exports.CCITTFaxStream = CCITTFaxStream; exports.CCITTFaxStream = CCITTFaxStream;
/***/ }), /***/ }),
/* 27 */ /* 28 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -25487,7 +25509,7 @@ var _primitives = __w_pdfjs_require__(1);
var _stream = __w_pdfjs_require__(2); var _stream = __w_pdfjs_require__(2);
var _jbig = __w_pdfjs_require__(28); var _jbig = __w_pdfjs_require__(29);
var _util = __w_pdfjs_require__(0); var _util = __w_pdfjs_require__(0);
@ -25543,7 +25565,7 @@ let Jbig2Stream = function Jbig2StreamClosure() {
exports.Jbig2Stream = Jbig2Stream; exports.Jbig2Stream = Jbig2Stream;
/***/ }), /***/ }),
/* 28 */ /* 29 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -27312,7 +27334,7 @@ var Jbig2Image = function Jbig2ImageClosure() {
exports.Jbig2Image = Jbig2Image; exports.Jbig2Image = Jbig2Image;
/***/ }), /***/ }),
/* 29 */ /* 30 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -28268,7 +28290,7 @@ var JpegImage = function JpegImageClosure() {
exports.JpegImage = JpegImage; exports.JpegImage = JpegImage;
/***/ }), /***/ }),
/* 30 */ /* 31 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -28343,7 +28365,7 @@ let JpxStream = function JpxStreamClosure() {
exports.JpxStream = JpxStream; exports.JpxStream = JpxStream;
/***/ }), /***/ }),
/* 31 */ /* 32 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -28389,7 +28411,10 @@ class AnnotationFactory {
case 'Text': case 'Text':
return new TextAnnotation(parameters); return new TextAnnotation(parameters);
case 'Widget': case 'Widget':
let fieldType = _util.Util.getInheritableProperty(dict, 'FT'); let fieldType = (0, _util.getInheritableProperty)({
dict,
key: 'FT'
});
fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null; fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
switch (fieldType) { switch (fieldType) {
case 'Tx': case 'Tx':
@ -28697,13 +28722,29 @@ class WidgetAnnotation extends Annotation {
let data = this.data; let data = this.data;
data.annotationType = _util.AnnotationType.WIDGET; data.annotationType = _util.AnnotationType.WIDGET;
data.fieldName = this._constructFieldName(dict); data.fieldName = this._constructFieldName(dict);
data.fieldValue = _util.Util.getInheritableProperty(dict, 'V', true); data.fieldValue = (0, _util.getInheritableProperty)({
dict,
key: 'V',
getArray: true
});
data.alternativeText = (0, _util.stringToPDFString)(dict.get('TU') || ''); data.alternativeText = (0, _util.stringToPDFString)(dict.get('TU') || '');
data.defaultAppearance = _util.Util.getInheritableProperty(dict, 'DA') || ''; data.defaultAppearance = (0, _util.getInheritableProperty)({
let fieldType = _util.Util.getInheritableProperty(dict, 'FT'); dict,
key: 'DA'
}) || '';
let fieldType = (0, _util.getInheritableProperty)({
dict,
key: 'FT'
});
data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null; data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
this.fieldResources = _util.Util.getInheritableProperty(dict, 'DR') || _primitives.Dict.empty; this.fieldResources = (0, _util.getInheritableProperty)({
data.fieldFlags = _util.Util.getInheritableProperty(dict, 'Ff'); dict,
key: 'DR'
}) || _primitives.Dict.empty;
data.fieldFlags = (0, _util.getInheritableProperty)({
dict,
key: 'Ff'
});
if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) { if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
data.fieldFlags = 0; data.fieldFlags = 0;
} }
@ -28749,13 +28790,20 @@ class WidgetAnnotation extends Annotation {
class TextWidgetAnnotation extends WidgetAnnotation { class TextWidgetAnnotation extends WidgetAnnotation {
constructor(params) { constructor(params) {
super(params); super(params);
const dict = params.dict;
this.data.fieldValue = (0, _util.stringToPDFString)(this.data.fieldValue || ''); this.data.fieldValue = (0, _util.stringToPDFString)(this.data.fieldValue || '');
let alignment = _util.Util.getInheritableProperty(params.dict, 'Q'); let alignment = (0, _util.getInheritableProperty)({
dict,
key: 'Q'
});
if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) { if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
alignment = null; alignment = null;
} }
this.data.textAlignment = alignment; this.data.textAlignment = alignment;
let maximumLength = _util.Util.getInheritableProperty(params.dict, 'MaxLen'); let maximumLength = (0, _util.getInheritableProperty)({
dict,
key: 'MaxLen'
});
if (!Number.isInteger(maximumLength) || maximumLength < 0) { if (!Number.isInteger(maximumLength) || maximumLength < 0) {
maximumLength = null; maximumLength = null;
} }
@ -28845,7 +28893,10 @@ class ChoiceWidgetAnnotation extends WidgetAnnotation {
constructor(params) { constructor(params) {
super(params); super(params);
this.data.options = []; this.data.options = [];
let options = _util.Util.getInheritableProperty(params.dict, 'Opt'); let options = (0, _util.getInheritableProperty)({
dict: params.dict,
key: 'Opt'
});
if (Array.isArray(options)) { if (Array.isArray(options)) {
let xref = params.xref; let xref = params.xref;
for (let i = 0, ii = options.length; i < ii; i++) { for (let i = 0, ii = options.length; i < ii; i++) {
@ -29013,7 +29064,7 @@ exports.AnnotationBorderStyle = AnnotationBorderStyle;
exports.AnnotationFactory = AnnotationFactory; exports.AnnotationFactory = AnnotationFactory;
/***/ }), /***/ }),
/* 32 */ /* 33 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -29026,13 +29077,13 @@ exports.PartialEvaluator = undefined;
var _util = __w_pdfjs_require__(0); var _util = __w_pdfjs_require__(0);
var _cmap = __w_pdfjs_require__(33); var _cmap = __w_pdfjs_require__(34);
var _stream = __w_pdfjs_require__(2); var _stream = __w_pdfjs_require__(2);
var _primitives = __w_pdfjs_require__(1); var _primitives = __w_pdfjs_require__(1);
var _fonts = __w_pdfjs_require__(34); var _fonts = __w_pdfjs_require__(35);
var _encodings = __w_pdfjs_require__(4); var _encodings = __w_pdfjs_require__(4);
@ -29040,27 +29091,27 @@ var _unicode = __w_pdfjs_require__(17);
var _standard_fonts = __w_pdfjs_require__(16); var _standard_fonts = __w_pdfjs_require__(16);
var _pattern = __w_pdfjs_require__(38); var _pattern = __w_pdfjs_require__(39);
var _parser = __w_pdfjs_require__(5); var _parser = __w_pdfjs_require__(5);
var _bidi = __w_pdfjs_require__(39); var _bidi = __w_pdfjs_require__(40);
var _colorspace = __w_pdfjs_require__(3); var _colorspace = __w_pdfjs_require__(3);
var _glyphlist = __w_pdfjs_require__(8); var _glyphlist = __w_pdfjs_require__(8);
var _metrics = __w_pdfjs_require__(40); var _metrics = __w_pdfjs_require__(41);
var _function = __w_pdfjs_require__(18); var _function = __w_pdfjs_require__(18);
var _jpeg_stream = __w_pdfjs_require__(6); var _jpeg_stream = __w_pdfjs_require__(6);
var _murmurhash = __w_pdfjs_require__(42); var _murmurhash = __w_pdfjs_require__(43);
var _operator_list = __w_pdfjs_require__(7); var _operator_list = __w_pdfjs_require__(7);
var _image = __w_pdfjs_require__(43); var _image = __w_pdfjs_require__(44);
var PartialEvaluator = function PartialEvaluatorClosure() { var PartialEvaluator = function PartialEvaluatorClosure() {
const DefaultPartialEvaluatorOptions = { const DefaultPartialEvaluatorOptions = {
@ -31707,7 +31758,7 @@ var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
exports.PartialEvaluator = PartialEvaluator; exports.PartialEvaluator = PartialEvaluator;
/***/ }), /***/ }),
/* 33 */ /* 34 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -32422,7 +32473,7 @@ exports.IdentityCMap = IdentityCMap;
exports.CMapFactory = CMapFactory; exports.CMapFactory = CMapFactory;
/***/ }), /***/ }),
/* 34 */ /* 35 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -32445,11 +32496,11 @@ var _standard_fonts = __w_pdfjs_require__(16);
var _unicode = __w_pdfjs_require__(17); var _unicode = __w_pdfjs_require__(17);
var _font_renderer = __w_pdfjs_require__(36); var _font_renderer = __w_pdfjs_require__(37);
var _stream = __w_pdfjs_require__(2); var _stream = __w_pdfjs_require__(2);
var _type1_parser = __w_pdfjs_require__(37); var _type1_parser = __w_pdfjs_require__(38);
var PRIVATE_USE_OFFSET_START = 0xE000; var PRIVATE_USE_OFFSET_START = 0xE000;
var PRIVATE_USE_OFFSET_END = 0xF8FF; var PRIVATE_USE_OFFSET_END = 0xF8FF;
@ -34969,7 +35020,7 @@ exports.ProblematicCharRanges = ProblematicCharRanges;
exports.getFontType = getFontType; exports.getFontType = getFontType;
/***/ }), /***/ }),
/* 35 */ /* 36 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -34986,7 +35037,7 @@ exports.ExpertCharset = ExpertCharset;
exports.ExpertSubsetCharset = ExpertSubsetCharset; exports.ExpertSubsetCharset = ExpertSubsetCharset;
/***/ }), /***/ }),
/* 36 */ /* 37 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -35726,7 +35777,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
exports.FontRendererFactory = FontRendererFactory; exports.FontRendererFactory = FontRendererFactory;
/***/ }), /***/ }),
/* 37 */ /* 38 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -36289,7 +36340,7 @@ var Type1Parser = function Type1ParserClosure() {
exports.Type1Parser = Type1Parser; exports.Type1Parser = Type1Parser;
/***/ }), /***/ }),
/* 38 */ /* 39 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -37079,7 +37130,7 @@ exports.Pattern = Pattern;
exports.getTilingPatternIR = getTilingPatternIR; exports.getTilingPatternIR = getTilingPatternIR;
/***/ }), /***/ }),
/* 39 */ /* 40 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -37324,7 +37375,7 @@ function bidi(str, startLevel, vertical) {
exports.bidi = bidi; exports.bidi = bidi;
/***/ }), /***/ }),
/* 40 */ /* 41 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -40278,7 +40329,7 @@ var getMetrics = (0, _util.getLookupTableFactory)(function (t) {
exports.getMetrics = getMetrics; exports.getMetrics = getMetrics;
/***/ }), /***/ }),
/* 41 */ /* 42 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -40482,7 +40533,7 @@ exports.PostScriptLexer = PostScriptLexer;
exports.PostScriptParser = PostScriptParser; exports.PostScriptParser = PostScriptParser;
/***/ }), /***/ }),
/* 42 */ /* 43 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -40600,7 +40651,7 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
exports.MurmurHash3_64 = MurmurHash3_64; exports.MurmurHash3_64 = MurmurHash3_64;
/***/ }), /***/ }),
/* 43 */ /* 44 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";
@ -41124,7 +41175,7 @@ var PDFImage = function PDFImageClosure() {
exports.PDFImage = PDFImage; exports.PDFImage = PDFImage;
/***/ }), /***/ }),
/* 44 */ /* 45 */
/***/ (function(module, exports, __w_pdfjs_require__) { /***/ (function(module, exports, __w_pdfjs_require__) {
"use strict"; "use strict";

Просмотреть файл

@ -329,6 +329,13 @@ See https://github.com/adobe-type-tools/cmap-resources
<div class="row"> <div class="row">
<span data-l10n-id="document_properties_page_count">Page Count:</span> <p id="pageCountField">-</p> <span data-l10n-id="document_properties_page_count">Page Count:</span> <p id="pageCountField">-</p>
</div> </div>
<div class="row">
<span data-l10n-id="document_properties_page_size">Page Size:</span>
<p>
<span id="pageSizeFieldMM">-</span><br>
<span id="pageSizeFieldInch">-</span>
</p>
</div>
<div class="buttonRow"> <div class="buttonRow">
<button id="documentPropertiesClose" class="overlayButton"><span data-l10n-id="document_properties_close">Close</span></button> <button id="documentPropertiesClose" class="overlayButton"><span data-l10n-id="document_properties_close">Close</span></button>
</div> </div>

Разница между файлами не показана из-за своего большого размера Загрузить разницу