TagSpaces is an offline, open source, document manager with tagging support
exchnaning pdf.js with a newer version
uggrock4f215f77ea38
diff --git a/data/ext/viewerPDF/build/pdf.js b/data/ext/viewerPDF/build/pdf.jsindex cb69b433b..d3a30084d 100644--- a/data/ext/viewerPDF/build/pdf.js+++ b/data/ext/viewerPDF/build/pdf.js@@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {(typeof window !== 'undefined' ? window : this).PDFJS = {};}-PDFJS.version = '1.0.712';-PDFJS.build = '6969ed4';+PDFJS.version = '1.1.1';+PDFJS.build = 'a1e0859';(function pdfjsWrapper() {// Use strict in our context only - users might not want it@@ -341,6 +341,7 @@ function isValidUrl(url, allowRelative) {case 'https':case 'ftp':case 'mailto':+ case 'tel':return true;default:return false;@@ -355,6 +356,7 @@ function shadow(obj, prop, value) {writable: false });return value;}+PDFJS.shadow = shadow;var PasswordResponses = PDFJS.PasswordResponses = {NEED_PASSWORD: 1,@@ -373,6 +375,7 @@ var PasswordException = (function PasswordExceptionClosure() {return PasswordException;})();+PDFJS.PasswordException = PasswordException;var UnknownErrorException = (function UnknownErrorExceptionClosure() {function UnknownErrorException(msg, details) {@@ -386,6 +389,7 @@ var UnknownErrorException = (function UnknownErrorExceptionClosure() {return UnknownErrorException;})();+PDFJS.UnknownErrorException = UnknownErrorException;var InvalidPDFException = (function InvalidPDFExceptionClosure() {function InvalidPDFException(msg) {@@ -398,6 +402,7 @@ var InvalidPDFException = (function InvalidPDFExceptionClosure() {return InvalidPDFException;})();+PDFJS.InvalidPDFException = InvalidPDFException;var MissingPDFException = (function MissingPDFExceptionClosure() {function MissingPDFException(msg) {@@ -410,6 +415,22 @@ var MissingPDFException = (function MissingPDFExceptionClosure() {return MissingPDFException;})();+PDFJS.MissingPDFException = MissingPDFException;++var UnexpectedResponseException =+ (function UnexpectedResponseExceptionClosure() {+ function UnexpectedResponseException(msg, status) {+ this.name = 'UnexpectedResponseException';+ this.message = msg;+ this.status = status;+ }++ UnexpectedResponseException.prototype = new Error();+ UnexpectedResponseException.constructor = UnexpectedResponseException;++ return UnexpectedResponseException;+})();+PDFJS.UnexpectedResponseException = UnexpectedResponseException;var NotImplementedException = (function NotImplementedExceptionClosure() {function NotImplementedException(msg) {@@ -451,6 +472,8 @@ var XRefParseException = (function XRefParseExceptionClosure() {function bytesToString(bytes) {+ assert(bytes !== null && typeof bytes === 'object' &&+ bytes.length !== undefined, 'Invalid argument for bytesToString');var length = bytes.length;var MAX_ARGUMENT_COUNT = 8192;if (length < MAX_ARGUMENT_COUNT) {@@ -466,6 +489,7 @@ function bytesToString(bytes) {}function stringToBytes(str) {+ assert(typeof str === 'string', 'Invalid argument for stringToBytes');var length = str.length;var bytes = new Uint8Array(length);for (var i = 0; i < length; ++i) {@@ -582,10 +606,10 @@ var Util = PDFJS.Util = (function UtilClosure() {// makeCssRgb() can be called thousands of times. Using |rgbBuf| avoids// creating many intermediate strings.- Util.makeCssRgb = function Util_makeCssRgb(rgb) {- rgbBuf[1] = rgb[0];- rgbBuf[3] = rgb[1];- rgbBuf[5] = rgb[2];+ Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {+ rgbBuf[1] = r;+ rgbBuf[3] = g;+ rgbBuf[5] = b;return rgbBuf.join('');};@@ -979,10 +1003,6 @@ function isString(v) {return typeof v === 'string';}-function isNull(v) {- return v === null;-}-function isName(v) {return v instanceof Name;}@@ -1612,7 +1632,7 @@ PDFJS.cMapUrl = (PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl);*/PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked;-/*+/*** By default fonts are converted to OpenType fonts and loaded via font face* rules. If disabled, the font will be rendered using a built in font renderer* that constructs the glyphs with primitive path commands.@@ -1655,10 +1675,21 @@ PDFJS.workerSrc = (PDFJS.workerSrc === undefined ? null : PDFJS.workerSrc);PDFJS.disableRange = (PDFJS.disableRange === undefined ?false : PDFJS.disableRange);+/**+ * Disable streaming of PDF file data. By default PDF.js attempts to load PDF+ * in chunks. This default behavior can be disabled.+ * @var {boolean}+ */+PDFJS.disableStream = (PDFJS.disableStream === undefined ?+ false : PDFJS.disableStream);+/*** Disable pre-fetching of PDF file data. When range requests are enabled PDF.js* will automatically keep fetching more data even if it isn't needed to display* the current page. This default behavior can be disabled.+ *+ * NOTE: It is also necessary to disable streaming, see above,+ * in order for disabling of pre-fetching to work correctly.* @var {boolean}*/PDFJS.disableAutoFetch = (PDFJS.disableAutoFetch === undefined ?@@ -1691,6 +1722,14 @@ PDFJS.disableCreateObjectURL = (PDFJS.disableCreateObjectURL === undefined ?PDFJS.disableWebGL = (PDFJS.disableWebGL === undefined ?true : PDFJS.disableWebGL);+/**+ * Disables fullscreen support, and by extension Presentation Mode,+ * in browsers which support the fullscreen API.+ * @var {boolean}+ */+PDFJS.disableFullscreen = (PDFJS.disableFullscreen === undefined ?+ false : PDFJS.disableFullscreen);+/*** Enables CSS only zooming.* @var {boolean}@@ -1710,19 +1749,30 @@ PDFJS.verbosity = (PDFJS.verbosity === undefined ?PDFJS.VERBOSITY_LEVELS.warnings : PDFJS.verbosity);/**- * The maximum supported canvas size in total pixels e.g. width * height.+ * The maximum supported canvas size in total pixels e.g. width * height.* The default value is 4096 * 4096. Use -1 for no limit.* @var {number}*/PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?16777216 : PDFJS.maxCanvasPixels);+/**+ * Opens external links in a new window if enabled. The default behavior opens+ * external links in the PDF.js window.+ * @var {boolean}+ */+PDFJS.openExternalLinksInNewWindow = (+ PDFJS.openExternalLinksInNewWindow === undefined ?+ false : PDFJS.openExternalLinksInNewWindow);+/*** Document initialization / loading parameters object.** @typedef {Object} DocumentInitParameters* @property {string} url - The URL of the PDF.- * @property {TypedArray} data - A typed array with PDF data.+ * @property {TypedArray|Array|string} data - Binary PDF data. Use typed arrays+ * (Uint8Array) to improve the memory usage. If PDF data is BASE64-encoded,+ * use atob() to convert it to a binary string first.* @property {Object} httpHeaders - Basic authentication headers.* @property {boolean} withCredentials - Indicates whether or not cross-site* Access-Control requests should be made using credentials such as cookies@@ -1731,6 +1781,9 @@ PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?* @property {TypedArray} initialData - A typed array with the first portion or* all of the pdf data. Used by the extension since some data is already* loaded before the switch to range requests.+ * @property {number} length - The PDF file length. It's used for progress+ * reports and range requests operations.+ * @property {PDFDataRangeTransport} range*//**@@ -1747,63 +1800,226 @@ PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?* is used, which means it must follow the same origin rules that any XHR does* e.g. No cross domain requests without CORS.*- * @param {string|TypedArray|DocumentInitParameters} source Can be a url to- * where a PDF is located, a typed array (Uint8Array) already populated with- * data or parameter object.+ * @param {string|TypedArray|DocumentInitParameters|PDFDataRangeTransport} src+ * Can be a url to where a PDF is located, a typed array (Uint8Array)+ * already populated with data or parameter object.*- * @param {Object} pdfDataRangeTransport is optional. It is used if you want- * to manually serve range requests for data in the PDF. See viewer.js for- * an example of pdfDataRangeTransport's interface.+ * @param {PDFDataRangeTransport} pdfDataRangeTransport (deprecated) It is used+ * if you want to manually serve range requests for data in the PDF.*- * @param {function} passwordCallback is optional. It is used to request a+ * @param {function} passwordCallback (deprecated) It is used to request a* password if wrong or no password was provided. The callback receives two* parameters: function that needs to be called with new password and reason* (see {PasswordResponses}).*- * @return {Promise} A promise that is resolved with {@link PDFDocumentProxy}- * object.+ * @param {function} progressCallback (deprecated) It is used to be able to+ * monitor the loading progress of the PDF file (necessary to implement e.g.+ * a loading bar). The callback receives an {Object} with the properties:+ * {number} loaded and {number} total.+ *+ * @return {PDFDocumentLoadingTask}*/-PDFJS.getDocument = function getDocument(source,+PDFJS.getDocument = function getDocument(src,pdfDataRangeTransport,passwordCallback,progressCallback) {- var workerInitializedCapability, workerReadyCapability, transport;-- if (typeof source === 'string') {- source = { url: source };- } else if (isArrayBuffer(source)) {- source = { data: source };- } else if (typeof source !== 'object') {- error('Invalid parameter in getDocument, need either Uint8Array, ' +- 'string or a parameter object');+ var task = new PDFDocumentLoadingTask();++ // Support of the obsolete arguments (for compatibility with API v1.0)+ if (pdfDataRangeTransport) {+ if (!(pdfDataRangeTransport instanceof PDFDataRangeTransport)) {+ // Not a PDFDataRangeTransport instance, trying to add missing properties.+ pdfDataRangeTransport = Object.create(pdfDataRangeTransport);+ pdfDataRangeTransport.length = src.length;+ pdfDataRangeTransport.initialData = src.initialData;+ }+ src = Object.create(src);+ src.range = pdfDataRangeTransport;}+ task.onPassword = passwordCallback || null;+ task.onProgress = progressCallback || null;++ var workerInitializedCapability, transport;+ var source;+ if (typeof src === 'string') {+ source = { url: src };+ } else if (isArrayBuffer(src)) {+ source = { data: src };+ } else if (src instanceof PDFDataRangeTransport) {+ source = { range: src };+ } else {+ if (typeof src !== 'object') {+ error('Invalid parameter in getDocument, need either Uint8Array, ' ++ 'string or a parameter object');+ }+ if (!src.url && !src.data && !src.range) {+ error('Invalid parameter object: need either .data, .range or .url');+ }- if (!source.url && !source.data) {- error('Invalid parameter array, need either .data or .url');+ source = src;}- // copy/use all keys as is except 'url' -- full path is requiredvar params = {};for (var key in source) {if (key === 'url' && typeof window !== 'undefined') {+ // The full path is required in the 'url' field.params[key] = combineUrl(window.location.href, source[key]);continue;+ } else if (key === 'range') {+ continue;+ } else if (key === 'data' && !(source[key] instanceof Uint8Array)) {+ // Converting string or array-like data to Uint8Array.+ var pdfBytes = source[key];+ if (typeof pdfBytes === 'string') {+ params[key] = stringToBytes(pdfBytes);+ } else if (typeof pdfBytes === 'object' && pdfBytes !== null &&+ !isNaN(pdfBytes.length)) {+ params[key] = new Uint8Array(pdfBytes);+ } else {+ error('Invalid PDF binary data: either typed array, string or ' ++ 'array-like object is expected in the data property.');+ }+ continue;}params[key] = source[key];}workerInitializedCapability = createPromiseCapability();- workerReadyCapability = createPromiseCapability();- transport = new WorkerTransport(workerInitializedCapability,- workerReadyCapability, pdfDataRangeTransport,- progressCallback);+ transport = new WorkerTransport(workerInitializedCapability, source.range);workerInitializedCapability.promise.then(function transportInitialized() {- transport.passwordCallback = passwordCallback;- transport.fetchDocument(params);+ transport.fetchDocument(task, params);});- return workerReadyCapability.promise;++ return task;};+/**+ * PDF document loading operation.+ * @class+ */+var PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() {+ /** @constructs PDFDocumentLoadingTask */+ function PDFDocumentLoadingTask() {+ this._capability = createPromiseCapability();++ /**+ * Callback to request a password if wrong or no password was provided.+ * The callback receives two parameters: function that needs to be called+ * with new password and reason (see {PasswordResponses}).+ */+ this.onPassword = null;++ /**+ * Callback to be able to monitor the loading progress of the PDF file+ * (necessary to implement e.g. a loading bar). The callback receives+ * an {Object} with the properties: {number} loaded and {number} total.+ */+ this.onProgress = null;+ }++ PDFDocumentLoadingTask.prototype =+ /** @lends PDFDocumentLoadingTask.prototype */ {+ /**+ * @return {Promise}+ */+ get promise() {+ return this._capability.promise;+ },++ // TODO add cancel or abort method++ /**+ * Registers callbacks to indicate the document loading completion.+ *+ * @param {function} onFulfilled The callback for the loading completion.+ * @param {function} onRejected The callback for the loading failure.+ * @return {Promise} A promise that is resolved after the onFulfilled or+ * onRejected callback.+ */+ then: function PDFDocumentLoadingTask_then(onFulfilled, onRejected) {+ return this.promise.then.apply(this.promise, arguments);+ }+ };++ return PDFDocumentLoadingTask;+})();++/**+ * Abstract class to support range requests file loading.+ * @class+ */+var PDFDataRangeTransport = (function pdfDataRangeTransportClosure() {+ /**+ * @constructs PDFDataRangeTransport+ * @param {number} length+ * @param {Uint8Array} initialData+ */+ function PDFDataRangeTransport(length, initialData) {+ this.length = length;+ this.initialData = initialData;++ this._rangeListeners = [];+ this._progressListeners = [];+ this._progressiveReadListeners = [];+ this._readyCapability = createPromiseCapability();+ }+ PDFDataRangeTransport.prototype =+ /** @lends PDFDataRangeTransport.prototype */ {+ addRangeListener:+ function PDFDataRangeTransport_addRangeListener(listener) {+ this._rangeListeners.push(listener);+ },++ addProgressListener:+ function PDFDataRangeTransport_addProgressListener(listener) {+ this._progressListeners.push(listener);+ },++ addProgressiveReadListener:+ function PDFDataRangeTransport_addProgressiveReadListener(listener) {+ this._progressiveReadListeners.push(listener);+ },++ onDataRange: function PDFDataRangeTransport_onDataRange(begin, chunk) {+ var listeners = this._rangeListeners;+ for (var i = 0, n = listeners.length; i < n; ++i) {+ listeners[i](begin, chunk);+ }+ },++ onDataProgress: function PDFDataRangeTransport_onDataProgress(loaded) {+ this._readyCapability.promise.then(function () {+ var listeners = this._progressListeners;+ for (var i = 0, n = listeners.length; i < n; ++i) {+ listeners[i](loaded);+ }+ }.bind(this));+ },++ onDataProgressiveRead:+ function PDFDataRangeTransport_onDataProgress(chunk) {+ this._readyCapability.promise.then(function () {+ var listeners = this._progressiveReadListeners;+ for (var i = 0, n = listeners.length; i < n; ++i) {+ listeners[i](chunk);+ }+ }.bind(this));+ },++ transportReady: function PDFDataRangeTransport_transportReady() {+ this._readyCapability.resolve();+ },++ requestDataRange:+ function PDFDataRangeTransport_requestDataRange(begin, end) {+ throw new Error('Abstract method PDFDataRangeTransport.requestDataRange');+ }+ };+ return PDFDataRangeTransport;+})();++PDFJS.PDFDataRangeTransport = PDFDataRangeTransport;+/*** Proxy to a PDFDocument in the worker thread. Also, contains commonly used* properties that can be read synchronously.@@ -1848,10 +2064,20 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {/*** @return {Promise} A promise that is resolved with a lookup table for* mapping named destinations to reference numbers.+ *+ * This can be slow for large documents: use getDestination instead*/getDestinations: function PDFDocumentProxy_getDestinations() {return this.transport.getDestinations();},+ /**+ * @param {string} id The named destination to get.+ * @return {Promise} A promise that is resolved with all information+ * of the given named destination.+ */+ getDestination: function PDFDocumentProxy_getDestination(id) {+ return this.transport.getDestination(id);+ },/*** @return {Promise} A promise that is resolved with a lookup table for* mapping named attachments to their content.@@ -1909,7 +2135,7 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {return this.transport.downloadInfoCapability.promise;},/**- * @returns {Promise} A promise this is resolved with current stats about+ * @return {Promise} A promise this is resolved with current stats about* document structures (see {@link PDFDocumentStats}).*/getStats: function PDFDocumentProxy_getStats() {@@ -1973,12 +2199,12 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {* (default value is 'display').* @property {Object} imageLayer - (optional) An object that has beginLayout,* endLayout and appendImage functions.- * @property {function} continueCallback - (optional) A function that will be+ * @property {function} continueCallback - (deprecated) A function that will be* called each time the rendering is paused. To continue* rendering call the function that is the first argument* to the callback.*/-+/*** PDF page operator list.*@@ -2106,7 +2332,12 @@ var PDFPageProxy = (function PDFPageProxyClosure() {intentState.renderTasks = [];}intentState.renderTasks.push(internalRenderTask);- var renderTask = new RenderTask(internalRenderTask);+ var renderTask = internalRenderTask.task;++ // Obsolete parameter support+ if (params.continueCallback) {+ renderTask.onContinue = params.continueCallback;+ }var self = this;intentState.displayReadyCapability.promise.then(@@ -2271,19 +2502,16 @@ var PDFPageProxy = (function PDFPageProxyClosure() {* @ignore*/var WorkerTransport = (function WorkerTransportClosure() {- function WorkerTransport(workerInitializedCapability, workerReadyCapability,- pdfDataRangeTransport, progressCallback) {+ function WorkerTransport(workerInitializedCapability, pdfDataRangeTransport) {this.pdfDataRangeTransport = pdfDataRangeTransport;-this.workerInitializedCapability = workerInitializedCapability;- this.workerReadyCapability = workerReadyCapability;- this.progressCallback = progressCallback;this.commonObjs = new PDFObjects();+ this.loadingTask = null;+this.pageCache = [];this.pagePromises = [];this.downloadInfoCapability = createPromiseCapability();- this.passwordCallback = null;// If worker support isn't disabled explicit and the browser has worker// support, create a new web worker and test if it/the browser fullfills@@ -2405,6 +2633,12 @@ var WorkerTransport = (function WorkerTransportClosure() {});});+ pdfDataRangeTransport.addProgressiveReadListener(function(chunk) {+ messageHandler.send('OnDataRange', {+ chunk: chunk+ });+ });+messageHandler.on('RequestDataRange',function transportDataRange(data) {pdfDataRangeTransport.requestDataRange(data.begin, data.end);@@ -2416,45 +2650,63 @@ var WorkerTransport = (function WorkerTransportClosure() {this.numPages = data.pdfInfo.numPages;var pdfDocument = new PDFDocumentProxy(pdfInfo, this);this.pdfDocument = pdfDocument;- this.workerReadyCapability.resolve(pdfDocument);+ this.loadingTask._capability.resolve(pdfDocument);}, this);- messageHandler.on('NeedPassword', function transportPassword(data) {- if (this.passwordCallback) {- return this.passwordCallback(updatePassword,- PasswordResponses.NEED_PASSWORD);+ messageHandler.on('NeedPassword',+ function transportNeedPassword(exception) {+ var loadingTask = this.loadingTask;+ if (loadingTask.onPassword) {+ return loadingTask.onPassword(updatePassword,+ PasswordResponses.NEED_PASSWORD);}- this.workerReadyCapability.reject(data.exception.message,- data.exception);+ loadingTask._capability.reject(+ new PasswordException(exception.message, exception.code));}, this);- messageHandler.on('IncorrectPassword', function transportBadPass(data) {- if (this.passwordCallback) {- return this.passwordCallback(updatePassword,- PasswordResponses.INCORRECT_PASSWORD);+ messageHandler.on('IncorrectPassword',+ function transportIncorrectPassword(exception) {+ var loadingTask = this.loadingTask;+ if (loadingTask.onPassword) {+ return loadingTask.onPassword(updatePassword,+ PasswordResponses.INCORRECT_PASSWORD);}- this.workerReadyCapability.reject(data.exception.message,- data.exception);+ loadingTask._capability.reject(+ new PasswordException(exception.message, exception.code));}, this);- messageHandler.on('InvalidPDF', function transportInvalidPDF(data) {- this.workerReadyCapability.reject(data.exception.name, data.exception);+ messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {+ this.loadingTask._capability.reject(+ new InvalidPDFException(exception.message));}, this);- messageHandler.on('MissingPDF', function transportMissingPDF(data) {- this.workerReadyCapability.reject(data.exception.message,- data.exception);+ messageHandler.on('MissingPDF', function transportMissingPDF(exception) {+ this.loadingTask._capability.reject(+ new MissingPDFException(exception.message));}, this);- messageHandler.on('UnknownError', function transportUnknownError(data) {- this.workerReadyCapability.reject(data.exception.message,- data.exception);+ messageHandler.on('UnexpectedResponse',+ function transportUnexpectedResponse(exception) {+ this.loadingTask._capability.reject(+ new UnexpectedResponseException(exception.message, exception.status));+ }, this);++ messageHandler.on('UnknownError',+ function transportUnknownError(exception) {+ this.loadingTask._capability.reject(+ new UnknownErrorException(exception.message, exception.details));}, this);messageHandler.on('DataLoaded', function transportPage(data) {this.downloadInfoCapability.resolve(data);}, this);+ messageHandler.on('PDFManagerReady', function transportPage(data) {+ if (this.pdfDataRangeTransport) {+ this.pdfDataRangeTransport.transportReady();+ }+ }, this);+messageHandler.on('StartRenderPage', function transportRender(data) {var page = this.pageCache[data.pageIndex];@@ -2486,7 +2738,7 @@ var WorkerTransport = (function WorkerTransportClosure() {this.commonObjs.resolve(id, error);break;} else {- font = new FontFace(exportedData);+ font = new FontFaceObject(exportedData);}FontLoader.bind(@@ -2536,18 +2788,15 @@ var WorkerTransport = (function WorkerTransportClosure() {}, this);messageHandler.on('DocProgress', function transportDocProgress(data) {- if (this.progressCallback) {- this.progressCallback({+ var loadingTask = this.loadingTask;+ if (loadingTask.onProgress) {+ loadingTask.onProgress({loaded: data.loaded,total: data.total});}}, this);- messageHandler.on('DocError', function transportDocError(data) {- this.workerReadyCapability.reject(data);- }, this);-messageHandler.on('PageError', function transportError(data) {var page = this.pageCache[data.pageNum - 1];var intentState = page.intentStates[data.intent];@@ -2601,9 +2850,16 @@ var WorkerTransport = (function WorkerTransportClosure() {});},- fetchDocument: function WorkerTransport_fetchDocument(source) {+ fetchDocument: function WorkerTransport_fetchDocument(loadingTask, source) {+ this.loadingTask = loadingTask;+source.disableAutoFetch = PDFJS.disableAutoFetch;+ source.disableStream = PDFJS.disableStream;source.chunkedViewerLoading = !!this.pdfDataRangeTransport;+ if (this.pdfDataRangeTransport) {+ source.length = this.pdfDataRangeTransport.length;+ source.initialData = this.pdfDataRangeTransport.initialData;+ }this.messageHandler.send('GetDocRequest', {source: source,disableRange: PDFJS.disableRange,@@ -2654,6 +2910,10 @@ var WorkerTransport = (function WorkerTransportClosure() {return this.messageHandler.sendWithPromise('GetDestinations', null);},+ getDestination: function WorkerTransport_getDestination(id) {+ return this.messageHandler.sendWithPromise('GetDestination', { id: id } );+ },+getAttachments: function WorkerTransport_getAttachments() {return this.messageHandler.sendWithPromise('GetAttachments', null);},@@ -2810,26 +3070,37 @@ var PDFObjects = (function PDFObjectsClosure() {*/var RenderTask = (function RenderTaskClosure() {function RenderTask(internalRenderTask) {- this.internalRenderTask = internalRenderTask;+ this._internalRenderTask = internalRenderTask;+/**- * Promise for rendering task completion.- * @type {Promise}+ * Callback for incremental rendering -- a function that will be called+ * each time the rendering is paused. To continue rendering call the+ * function that is the first argument to the callback.+ * @type {function}*/- this.promise = this.internalRenderTask.capability.promise;+ this.onContinue = null;}RenderTask.prototype = /** @lends RenderTask.prototype */ {+ /**+ * Promise for rendering task completion.+ * @return {Promise}+ */+ get promise() {+ return this._internalRenderTask.capability.promise;+ },+/*** Cancels the rendering task. If the task is currently rendering it will* not be cancelled until graphics pauses with a timeout. The promise that* this object extends will resolved when cancelled.*/cancel: function RenderTask_cancel() {- this.internalRenderTask.cancel();+ this._internalRenderTask.cancel();},/**- * Registers callback to indicate the rendering task completion.+ * Registers callbacks to indicate the rendering task completion.** @param {function} onFulfilled The callback for the rendering completion.* @param {function} onRejected The callback for the rendering failure.@@ -2837,7 +3108,7 @@ var RenderTask = (function RenderTaskClosure() {* onRejected callback.*/then: function RenderTask_then(onFulfilled, onRejected) {- return this.promise.then(onFulfilled, onRejected);+ return this.promise.then.apply(this.promise, arguments);}};@@ -2864,6 +3135,7 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {this.graphicsReady = false;this.cancelled = false;this.capability = createPromiseCapability();+ this.task = new RenderTask(this);// caching this-bound methodsthis._continueBound = this._continue.bind(this);this._scheduleNextBound = this._scheduleNext.bind(this);@@ -2926,8 +3198,8 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {if (this.cancelled) {return;}- if (this.params.continueCallback) {- this.params.continueCallback(this._scheduleNextBound);+ if (this.task.onContinue) {+ this.task.onContinue.call(this.task, this._scheduleNextBound);} else {this._scheduleNext();}@@ -3046,9 +3318,17 @@ var Metadata = PDFJS.Metadata = (function MetadataClosure() {// Minimal font size that would be used during canvas fillText operations.var MIN_FONT_SIZE = 16;+// Maximum font size that would be used during canvas fillText operations.+var MAX_FONT_SIZE = 100;var MAX_GROUP_SIZE = 4096;+// Heuristic value used when enforcing minimum line widths.+var MIN_WIDTH_FACTOR = 0.65;+var COMPILE_TYPE3_GLYPHS = true;+var MAX_SIZE_TO_COMPILE = 1000;++var FULL_CHUNK_HEIGHT = 16;function createScratchCanvas(width, height) {var canvas = document.createElement('canvas');@@ -3182,7 +3462,7 @@ var CachedCanvases = (function CachedCanvasesClosure() {getCanvas: function CachedCanvases_getCanvas(id, width, height,trackTransform) {var canvasEntry;- if (id in cache) {+ if (cache[id] !== undefined) {canvasEntry = cache[id];canvasEntry.canvas.width = width;canvasEntry.canvas.height = height;@@ -3396,6 +3676,7 @@ var CanvasExtraState = (function CanvasExtraStateClosure() {// Default fore and background colorsthis.fillColor = '#000000';this.strokeColor = '#000000';+ this.patternFill = false;// Note: fill alpha applies to all non-stroking operationsthis.fillAlpha = 1;this.strokeAlpha = 1;@@ -3448,6 +3729,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {if (canvasCtx) {addContextCurrentTransform(canvasCtx);}+ this.cachedGetSinglePixelWidth = null;}function putBinaryImageData(ctx, imgData) {@@ -3468,13 +3750,11 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {// that's ok; any such pixels are ignored.var height = imgData.height, width = imgData.width;- var fullChunkHeight = 16;- var fracChunks = height / fullChunkHeight;- var fullChunks = Math.floor(fracChunks);- var totalChunks = Math.ceil(fracChunks);- var partialChunkHeight = height - fullChunks * fullChunkHeight;+ var partialChunkHeight = height % FULL_CHUNK_HEIGHT;+ var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;+ var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;- var chunkImgData = ctx.createImageData(width, fullChunkHeight);+ var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);var srcPos = 0, destPos;var src = imgData.data;var dest = chunkImgData.data;@@ -3494,7 +3774,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {0xFF000000 : 0x000000FF;for (i = 0; i < totalChunks; i++) {thisChunkHeight =- (i < fullChunks) ? fullChunkHeight : partialChunkHeight;+ (i < fullChunks) ? FULL_CHUNK_HEIGHT : partialChunkHeight;destPos = 0;for (j = 0; j < thisChunkHeight; j++) {var srcDiff = srcLength - srcPos;@@ -3529,19 +3809,19 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {dest32[destPos++] = 0;}- ctx.putImageData(chunkImgData, 0, i * fullChunkHeight);+ ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);}} else if (imgData.kind === ImageKind.RGBA_32BPP) {// RGBA, 32-bits per pixel.j = 0;- elemsInThisChunk = width * fullChunkHeight * 4;+ elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4;for (i = 0; i < fullChunks; i++) {dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));srcPos += elemsInThisChunk;ctx.putImageData(chunkImgData, 0, j);- j += fullChunkHeight;+ j += FULL_CHUNK_HEIGHT;}if (i < totalChunks) {elemsInThisChunk = width * partialChunkHeight * 4;@@ -3551,11 +3831,11 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {} else if (imgData.kind === ImageKind.RGB_24BPP) {// RGB, 24-bits per pixel.- thisChunkHeight = fullChunkHeight;+ thisChunkHeight = FULL_CHUNK_HEIGHT;elemsInThisChunk = width * thisChunkHeight;for (i = 0; i < totalChunks; i++) {if (i >= fullChunks) {- thisChunkHeight =partialChunkHeight;+ thisChunkHeight = partialChunkHeight;elemsInThisChunk = width * thisChunkHeight;}@@ -3566,7 +3846,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {dest[destPos++] = src[srcPos++];dest[destPos++] = 255;}- ctx.putImageData(chunkImgData, 0, i * fullChunkHeight);+ ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);}} else {error('bad image kind: ' + imgData.kind);@@ -3575,20 +3855,18 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {function putBinaryImageMask(ctx, imgData) {var height = imgData.height, width = imgData.width;- var fullChunkHeight = 16;- var fracChunks = height / fullChunkHeight;- var fullChunks = Math.floor(fracChunks);- var totalChunks = Math.ceil(fracChunks);- var partialChunkHeight = height - fullChunks * fullChunkHeight;+ var partialChunkHeight = height % FULL_CHUNK_HEIGHT;+ var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;+ var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;- var chunkImgData = ctx.createImageData(width, fullChunkHeight);+ var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);var srcPos = 0;var src = imgData.data;var dest = chunkImgData.data;for (var i = 0; i < totalChunks; i++) {var thisChunkHeight =- (i < fullChunks) ? fullChunkHeight : partialChunkHeight;+ (i < fullChunks) ? FULL_CHUNK_HEIGHT : partialChunkHeight;// Expand the mask so it can be used by the canvas. Any required// inversion has already been handled.@@ -3605,7 +3883,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {mask >>= 1;}}- ctx.putImageData(chunkImgData, 0, i * fullChunkHeight);+ ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);}}@@ -3615,14 +3893,14 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {'globalCompositeOperation', 'font'];for (var i = 0, ii = properties.length; i < ii; i++) {var property = properties[i];- if (property in sourceCtx) {+ if (sourceCtx[property] !== undefined) {destCtx[property] = sourceCtx[property];}}- if ('setLineDash' in sourceCtx) {+ if (sourceCtx.setLineDash !== undefined) {destCtx.setLineDash(sourceCtx.getLineDash());destCtx.lineDashOffset = sourceCtx.lineDashOffset;- } else if ('mozDash' in sourceCtx) {+ } else if (sourceCtx.mozDashOffset !== undefined) {destCtx.mozDash = sourceCtx.mozDash;destCtx.mozDashOffset = sourceCtx.mozDashOffset;}@@ -3657,9 +3935,9 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {function composeSMaskLuminosity(maskData, layerData) {var length = maskData.length;for (var i = 3; i < length; i += 4) {- var y = ((maskData[i - 3] * 77) + // * 0.3 / 255 * 0x10000- (maskData[i - 2] * 152) + // * 0.59 ....- (maskData[i - 1] * 28)) | 0; // * 0.11 ....+ var y = (maskData[i - 3] * 77) + // * 0.3 / 255 * 0x10000+ (maskData[i - 2] * 152) + // * 0.59 ....+ (maskData[i - 1] * 28); // * 0.11 ....layerData[i] = (layerData[i] * y) >> 16;}}@@ -3679,7 +3957,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {}// processing image in chunks to save memory- var PIXELS_TO_PROCESS = 65536;+ var PIXELS_TO_PROCESS = 1048576;var chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width));for (var row = 0; row < height; row += chunkSize) {var chunkHeight = Math.min(chunkSize, height - row);@@ -3849,7 +4127,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {},setDash: function CanvasGraphics_setDash(dashArray, dashPhase) {var ctx = this.ctx;- if ('setLineDash' in ctx) {+ if (ctx.setLineDash !== undefined) {ctx.setLineDash(dashArray);ctx.lineDashOffset = dashPhase;} else {@@ -3984,10 +4262,14 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {this.current = this.stateStack.pop();this.ctx.restore();++ this.cachedGetSinglePixelWidth = null;}},transform: function CanvasGraphics_transform(a, b, c, d, e, f) {this.ctx.transform(a, b, c, d, e, f);++ this.cachedGetSinglePixelWidth = null;},// Path@@ -4061,9 +4343,9 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {consumePath = typeof consumePath !== 'undefined' ? consumePath : true;var ctx = this.ctx;var strokeColor = this.current.strokeColor;- if (this.current.lineWidth === 0) {- ctx.lineWidth = this.getSinglePixelWidth();- }+ // Prevent drawing too thin lines by enforcing a minimum line width.+ ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR,+ this.current.lineWidth);// For stroke we want to temporarily change the global alpha to the// stroking alpha.ctx.globalAlpha = this.current.strokeAlpha;@@ -4092,10 +4374,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {consumePath = typeof consumePath !== 'undefined' ? consumePath : true;var ctx = this.ctx;var fillColor = this.current.fillColor;+ var isPatternFill = this.current.patternFill;var needRestore = false;- if (fillColor && fillColor.hasOwnProperty('type') &&- fillColor.type === 'Pattern') {+ if (isPatternFill) {ctx.save();ctx.fillStyle = fillColor.getPattern(ctx, this);needRestore = true;@@ -4246,9 +4528,9 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {// Keeping the font at minimal size and using the fontSizeScale to change// the current transformation matrix before the fillText/strokeText.// See https://bugzilla.mozilla.org/show_bug.cgi?id=726227- var browserFontSize = size >= MIN_FONT_SIZE ? size : MIN_FONT_SIZE;- this.current.fontSizeScale = browserFontSize !== MIN_FONT_SIZE ? 1.0 :- size / MIN_FONT_SIZE;+ var browserFontSize = size < MIN_FONT_SIZE ? MIN_FONT_SIZE :+ size > MAX_FONT_SIZE ? MAX_FONT_SIZE : size;+ this.current.fontSizeScale = size / browserFontSize;var rule = italic + ' ' + bold + ' ' + browserFontSize + 'px ' + typeface;this.ctx.font = rule;@@ -4388,7 +4670,13 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {var lineWidth = current.lineWidth;var scale = current.textMatrixScale;if (scale === 0 || lineWidth === 0) {- lineWidth = this.getSinglePixelWidth();+ var fillStrokeMode = current.textRenderingMode &+ TextRenderingMode.FILL_STROKE_MASK;+ if (fillStrokeMode === TextRenderingMode.STROKE ||+ fillStrokeMode === TextRenderingMode.FILL_STROKE) {+ this.cachedGetSinglePixelWidth = null;+ lineWidth = this.getSinglePixelWidth() * MIN_WIDTH_FACTOR;+ }} else {lineWidth /= scale;}@@ -4483,9 +4771,11 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {var textHScale = current.textHScale * fontDirection;var fontMatrix = current.fontMatrix || FONT_IDENTITY_MATRIX;var glyphsLength = glyphs.length;+ var isTextInvisible =+ current.textRenderingMode === TextRenderingMode.INVISIBLE;var i, glyph, width;- if (fontSize === 0) {+ if (isTextInvisible || fontSize === 0) {return;}@@ -4567,16 +4857,18 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {},setFillColorN: function CanvasGraphics_setFillColorN(/*...*/) {this.current.fillColor = this.getColorN_Pattern(arguments);+ this.current.patternFill = true;},setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) {- var color = Util.makeCssRgb(arguments);+ var color = Util.makeCssRgb(r, g, b);this.ctx.strokeStyle = color;this.current.strokeColor = color;},setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) {- var color = Util.makeCssRgb(arguments);+ var color = Util.makeCssRgb(r, g, b);this.ctx.fillStyle = color;this.current.fillColor = color;+ this.current.patternFill = false;},shadingFill: function CanvasGraphics_shadingFill(patternIR) {@@ -4835,11 +5127,12 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {paintImageMaskXObject: function CanvasGraphics_paintImageMaskXObject(img) {var ctx = this.ctx;var width = img.width, height = img.height;+ var fillColor = this.current.fillColor;+ var isPatternFill = this.current.patternFill;var glyph = this.processingType3;- if (COMPILE_TYPE3_GLYPHS && glyph && !('compiled' in glyph)) {- var MAX_SIZE_TO_COMPILE = 1000;+ if (COMPILE_TYPE3_GLYPHS && glyph && glyph.compiled === undefined) {if (width <= MAX_SIZE_TO_COMPILE && height <= MAX_SIZE_TO_COMPILE) {glyph.compiled =compileType3Glyph({data: img.data, width: width, height: height});@@ -4861,9 +5154,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {maskCtx.globalCompositeOperation = 'source-in';- var fillColor = this.current.fillColor;- maskCtx.fillStyle = (fillColor && fillColor.hasOwnProperty('type') &&- fillColor.type === 'Pattern') ?+ maskCtx.fillStyle = isPatternFill ?fillColor.getPattern(maskCtx, this) : fillColor;maskCtx.fillRect(0, 0, width, height);@@ -4877,7 +5168,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {scaleY, positions) {var width = imgData.width;var height = imgData.height;- var ctx = this.ctx;+ var fillColor = this.current.fillColor;+ var isPatternFill = this.current.patternFill;var maskCanvas = CachedCanvases.getCanvas('maskCanvas', width, height);var maskCtx = maskCanvas.context;@@ -4887,14 +5179,13 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {maskCtx.globalCompositeOperation = 'source-in';- var fillColor = this.current.fillColor;- maskCtx.fillStyle = (fillColor && fillColor.hasOwnProperty('type') &&- fillColor.type === 'Pattern') ?- fillColor.getPattern(maskCtx, this) : fillColor;+ maskCtx.fillStyle = isPatternFill ?+ fillColor.getPattern(maskCtx, this) : fillColor;maskCtx.fillRect(0, 0, width, height);maskCtx.restore();+ var ctx = this.ctx;for (var i = 0, ii = positions.length; i < ii; i += 2) {ctx.save();ctx.transform(scaleX, 0, 0, scaleY, positions[i], positions[i + 1]);@@ -4909,6 +5200,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {function CanvasGraphics_paintImageMaskXObjectGroup(images) {var ctx = this.ctx;+ var fillColor = this.current.fillColor;+ var isPatternFill = this.current.patternFill;for (var i = 0, ii = images.length; i < ii; i++) {var image = images[i];var width = image.width, height = image.height;@@ -4921,9 +5214,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {maskCtx.globalCompositeOperation = 'source-in';- var fillColor = this.current.fillColor;- maskCtx.fillStyle = (fillColor && fillColor.hasOwnProperty('type') &&- fillColor.type === 'Pattern') ?+ maskCtx.fillStyle = isPatternFill ?fillColor.getPattern(maskCtx, this) : fillColor;maskCtx.fillRect(0, 0, width, height);@@ -5126,11 +5417,14 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {ctx.beginPath();},getSinglePixelWidth: function CanvasGraphics_getSinglePixelWidth(scale) {- var inverse = this.ctx.mozCurrentTransformInverse;- // max of the current horizontal and vertical scale- return Math.sqrt(Math.max(- (inverse[0] * inverse[0] + inverse[1] * inverse[1]),- (inverse[2] * inverse[2] + inverse[3] * inverse[3])));+ if (this.cachedGetSinglePixelWidth === null) {+ var inverse = this.ctx.mozCurrentTransformInverse;+ // max of the current horizontal and vertical scale+ this.cachedGetSinglePixelWidth = Math.sqrt(Math.max(+ (inverse[0] * inverse[0] + inverse[1] * inverse[1]),+ (inverse[2] * inverse[2] + inverse[3] * inverse[3])));+ }+ return this.cachedGetSinglePixelWidth;},getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) {var transform = this.ctx.mozCurrentTransform;@@ -5149,7 +5443,6 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {})();-var WebGLUtils = (function WebGLUtilsClosure() {function loadShader(gl, code, shaderType) {var shader = gl.createShader(shaderType);@@ -5198,7 +5491,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {}var currentGL, currentCanvas;- function generageGL() {+ function generateGL() {if (currentGL) {return;}@@ -5256,7 +5549,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {function initSmaskGL() {var canvas, gl;- generageGL();+ generateGL();canvas = currentCanvas;currentCanvas = null;gl = currentGL;@@ -5388,7 +5681,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {function initFiguresGL() {var canvas, gl;- generageGL();+ generateGL();canvas = currentCanvas;currentCanvas = null;gl = currentGL;@@ -5556,7 +5849,7 @@ var WebGLUtils = (function WebGLUtilsClosure() {}var enabled = false;try {- generageGL();+ generateGL();enabled = !!currentGL;} catch (e) { }return shadow(this, 'isEnabled', enabled);@@ -5949,7 +6242,7 @@ var TilingPattern = (function TilingPatternClosure() {context.strokeStyle = ctx.strokeStyle;break;case PaintType.UNCOLORED:- var cssColor = Util.makeCssRgb(color);+ var cssColor = Util.makeCssRgb(color[0], color[1], color[2]);context.fillStyle = cssColor;context.strokeStyle = cssColor;break;@@ -5995,6 +6288,10 @@ var FontLoader = {if (styleElement) {styleElement.parentNode.removeChild(styleElement);}+ this.nativeFontFaces.forEach(function(nativeFontFace) {+ document.fonts.delete(nativeFontFace);+ });+ this.nativeFontFaces.length = 0;},get loadTestFont() {// This is a CFF font with 1 glyph for '.' that fills its entire width and@@ -6051,10 +6348,22 @@ var FontLoader = {return false;})(),+ nativeFontFaces: [],++ isFontLoadingAPISupported: (!isWorker && typeof document !== 'undefined' &&+ !!document.fonts),++ addNativeFontFace: function fontLoader_addNativeFontFace(nativeFontFace) {+ this.nativeFontFaces.push(nativeFontFace);+ document.fonts.add(nativeFontFace);+ },+bind: function fontLoaderBind(fonts, callback) {assert(!isWorker, 'bind() shall be called from main thread');- var rules = [], fontsToLoad = [];+ var rules = [];+ var fontsToLoad = [];+ var fontLoadPromises = [];for (var i = 0, ii = fonts.length; i < ii; i++) {var font = fonts[i];@@ -6065,15 +6374,26 @@ var FontLoader = {}font.attached = true;- var rule = font.bindDOM();- if (rule) {- rules.push(rule);- fontsToLoad.push(font);+ if (this.isFontLoadingAPISupported) {+ var nativeFontFace = font.createNativeFontFace();+ if (nativeFontFace) {+ fontLoadPromises.push(nativeFontFace.loaded);+ }+ } else {+ var rule = font.bindDOM();+ if (rule) {+ rules.push(rule);+ fontsToLoad.push(font);+ }}}var request = FontLoader.queueLoadingCallback(callback);- if (rules.length > 0 && !this.isSyncFontLoadingSupported) {+ if (this.isFontLoadingAPISupported) {+ Promise.all(fontsToLoad).then(function() {+ request.complete();+ });+ } else if (rules.length > 0 && !this.isSyncFontLoadingSupported) {FontLoader.prepareFontLoadEvent(rules, fontsToLoad, request);} else {request.complete();@@ -6208,8 +6528,8 @@ var FontLoader = {}};-var FontFace = (function FontFaceClosure() {- function FontFace(name, file, properties) {+var FontFaceObject = (function FontFaceObjectClosure() {+ function FontFaceObject(name, file, properties) {this.compiledGlyphs = {};if (arguments.length === 1) {// importing translated data@@ -6220,8 +6540,29 @@ var FontFace = (function FontFaceClosure() {return;}}- FontFace.prototype = {- bindDOM: function FontFace_bindDOM() {+ FontFaceObject.prototype = {+ createNativeFontFace: function FontFaceObject_createNativeFontFace() {+ if (!this.data) {+ return null;+ }++ if (PDFJS.disableFontFace) {+ this.disableFontFace = true;+ return null;+ }++ var nativeFontFace = new FontFace(this.loadedName, this.data, {});++ FontLoader.addNativeFontFace(nativeFontFace);++ if (PDFJS.pdfBug && 'FontInspector' in globalScope &&+ globalScope['FontInspector'].enabled) {+ globalScope['FontInspector'].fontAdded(this);+ }+ return nativeFontFace;+ },++ bindDOM: function FontFaceObject_bindDOM() {if (!this.data) {return null;}@@ -6248,7 +6589,7 @@ var FontFace = (function FontFaceClosure() {return rule;},- getPathGenerator: function (objs, character) {+ getPathGenerator: function FontLoader_getPathGenerator(objs, character) {if (!(character in this.compiledGlyphs)) {var js = objs.get(this.loadedName + '_path_' + character);/*jshint -W054 */@@ -6257,11 +6598,10 @@ var FontFace = (function FontFaceClosure() {return this.compiledGlyphs[character];}};- return FontFace;+ return FontFaceObject;})();-var HIGHLIGHT_OFFSET = 4; // pxvar ANNOT_MIN_SIZE = 10; // pxvar AnnotationUtils = (function AnnotationUtilsClosure() {@@ -6288,43 +6628,36 @@ var AnnotationUtils = (function AnnotationUtilsClosure() {style.fontFamily = fontFamily + fallbackName;}- // TODO(mack): Remove this, it's not really that helpful.- function getEmptyContainer(tagName, rect, borderWidth) {- var bWidth = borderWidth || 0;- var element = document.createElement(tagName);- element.style.borderWidth = bWidth + 'px';- var width = rect[2] - rect[0] - 2 * bWidth;- var height = rect[3] - rect[1] - 2 * bWidth;- element.style.width = width + 'px';- element.style.height = height + 'px';- return element;- }-- function initContainer(item) {- var container = getEmptyContainer('section', item.rect, item.borderWidth);- container.style.backgroundColor = item.color;-- var color = item.color;- var rgb = [];- for (var i = 0; i < 3; ++i) {- rgb[i] = Math.round(color[i] * 255);+ function initContainer(item, drawBorder) {+ var container = document.createElement('section');+ var cstyle = container.style;+ var width = item.rect[2] - item.rect[0];+ var height = item.rect[3] - item.rect[1];++ var bWidth = item.borderWidth || 0;+ if (bWidth) {+ width = width - 2 * bWidth;+ height = height - 2 * bWidth;+ cstyle.borderWidth = bWidth + 'px';+ var color = item.color;+ if (drawBorder && color) {+ cstyle.borderStyle = 'solid';+ cstyle.borderColor = Util.makeCssRgb(Math.round(color[0] * 255),+ Math.round(color[1] * 255),+ Math.round(color[2] * 255));+ }}- item.colorCssRgb = Util.makeCssRgb(rgb);-- var highlight = document.createElement('div');- highlight.className = 'annotationHighlight';- highlight.style.left = highlight.style.top = -HIGHLIGHT_OFFSET + 'px';- highlight.style.right = highlight.style.bottom = -HIGHLIGHT_OFFSET + 'px';- highlight.setAttribute('hidden', true);-- item.highlightElement = highlight;- container.appendChild(item.highlightElement);-+ cstyle.width = width + 'px';+ cstyle.height = height + 'px';return container;}function getHtmlElementForTextWidgetAnnotation(item, commonObjs) {- var element = getEmptyContainer('div', item.rect, 0);+ var element = document.createElement('div');+ var width = item.rect[2] - item.rect[0];+ var height = item.rect[3] - item.rect[1];+ element.style.width = width + 'px';+ element.style.height = height + 'px';element.style.display = 'table';var content = document.createElement('div');@@ -6354,7 +6687,7 @@ var AnnotationUtils = (function AnnotationUtilsClosure() {rect[2] = rect[0] + (rect[3] - rect[1]); // make it square}- var container = initContainer(item);+ var container = initContainer(item, false);container.className = 'annotText';var image = document.createElement('img');@@ -6379,13 +6712,15 @@ var AnnotationUtils = (function AnnotationUtilsClosure() {var i, ii;if (item.hasBgColor) {var color = item.color;- var rgb = [];- for (i = 0; i < 3; ++i) {- // Enlighten the color (70%)- var c = Math.round(color[i] * 255);- rgb[i] = Math.round((255 - c) * 0.7) + c;- }- content.style.backgroundColor = Util.makeCssRgb(rgb);++ // Enlighten the color (70%)+ var BACKGROUND_ENLIGHT = 0.7;+ var r = BACKGROUND_ENLIGHT * (1.0 - color[0]) + color[0];+ var g = BACKGROUND_ENLIGHT * (1.0 - color[1]) + color[1];+ var b = BACKGROUND_ENLIGHT * (1.0 - color[2]) + color[2];+ content.style.backgroundColor = Util.makeCssRgb((r * 255) | 0,+ (g * 255) | 0,+ (b * 255) | 0);}var title = document.createElement('h1');@@ -6461,14 +6796,14 @@ var AnnotationUtils = (function AnnotationUtilsClosure() {}function getHtmlElementForLinkAnnotation(item) {- var container = initContainer(item);+ var container = initContainer(item, true);container.className = 'annotLink';- container.style.borderColor = item.colorCssRgb;- container.style.borderStyle = 'solid';-var link = document.createElement('a');link.href = link.title = item.url || '';+ if (item.url && PDFJS.openExternalLinksInNewWindow) {+ link.target = '_blank';+ }container.appendChild(link);@@ -6727,7 +7062,7 @@ var SVGExtraState = (function SVGExtraStateClosure() {this.lineJoin = '';this.lineCap = '';this.miterLimit = 0;-+this.dashArray = [];this.dashPhase = 0;@@ -6954,7 +7289,7 @@ var SVGGraphics = (function SVGGraphicsClosure() {}return opListToTree(opList);},-+executeOpTree: function SVGGraphics_executeOpTree(opTree) {var opTreeLen = opTree.length;for(var x = 0; x < opTreeLen; x++) {@@ -6993,6 +7328,9 @@ var SVGGraphics = (function SVGGraphicsClosure() {case OPS.setWordSpacing:this.setWordSpacing(args[0]);break;+ case OPS.setHScale:+ this.setHScale(args[0]);+ break;case OPS.setTextMatrix:this.setTextMatrix(args[0], args[1], args[2],args[3], args[4], args[5]);@@ -7297,11 +7635,11 @@ var SVGGraphics = (function SVGGraphicsClosure() {this.current.miterLimit = limit;},setStrokeRGBColor: function SVGGraphics_setStrokeRGBColor(r, g, b) {- var color = Util.makeCssRgb(arguments);+ var color = Util.makeCssRgb(r, g, b);this.current.strokeColor = color;},setFillRGBColor: function SVGGraphics_setFillRGBColor(r, g, b) {- var color = Util.makeCssRgb(arguments);+ var color = Util.makeCssRgb(r, g, b);this.current.fillColor = color;this.current.tspan = document.createElementNS(NS, 'svg:tspan');this.current.xcoords = [];diff --git a/data/ext/viewerPDF/build/pdf.worker.js b/data/ext/viewerPDF/build/pdf.worker.jsindex ced93e87e..be9a21c3c 100644--- a/data/ext/viewerPDF/build/pdf.worker.js+++ b/data/ext/viewerPDF/build/pdf.worker.js@@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') {(typeof window !== 'undefined' ? window : this).PDFJS = {};}-PDFJS.version = '1.0.712';-PDFJS.build = '6969ed4';+PDFJS.version = '1.1.1';+PDFJS.build = 'a1e0859';(function pdfjsWrapper() {// Use strict in our context only - users might not want it@@ -341,6 +341,7 @@ function isValidUrl(url, allowRelative) {case 'https':case 'ftp':case 'mailto':+ case 'tel':return true;default:return false;@@ -355,6 +356,7 @@ function shadow(obj, prop, value) {writable: false });return value;}+PDFJS.shadow = shadow;var PasswordResponses = PDFJS.PasswordResponses = {NEED_PASSWORD: 1,@@ -373,6 +375,7 @@ var PasswordException = (function PasswordExceptionClosure() {return PasswordException;})();+PDFJS.PasswordException = PasswordException;var UnknownErrorException = (function UnknownErrorExceptionClosure() {function UnknownErrorException(msg, details) {@@ -386,6 +389,7 @@ var UnknownErrorException = (function UnknownErrorExceptionClosure() {return UnknownErrorException;})();+PDFJS.UnknownErrorException = UnknownErrorException;var InvalidPDFException = (function InvalidPDFExceptionClosure() {function InvalidPDFException(msg) {@@ -398,6 +402,7 @@ var InvalidPDFException = (function InvalidPDFExceptionClosure() {return InvalidPDFException;})();+PDFJS.InvalidPDFException = InvalidPDFException;var MissingPDFException = (function MissingPDFExceptionClosure() {function MissingPDFException(msg) {@@ -410,6 +415,22 @@ var MissingPDFException = (function MissingPDFExceptionClosure() {return MissingPDFException;})();+PDFJS.MissingPDFException = MissingPDFException;++var UnexpectedResponseException =+ (function UnexpectedResponseExceptionClosure() {+ function UnexpectedResponseException(msg, status) {+ this.name = 'UnexpectedResponseException';+ this.message = msg;+ this.status = status;+ }++ UnexpectedResponseException.prototype = new Error();+ UnexpectedResponseException.constructor = UnexpectedResponseException;++ return UnexpectedResponseException;+})();+PDFJS.UnexpectedResponseException = UnexpectedResponseException;var NotImplementedException = (function NotImplementedExceptionClosure() {function NotImplementedException(msg) {@@ -451,6 +472,8 @@ var XRefParseException = (function XRefParseExceptionClosure() {function bytesToString(bytes) {+ assert(bytes !== null && typeof bytes === 'object' &&+ bytes.length !== undefined, 'Invalid argument for bytesToString');var length = bytes.length;var MAX_ARGUMENT_COUNT = 8192;if (length < MAX_ARGUMENT_COUNT) {@@ -466,6 +489,7 @@ function bytesToString(bytes) {}function stringToBytes(str) {+ assert(typeof str === 'string', 'Invalid argument for stringToBytes');var length = str.length;var bytes = new Uint8Array(length);for (var i = 0; i < length; ++i) {@@ -582,10 +606,10 @@ var Util = PDFJS.Util = (function UtilClosure() {// makeCssRgb() can be called thousands of times. Using |rgbBuf| avoids// creating many intermediate strings.- Util.makeCssRgb = function Util_makeCssRgb(rgb) {- rgbBuf[1] = rgb[0];- rgbBuf[3] = rgb[1];- rgbBuf[5] = rgb[2];+ Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {+ rgbBuf[1] = r;+ rgbBuf[3] = g;+ rgbBuf[5] = b;return rgbBuf.join('');};@@ -979,10 +1003,6 @@ function isString(v) {return typeof v === 'string';}-function isNull(v) {- return v === null;-}-function isName(v) {return v instanceof Name;}@@ -1620,11 +1640,11 @@ var NetworkManager = (function NetworkManagerClosure() {return data;}var length = data.length;- var buffer = new Uint8Array(length);+ var array = new Uint8Array(length);for (var i = 0; i < length; i++) {- buffer[i] = data.charCodeAt(i) & 0xFF;+ array[i] = data.charCodeAt(i) & 0xFF;}- return buffer;+ return array.buffer;}NetworkManager.prototype = {@@ -1639,11 +1659,11 @@ var NetworkManager = (function NetworkManagerClosure() {return this.request(args);},- requestFull: function NetworkManager_requestRange(listeners) {+ requestFull: function NetworkManager_requestFull(listeners) {return this.request(listeners);},- request: function NetworkManager_requestRange(args) {+ request: function NetworkManager_request(args) {var xhr = this.getXhr();var xhrId = this.currXhrId++;var pendingRequest = this.pendingRequests[xhrId] = {@@ -1667,27 +1687,57 @@ var NetworkManager = (function NetworkManagerClosure() {pendingRequest.expectedStatus = 200;}- xhr.responseType = 'arraybuffer';-- if (args.onProgress) {- xhr.onprogress = args.onProgress;+ if (args.onProgressiveData) {+ // Some legacy browsers might throw an exception.+ try {+ xhr.responseType = 'moz-chunked-arraybuffer';+ } catch(e) {}+ if (xhr.responseType === 'moz-chunked-arraybuffer') {+ pendingRequest.onProgressiveData = args.onProgressiveData;+ pendingRequest.mozChunked = true;+ } else {+ xhr.responseType = 'arraybuffer';+ }+ } else {+ xhr.responseType = 'arraybuffer';}+if (args.onError) {xhr.onerror = function(evt) {args.onError(xhr.status);};}xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);+ xhr.onprogress = this.onProgress.bind(this, xhrId);pendingRequest.onHeadersReceived = args.onHeadersReceived;pendingRequest.onDone = args.onDone;pendingRequest.onError = args.onError;+ pendingRequest.onProgress = args.onProgress;xhr.send(null);return xhrId;},+ onProgress: function NetworkManager_onProgress(xhrId, evt) {+ var pendingRequest = this.pendingRequests[xhrId];+ if (!pendingRequest) {+ // Maybe abortRequest was called...+ return;+ }++ if (pendingRequest.mozChunked) {+ var chunk = getArrayBuffer(pendingRequest.xhr);+ pendingRequest.onProgressiveData(chunk);+ }++ var onProgress = pendingRequest.onProgress;+ if (onProgress) {+ onProgress(evt);+ }+ },+onStateChange: function NetworkManager_onStateChange(xhrId, evt) {var pendingRequest = this.pendingRequests[xhrId];if (!pendingRequest) {@@ -1748,6 +1798,8 @@ var NetworkManager = (function NetworkManagerClosure() {begin: begin,chunk: chunk});+ } else if (pendingRequest.onProgressiveData) {+ pendingRequest.onDone(null);} else {pendingRequest.onDone({begin: 0,@@ -1767,6 +1819,10 @@ var NetworkManager = (function NetworkManagerClosure() {return this.pendingRequests[xhrId].xhr;},+ isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {+ return !!(this.pendingRequests[xhrId].onProgressiveData);+ },+isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {return xhrId in this.pendingRequests;},@@ -1792,7 +1848,6 @@ var NetworkManager = (function NetworkManagerClosure() {})();-var ChunkedStream = (function ChunkedStreamClosure() {function ChunkedStream(length, chunkSize, manager) {this.bytes = new Uint8Array(length);@@ -1804,7 +1859,7 @@ var ChunkedStream = (function ChunkedStreamClosure() {this.numChunksLoaded = 0;this.numChunks = Math.ceil(length / chunkSize);this.manager = manager;- this.initialDataLength = 0;+ this.progressiveDataLength = 0;this.lastSuccessfulEnsureByteChunk = -1; // a single-entry cache}@@ -1815,7 +1870,7 @@ var ChunkedStream = (function ChunkedStreamClosure() {getMissingChunks: function ChunkedStream_getMissingChunks() {var chunks = [];for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {- if (!(chunk in this.loadedChunks)) {+ if (!this.loadedChunks[chunk]) {chunks.push(chunk);}}@@ -1847,21 +1902,29 @@ var ChunkedStream = (function ChunkedStreamClosure() {var curChunk;for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {- if (!(curChunk in this.loadedChunks)) {+ if (!this.loadedChunks[curChunk]) {this.loadedChunks[curChunk] = true;++this.numChunksLoaded;}}},- onReceiveInitialData: function ChunkedStream_onReceiveInitialData(data) {- this.bytes.set(data);- this.initialDataLength = data.length;- var endChunk = (this.end === data.length ?- this.numChunks : Math.floor(data.length / this.chunkSize));- for (var i = 0; i < endChunk; i++) {- this.loadedChunks[i] = true;- ++this.numChunksLoaded;+ onReceiveProgressiveData:+ function ChunkedStream_onReceiveProgressiveData(data) {+ var position = this.progressiveDataLength;+ var beginChunk = Math.floor(position / this.chunkSize);++ this.bytes.set(new Uint8Array(data), position);+ position += data.byteLength;+ this.progressiveDataLength = position;+ var endChunk = position >= this.end ? this.numChunks :+ Math.floor(position / this.chunkSize);+ var curChunk;+ for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {+ if (!this.loadedChunks[curChunk]) {+ this.loadedChunks[curChunk] = true;+ ++this.numChunksLoaded;+ }}},@@ -1871,7 +1934,7 @@ var ChunkedStream = (function ChunkedStreamClosure() {return;}- if (!(chunk in this.loadedChunks)) {+ if (!this.loadedChunks[chunk]) {throw new MissingDataException(pos, pos + 1);}this.lastSuccessfulEnsureByteChunk = chunk;@@ -1882,7 +1945,7 @@ var ChunkedStream = (function ChunkedStreamClosure() {return;}- if (end <= this.initialDataLength) {+ if (end <= this.progressiveDataLength) {return;}@@ -1890,7 +1953,7 @@ var ChunkedStream = (function ChunkedStreamClosure() {var beginChunk = Math.floor(begin / chunkSize);var endChunk = Math.floor((end - 1) / chunkSize) + 1;for (var chunk = beginChunk; chunk < endChunk; ++chunk) {- if (!(chunk in this.loadedChunks)) {+ if (!this.loadedChunks[chunk]) {throw new MissingDataException(begin, end);}}@@ -1899,13 +1962,13 @@ var ChunkedStream = (function ChunkedStreamClosure() {nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) {var chunk, n;for (chunk = beginChunk, n = this.numChunks; chunk < n; ++chunk) {- if (!(chunk in this.loadedChunks)) {+ if (!this.loadedChunks[chunk]) {return chunk;}}// Wrap around to beginningfor (chunk = 0; chunk < beginChunk; ++chunk) {- if (!(chunk in this.loadedChunks)) {+ if (!this.loadedChunks[chunk]) {return chunk;}}@@ -1913,7 +1976,7 @@ var ChunkedStream = (function ChunkedStreamClosure() {},hasChunk: function ChunkedStream_hasChunk(chunk) {- return chunk in this.loadedChunks;+ return !!this.loadedChunks[chunk];},get length() {@@ -1936,6 +1999,9 @@ var ChunkedStream = (function ChunkedStreamClosure() {getUint16: function ChunkedStream_getUint16() {var b0 = this.getByte();var b1 = this.getByte();+ if (b0 === -1 || b1 === -1) {+ return -1;+ }return (b0 << 8) + b1;},@@ -1969,6 +2035,12 @@ var ChunkedStream = (function ChunkedStreamClosure() {return bytes.subarray(pos, end);},+ peekByte: function ChunkedStream_peekByte() {+ var peekedByte = this.getByte();+ this.pos--;+ return peekedByte;+ },+peekBytes: function ChunkedStream_peekBytes(length) {var bytes = this.getBytes(length);this.pos -= bytes.length;@@ -2006,7 +2078,7 @@ var ChunkedStream = (function ChunkedStreamClosure() {var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;var missingChunks = [];for (var chunk = beginChunk; chunk < endChunk; ++chunk) {- if (!(chunk in this.loadedChunks)) {+ if (!this.loadedChunks[chunk]) {missingChunks.push(chunk);}}@@ -2064,28 +2136,16 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {this.chunksNeededByRequest = {};this.requestsByChunk = {};this.callbacksByRequest = {};+ this.progressiveDataLength = 0;this._loadedStreamCapability = createPromiseCapability();if (args.initialData) {- this.setInitialData(args.initialData);+ this.onReceiveData({chunk: args.initialData});}}ChunkedStreamManager.prototype = {-- setInitialData: function ChunkedStreamManager_setInitialData(data) {- this.stream.onReceiveInitialData(data);- if (this.stream.allChunksLoaded()) {- this._loadedStreamCapability.resolve(this.stream);- } else if (this.msgHandler) {- this.msgHandler.send('DocProgress', {- loaded: data.length,- total: this.length- });- }- },-onLoadedStream: function ChunkedStreamManager_getLoadedStream() {return this._loadedStreamCapability.promise;},@@ -2223,13 +2283,21 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {onReceiveData: function ChunkedStreamManager_onReceiveData(args) {var chunk = args.chunk;- var begin = args.begin;+ var isProgressive = args.begin === undefined;+ var begin = isProgressive ? this.progressiveDataLength : args.begin;var end = begin + chunk.byteLength;- var beginChunk = this.getBeginChunk(begin);- var endChunk = this.getEndChunk(end);+ var beginChunk = Math.floor(begin / this.chunkSize);+ var endChunk = end < this.length ? Math.floor(end / this.chunkSize) :+ Math.ceil(end / this.chunkSize);++ if (isProgressive) {+ this.stream.onReceiveProgressiveData(chunk);+ this.progressiveDataLength = end;+ } else {+ this.stream.onReceiveData(begin, chunk);+ }- this.stream.onReceiveData(begin, chunk);if (this.stream.allChunksLoaded()) {this._loadedStreamCapability.resolve(this.stream);}@@ -2319,7 +2387,6 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {})();-// The maximum number of bytes fetched per range requestvar RANGE_CHUNK_SIZE = 65536;@@ -2366,6 +2433,10 @@ var BasePdfManager = (function BasePdfManagerClosure() {return new NotImplementedException();},+ sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) {+ return new NotImplementedException();+ },+updatePassword: function BasePdfManager_updatePassword(password) {this.pdfDocument.xref.password = this.password = password;if (this._passwordChangedCapability) {@@ -2502,6 +2573,11 @@ var NetworkPdfManager = (function NetworkPdfManagerClosure() {this.streamManager.requestAllChunks();};+ NetworkPdfManager.prototype.sendProgressiveData =+ function NetworkPdfManager_sendProgressiveData(chunk) {+ this.streamManager.onReceiveData({ chunk: chunk });+ };+NetworkPdfManager.prototype.onLoadedStream =function NetworkPdfManager_getLoadedStream() {return this.streamManager.onLoadedStream();@@ -2516,7 +2592,6 @@ var NetworkPdfManager = (function NetworkPdfManagerClosure() {})();-var Page = (function PageClosure() {var LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];@@ -2774,6 +2849,10 @@ var Page = (function PageClosure() {* `PDFDocument` objects on the main thread created.*/var PDFDocument = (function PDFDocumentClosure() {+ var FINGERPRINT_FIRST_BYTES = 1024;+ var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' ++ '\x00\x00\x00\x00\x00\x00\x00\x00\x00';+function PDFDocument(pdfManager, arg, password) {if (isStream(arg)) {init.call(this, pdfManager, arg, password);@@ -2985,16 +3064,25 @@ var PDFDocument = (function PDFDocumentClosure() {return shadow(this, 'documentInfo', docInfo);},get fingerprint() {- var xref = this.xref, hash, fileID = '';+ var xref = this.xref, idArray, hash, fileID = '';if (xref.trailer.has('ID')) {- hash = stringToBytes(xref.trailer.get('ID')[0]);+ idArray = xref.trailer.get('ID');+ }+ if (idArray && isArray(idArray) && idArray[0] !== EMPTY_FINGERPRINT) {+ hash = stringToBytes(idArray[0]);} else {- hash = calculateMD5(this.stream.bytes.subarray(0, 100), 0, 100);+ if (this.stream.ensureRange) {+ this.stream.ensureRange(0,+ Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));+ }+ hash = calculateMD5(this.stream.bytes.subarray(0,+ FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);}for (var i = 0, n = hash.length; i < n; i++) {- fileID += hash[i].toString(16);+ var hex = hash[i].toString(16);+ fileID += hex.length === 1 ? '0' + hex : hex;}return shadow(this, 'fingerprint', fileID);@@ -3013,7 +3101,6 @@ var PDFDocument = (function PDFDocumentClosure() {})();-var Name = (function NameClosure() {function Name(name) {this.name = name;@@ -3448,6 +3535,38 @@ var Catalog = (function CatalogClosure() {}return shadow(this, 'destinations', dests);},+ getDestination: function Catalog_getDestination(destinationId) {+ function fetchDestination(dest) {+ return isDict(dest) ? dest.get('D') : dest;+ }++ var xref = this.xref;+ var dest, nameTreeRef, nameDictionaryRef;+ var obj = this.catDict.get('Names');+ if (obj && obj.has('Dests')) {+ nameTreeRef = obj.getRaw('Dests');+ } else if (this.catDict.has('Dests')) {+ nameDictionaryRef = this.catDict.get('Dests');+ }++ if (nameDictionaryRef) {+ // reading simple destination dictionary+ obj = nameDictionaryRef;+ obj.forEach(function catalogForEach(key, value) {+ if (!value) {+ return;+ }+ if (key === destinationId) {+ dest = fetchDestination(value);+ }+ });+ }+ if (nameTreeRef) {+ var nameTree = new NameTree(nameTreeRef, xref);+ dest = fetchDestination(nameTree.get(destinationId));+ }+ return dest;+ },get attachments() {var xref = this.xref;var attachments = null, nameTreeRef;@@ -3514,7 +3633,7 @@ var Catalog = (function CatalogClosure() {var isPrintAction = (isName(objType) && objType.name === 'Action' &&isName(actionType) && actionType.name === 'Named' &&isName(action) && action.name === 'Print');-+if (isPrintAction) {javaScript.push('print(true);');}@@ -4349,16 +4468,86 @@ var NameTree = (function NameTreeClosure() {}}return dict;+ },++ get: function NameTree_get(destinationId) {+ if (!this.root) {+ return null;+ }++ var xref = this.xref;+ var kidsOrNames = xref.fetchIfRef(this.root);+ var loopCount = 0;+ var MAX_NAMES_LEVELS = 10;+ var l, r, m;++ // Perform a binary search to quickly find the entry that+ // contains the named destination we are looking for.+ while (kidsOrNames.has('Kids')) {+ loopCount++;+ if (loopCount > MAX_NAMES_LEVELS) {+ warn('Search depth limit for named destionations has been reached.');+ return null;+ }++ var kids = kidsOrNames.get('Kids');+ if (!isArray(kids)) {+ return null;+ }++ l = 0;+ r = kids.length - 1;+ while (l <= r) {+ m = (l + r) >> 1;+ var kid = xref.fetchIfRef(kids[m]);+ var limits = kid.get('Limits');++ if (destinationId < limits[0]) {+ r = m - 1;+ } else if (destinationId > limits[1]) {+ l = m + 1;+ } else {+ kidsOrNames = xref.fetchIfRef(kids[m]);+ break;+ }+ }+ if (l > r) {+ return null;+ }+ }++ // If we get here, then we have found the right entry. Now+ // go through the named destinations in the Named dictionary+ // until we find the exact destination we're looking for.+ var names = kidsOrNames.get('Names');+ if (isArray(names)) {+ // Perform a binary search to reduce the lookup time.+ l = 0;+ r = names.length - 2;+ while (l <= r) {+ // Check only even indices (0, 2, 4, ...) because the+ // odd indices contain the actual D array.+ m = (l + r) & ~1;+ if (destinationId < names[m]) {+ r = m - 2;+ } else if (destinationId > names[m]) {+ l = m + 2;+ } else {+ return xref.fetchIfRef(names[m + 1]);+ }+ }+ }+ return null;}};return NameTree;})();/**- * "A PDF file can refer to the contents of another file by using a File+ * "A PDF file can refer to the contents of another file by using a File* Specification (PDF 1.1)", see the spec (7.11) for more details.* NOTE: Only embedded files are supported (as part of the attachments support)- * TODO: support the 'URL' file system (with caching if !/V), portable+ * TODO: support the 'URL' file system (with caching if !/V), portable* collections attributes and related files (/RF)*/var FileSpec = (function FileSpecClosure() {@@ -4688,7 +4877,6 @@ var ExpertSubsetCharset = [];-var DEFAULT_ICON_SIZE = 22; // pxvar SUPPORTED_TYPES = ['Link', 'Text', 'Widget'];@@ -4748,12 +4936,26 @@ var Annotation = (function AnnotationClosure() {data.annotationFlags = dict.get('F');var color = dict.get('C');- if (isArray(color) && color.length === 3) {- // TODO(mack): currently only supporting rgb; need support different- // colorspaces- data.color = color;- } else {+ if (!color) {+ // The PDF spec does not mention how a missing color array is interpreted.+ // Adobe Reader seems to default to black in this case.data.color = [0, 0, 0];+ } else if (isArray(color)) {+ switch (color.length) {+ case 0:+ // Empty array denotes transparent border.+ data.color = null;+ break;+ case 1:+ // TODO: implement DeviceGray+ break;+ case 3:+ data.color = color;+ break;+ case 4:+ // TODO: implement DeviceCMYK+ break;+ }}// Some types of annotations have border style dict which has more@@ -4770,7 +4972,7 @@ var Annotation = (function AnnotationClosure() {if (data.borderWidth > 0 && dashArray) {if (!isArray(dashArray)) {// Ignore the border if dashArray is not actually an array,- // this is consistent with the behaviour in Adobe Reader.+ // this is consistent with the behaviour in Adobe Reader.data.borderWidth = 0;} else {var dashArrayLength = dashArray.length;@@ -5016,7 +5218,7 @@ var WidgetAnnotation = (function WidgetAnnotationClosure() {var name = namedItem.get('T');if (name) {fieldName.unshift(stringToPDFString(name));- } else {+ } else if (parent && ref) {// The field name is absent, that means more than one field// with the same name may exist. Replacing the empty name// with the '`' plus index in the parent's 'Kids' array.@@ -5140,7 +5342,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() {data.annotationType = AnnotationType.LINK;var action = dict.get('A');- if (action) {+ if (action && isDict(action)) {var linkType = action.get('S').name;if (linkType === 'URI') {var url = action.get('URI');@@ -5193,11 +5395,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() {return url;}- Util.inherit(LinkAnnotation, InteractiveAnnotation, {- hasOperatorList: function LinkAnnotation_hasOperatorList() {- return false;- }- });+ Util.inherit(LinkAnnotation, InteractiveAnnotation, { });return LinkAnnotation;})();@@ -5617,7 +5815,7 @@ var PDFFunction = (function PDFFunctionClosure() {var cachedValue = cache[key];if (cachedValue !== undefined) {- cachedValue.set(dest, destOffset);+ dest.set(cachedValue, destOffset);return;}@@ -5641,7 +5839,7 @@ var PDFFunction = (function PDFFunctionClosure() {cache_available--;cache[key] = output;}- output.set(dest, destOffset);+ dest.set(output, destOffset);};}};@@ -6572,10 +6770,10 @@ var ColorSpace = (function ColorSpaceClosure() {case 'CMYK':return 'DeviceCmykCS';case 'CalGray':- params = cs[1].getAll();+ params = xref.fetchIfRef(cs[1]).getAll();return ['CalGrayCS', params];case 'CalRGB':- params = cs[1].getAll();+ params = xref.fetchIfRef(cs[1]).getAll();return ['CalRGBCS', params];case 'ICCBased':var stream = xref.fetchIfRef(cs[1]);@@ -7377,20 +7575,21 @@ var CalRGBCS = (function CalRGBCSClosure() {convertToRgb(this, src, srcOffset, dest, destOffset, 1);},getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count,- dest, destOffset, bits) {+ dest, destOffset, bits,+ alpha01) {var scale = 1 / ((1 << bits) - 1);for (var i = 0; i < count; ++i) {convertToRgb(this, src, srcOffset, dest, destOffset, scale);srcOffset += 3;- destOffset += 3;+ destOffset += 3 + alpha01;}},- getOutputLength: function CalRGBCS_getOutputLength(inputLength) {- return inputLength;+ getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) {+ return (inputLength * (3 + alpha01) / 3) | 0;},isPassthrough: ColorSpace.prototype.isPassthrough,- createRgbBuffer: ColorSpace.prototype.createRgbBuffer,+ fillRgb: ColorSpace.prototype.fillRgb,isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) {return ColorSpace.isDefaultDecode(decodeMap, this.numComps);},@@ -9595,19 +9794,27 @@ var Pattern = (function PatternClosure() {var dict = isStream(shading) ? shading.dict : shading;var type = dict.get('ShadingType');- switch (type) {- case PatternType.AXIAL:- case PatternType.RADIAL:- // Both radial and axial shadings are handled by RadialAxial shading.- return new Shadings.RadialAxial(dict, matrix, xref, res);- case PatternType.FREE_FORM_MESH:- case PatternType.LATTICE_FORM_MESH:- case PatternType.COONS_PATCH_MESH:- case PatternType.TENSOR_PATCH_MESH:- return new Shadings.Mesh(shading, matrix, xref, res);- default:- UnsupportedManager.notify(UNSUPPORTED_FEATURES.shadingPattern);- return new Shadings.Dummy();+ try {+ switch (type) {+ case PatternType.AXIAL:+ case PatternType.RADIAL:+ // Both radial and axial shadings are handled by RadialAxial shading.+ return new Shadings.RadialAxial(dict, matrix, xref, res);+ case PatternType.FREE_FORM_MESH:+ case PatternType.LATTICE_FORM_MESH:+ case PatternType.COONS_PATCH_MESH:+ case PatternType.TENSOR_PATCH_MESH:+ return new Shadings.Mesh(shading, matrix, xref, res);+ default:+ throw new Error('Unknown PatternType: ' + type);+ }+ } catch (ex) {+ if (ex instanceof MissingDataException) {+ throw ex;+ }+ UnsupportedManager.notify(UNSUPPORTED_FEATURES.shadingPattern);+ warn(ex);+ return new Shadings.Dummy();}};return Pattern;@@ -9692,14 +9899,14 @@ Shadings.RadialAxial = (function RadialAxialClosure() {ratio[0] = i;fn(ratio, 0, color, 0);rgbColor = cs.getRgb(color, 0);- var cssColor = Util.makeCssRgb(rgbColor);+ var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);colorStops.push([(i - t0) / diff, cssColor]);}var background = 'transparent';if (dict.has('Background')) {rgbColor = cs.getRgb(dict.get('Background'), 0);- background = Util.makeCssRgb(rgbColor);+ background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);}if (!extendStart) {@@ -10485,7 +10692,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {buildPaintImageXObject:function PartialEvaluator_buildPaintImageXObject(resources, image,inline, operatorList,- cacheKey, cache) {+ cacheKey, imageCache) {var self = this;var dict = image.dict;var w = dict.get('Width', 'W');@@ -10523,9 +10730,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {args = [imgData];operatorList.addOp(OPS.paintImageMaskXObject, args);if (cacheKey) {- cache.key = cacheKey;- cache.fn = OPS.paintImageMaskXObject;- cache.args = args;+ imageCache[cacheKey] = {+ fn: OPS.paintImageMaskXObject,+ args: args+ };}return;}@@ -10567,16 +10775,17 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {var imgData = imageObj.createImageData(/* forceRGBA = */ false);self.handler.send('obj', [objId, self.pageIndex, 'Image', imgData],[imgData.data.buffer]);- }).then(null, function (reason) {+ }).then(undefined, function (reason) {warn('Unable to decode image: ' + reason);self.handler.send('obj', [objId, self.pageIndex, 'Image', null]);});operatorList.addOp(OPS.paintImageXObject, args);if (cacheKey) {- cache.key = cacheKey;- cache.fn = OPS.paintImageXObject;- cache.args = args;+ imageCache[cacheKey] = {+ fn: OPS.paintImageXObject,+ args: args+ };}},@@ -10970,8 +11179,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {}// eagerly compile XForm objectsvar name = args[0].name;- if (imageCache.key === name) {- operatorList.addOp(imageCache.fn, imageCache.args);+ if (imageCache[name] !== undefined) {+ operatorList.addOp(imageCache[name].fn, imageCache[name].args);args = null;continue;}@@ -11020,10 +11229,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {}, reject);case OPS.endInlineImage:var cacheKey = args[0].cacheKey;- if (cacheKey && imageCache.key === cacheKey) {- operatorList.addOp(imageCache.fn, imageCache.args);- args = null;- continue;+ if (cacheKey) {+ var cacheEntry = imageCache[cacheKey];+ if (cacheEntry !== undefined) {+ operatorList.addOp(cacheEntry.fn, cacheEntry.args);+ args = null;+ continue;+ }}self.buildPaintImageXObject(resources, args[0], true,operatorList, cacheKey, imageCache);@@ -11202,7 +11414,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {styles: Object.create(null)};var bidiTexts = textContent.items;- var SPACE_FACTOR = 0.35;+ var SPACE_FACTOR = 0.3;var MULTI_SPACE_FACTOR = 1.5;var self = this;@@ -11620,9 +11832,14 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {// The Symbolic attribute can be misused for regular fonts// Heuristic: we have to check if the font is a standard one alsoif (!!(properties.flags & FontFlags.Symbolic)) {- encoding = (!properties.file && /Symbol/i.test(properties.name) ?- Encodings.SymbolSetEncoding :- Encodings.MacRomanEncoding);+ encoding = Encodings.MacRomanEncoding;+ if (!properties.file) {+ if (/Symbol/i.test(properties.name)) {+ encoding = Encodings.SymbolSetEncoding;+ } else if (/Dingbats/i.test(properties.name)) {+ encoding = Encodings.ZapfDingbatsEncoding;+ }+ }}properties.defaultEncoding = encoding;}@@ -14127,7 +14344,7 @@ var Encodings = {'parenrighttp', 'parenrightex', 'parenrightbt', 'bracketrighttp','bracketrightex', 'bracketrightbt', 'bracerighttp', 'bracerightmid','bracerightbt'],- zapfDingbatsEncoding: ['', '', '', '', '', '', '', '', '', '', '', '', '', '',+ ZapfDingbatsEncoding: ['', '', '', '', '', '', '', '', '', '', '', '', '', '','', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '','space', 'a1', 'a2', 'a202', 'a3', 'a4', 'a5', 'a119', 'a118', 'a117','a11', 'a12', 'a13', 'a14', 'a15', 'a16', 'a105', 'a17', 'a18', 'a19',@@ -14138,19 +14355,19 @@ var Encodings = {'a57', 'a58', 'a59', 'a60', 'a61', 'a62', 'a63', 'a64', 'a65', 'a66','a67', 'a68', 'a69', 'a70', 'a71', 'a72', 'a73', 'a74', 'a203', 'a75','a204', 'a76', 'a77', 'a78', 'a79', 'a81', 'a82', 'a83', 'a84', 'a97',- 'a98', 'a99', 'a100', '', '', '', '', '', '', '', '', '', '', '', '', '',- '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',- '', '', 'a101', 'a102', 'a103', 'a104', 'a106', 'a107', 'a108', 'a112',- 'a111', 'a110', 'a109', 'a120', 'a121', 'a122', 'a123', 'a124', 'a125',- 'a126', 'a127', 'a128', 'a129', 'a130', 'a131', 'a132', 'a133', 'a134',- 'a135', 'a136', 'a137', 'a138', 'a139', 'a140', 'a141', 'a142', 'a143',- 'a144', 'a145', 'a146', 'a147', 'a148', 'a149', 'a150', 'a151', 'a152',- 'a153', 'a154', 'a155', 'a156', 'a157', 'a158', 'a159', 'a160', 'a161',- 'a163', 'a164', 'a196', 'a165', 'a192', 'a166', 'a167', 'a168', 'a169',- 'a170', 'a171', 'a172', 'a173', 'a162', 'a174', 'a175', 'a176', 'a177',- 'a178', 'a179', 'a193', 'a180', 'a199', 'a181', 'a200', 'a182', '', 'a201',- 'a183', 'a184', 'a197', 'a185', 'a194', 'a198', 'a186', 'a195', 'a187',- 'a188', 'a189', 'a190', 'a191']+ 'a98', 'a99', 'a100', '', 'a89', 'a90', 'a93', 'a94', 'a91', 'a92', 'a205',+ 'a85', 'a206', 'a86', 'a87', 'a88', 'a95', 'a96', '', '', '', '', '', '',+ '', '', '', '', '', '', '', '', '', '', '', '', '', 'a101', 'a102', 'a103',+ 'a104', 'a106', 'a107', 'a108', 'a112', 'a111', 'a110', 'a109', 'a120',+ 'a121', 'a122', 'a123', 'a124', 'a125', 'a126', 'a127', 'a128', 'a129',+ 'a130', 'a131', 'a132', 'a133', 'a134', 'a135', 'a136', 'a137', 'a138',+ 'a139', 'a140', 'a141', 'a142', 'a143', 'a144', 'a145', 'a146', 'a147',+ 'a148', 'a149', 'a150', 'a151', 'a152', 'a153', 'a154', 'a155', 'a156',+ 'a157', 'a158', 'a159', 'a160', 'a161', 'a163', 'a164', 'a196', 'a165',+ 'a192', 'a166', 'a167', 'a168', 'a169', 'a170', 'a171', 'a172', 'a173',+ 'a162', 'a174', 'a175', 'a176', 'a177', 'a178', 'a179', 'a193', 'a180',+ 'a199', 'a181', 'a200', 'a182', '', 'a201', 'a183', 'a184', 'a197', 'a185',+ 'a194', 'a198', 'a186', 'a195', 'a187', 'a188', 'a189', 'a190', 'a191']};/**@@ -14185,9 +14402,12 @@ var stdFontMap = {'CourierNewPS-BoldMT': 'Courier-Bold','CourierNewPS-ItalicMT': 'Courier-Oblique','CourierNewPSMT': 'Courier',+ 'Helvetica': 'Helvetica','Helvetica-Bold': 'Helvetica-Bold','Helvetica-BoldItalic': 'Helvetica-BoldOblique',+ 'Helvetica-BoldOblique': 'Helvetica-BoldOblique','Helvetica-Italic': 'Helvetica-Oblique',+ 'Helvetica-Oblique':'Helvetica-Oblique','Symbol-Bold': 'Symbol','Symbol-BoldItalic': 'Symbol','Symbol-Italic': 'Symbol',@@ -14213,6 +14433,10 @@ var stdFontMap = {* fonts without glyph data.*/var nonStdFontMap = {+ 'CenturyGothic': 'Helvetica',+ 'CenturyGothic-Bold': 'Helvetica-Bold',+ 'CenturyGothic-BoldItalic': 'Helvetica-BoldOblique',+ 'CenturyGothic-Italic': 'Helvetica-Oblique','ComicSansMS': 'Comic Sans MS','ComicSansMS-Bold': 'Comic Sans MS-Bold','ComicSansMS-BoldItalic': 'Comic Sans MS-BoldItalic',@@ -14236,7 +14460,8 @@ var nonStdFontMap = {'MS-PMincho': 'MS PMincho','MS-PMincho-Bold': 'MS PMincho-Bold','MS-PMincho-BoldItalic': 'MS PMincho-BoldItalic',- 'MS-PMincho-Italic': 'MS PMincho-Italic'+ 'MS-PMincho-Italic': 'MS PMincho-Italic',+ 'Wingdings': 'ZapfDingbats'};var serifFonts = {@@ -14320,8 +14545,11 @@ var GlyphMapForStandardFonts = {'156': 8747, '157': 170, '158': 186, '159': 8486, '160': 230, '161': 248,'162': 191, '163': 161, '164': 172, '165': 8730, '166': 402, '167': 8776,'168': 8710, '169': 171, '170': 187, '171': 8230, '210': 218, '223': 711,- '227': 353, '229': 382, '234': 253, '253': 268, '254': 269, '258': 258,- '268': 283, '269': 313, '278': 328, '284': 345, '292': 367, '305': 963,+ '224': 321, '225': 322, '227': 353, '229': 382, '234': 253, '252': 263,+ '253': 268, '254': 269, '258': 258, '260': 260, '261': 261, '265': 280,+ '266': 281, '268': 283, '269': 313, '275': 323, '276': 324, '278': 328,+ '284': 345, '285': 346, '286': 347, '292': 367, '295': 377, '296': 378,+ '298': 380, '305': 963,'306': 964, '307': 966, '308': 8215, '309': 8252, '310': 8319, '311': 8359,'312': 8592, '313': 8593, '337': 9552, '493': 1039, '494': 1040, '705': 1524,'706': 8362, '710': 64288, '711': 64298, '759': 1617, '761': 1776,@@ -14362,29 +14590,42 @@ var GlyphMapForStandardFonts = {'3316': 578, '3379': 42785, '3393': 1159, '3416': 8377};-// Some characters, e.g. copyrightserif, mapped to the private use area and+// Some characters, e.g. copyrightserif, are mapped to the private use area and// might not be displayed using standard fonts. Mapping/hacking well-known chars// to the similar equivalents in the normal characters range.+var SpecialPUASymbols = {+ '63721': 0x00A9, // copyrightsans (0xF8E9) => copyright+ '63193': 0x00A9, // copyrightserif (0xF6D9) => copyright+ '63720': 0x00AE, // registersans (0xF8E8) => registered+ '63194': 0x00AE, // registerserif (0xF6DA) => registered+ '63722': 0x2122, // trademarksans (0xF8EA) => trademark+ '63195': 0x2122, // trademarkserif (0xF6DB) => trademark+ '63729': 0x23A7, // bracelefttp (0xF8F1)+ '63730': 0x23A8, // braceleftmid (0xF8F2)+ '63731': 0x23A9, // braceleftbt (0xF8F3)+ '63740': 0x23AB, // bracerighttp (0xF8FC)+ '63741': 0x23AC, // bracerightmid (0xF8FD)+ '63742': 0x23AD, // bracerightbt (0xF8FE)+ '63726': 0x23A1, // bracketlefttp (0xF8EE)+ '63727': 0x23A2, // bracketleftex (0xF8EF)+ '63728': 0x23A3, // bracketleftbt (0xF8F0)+ '63737': 0x23A4, // bracketrighttp (0xF8F9)+ '63738': 0x23A5, // bracketrightex (0xF8FA)+ '63739': 0x23A6, // bracketrightbt (0xF8FB)+ '63723': 0x239B, // parenlefttp (0xF8EB)+ '63724': 0x239C, // parenleftex (0xF8EC)+ '63725': 0x239D, // parenleftbt (0xF8ED)+ '63734': 0x239E, // parenrighttp (0xF8F6)+ '63735': 0x239F, // parenrightex (0xF8F7)+ '63736': 0x23A0, // parenrightbt (0xF8F8)+};function mapSpecialUnicodeValues(code) {if (code >= 0xFFF0 && code <= 0xFFFF) { // Specials unicode block.return 0;+ } else if (code >= 0xF600 && code <= 0xF8FF) {+ return (SpecialPUASymbols[code] || code);}- switch (code) {- case 0xF8E9: // copyrightsans- case 0xF6D9: // copyrightserif- return 0x00A9; // copyright-- case 0xF8E8: // registersans- case 0xF6DA: // registerserif- return 0x00AE; // registered-- case 0xF8EA: // trademarksans- case 0xF6DB: // trademarkserif- return 0x2122; // trademark-- default:- return code;- }+ return code;}var UnicodeRanges = [@@ -16044,6 +16285,10 @@ var ToUnicodeMap = (function ToUnicodeMapClosure() {}},+ has: function(i) {+ return this._map[i] !== undefined;+ },+get: function(i) {return this._map[i];},@@ -16073,6 +16318,10 @@ var IdentityToUnicodeMap = (function IdentityToUnicodeMapClosure() {}},+ has: function (i) {+ return this.firstChar <= i && i <= this.lastChar;+ },+get: function (i) {if (this.firstChar <= i && i <= this.lastChar) {return String.fromCharCode(i);@@ -16239,7 +16488,7 @@ var OpenTypeFileBuilder = (function OpenTypeFileBuilderClosure() {*/var Font = (function FontClosure() {function Font(name, file, properties) {- var charCode, glyphName;+ var charCode, glyphName, fontChar;this.name = name;this.loadedName = properties.loadedName;@@ -16303,7 +16552,8 @@ var Font = (function FontClosure() {// The file data is not specified. Trying to fix the font name// to be used with the canvas.font.var fontName = name.replace(/[,_]/g, '-');- var isStandardFont = fontName in stdFontMap;+ var isStandardFont = !!stdFontMap[fontName] ||+ !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;this.bold = (fontName.search(/bold/gi) !== -1);@@ -16324,12 +16574,45 @@ var Font = (function FontClosure() {for (var code in GlyphMapForStandardFonts) {map[+code] = GlyphMapForStandardFonts[code];}+ var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;+ if (!isIdentityUnicode) {+ this.toUnicode.forEach(function(charCode, unicodeCharCode) {+ map[+charCode] = unicodeCharCode;+ });+ }this.toFontChar = map;this.toUnicode = new ToUnicodeMap(map);} else if (/Symbol/i.test(fontName)) {var symbols = Encodings.SymbolSetEncoding;for (charCode in symbols) {- var fontChar = GlyphsUnicode[symbols[charCode]];+ fontChar = GlyphsUnicode[symbols[charCode]];+ if (!fontChar) {+ continue;+ }+ this.toFontChar[charCode] = fontChar;+ }+ for (charCode in properties.differences) {+ fontChar = GlyphsUnicode[properties.differences[charCode]];+ if (!fontChar) {+ continue;+ }+ this.toFontChar[charCode] = fontChar;+ }+ } else if (/Dingbats/i.test(fontName)) {+ if (/Wingdings/i.test(name)) {+ warn('Wingdings font without embedded font file, ' ++ 'falling back to the ZapfDingbats encoding.');+ }+ var dingbats = Encodings.ZapfDingbatsEncoding;+ for (charCode in dingbats) {+ fontChar = DingbatsGlyphsUnicode[dingbats[charCode]];+ if (!fontChar) {+ continue;+ }+ this.toFontChar[charCode] = fontChar;+ }+ for (charCode in properties.differences) {+ fontChar = DingbatsGlyphsUnicode[properties.differences[charCode]];if (!fontChar) {continue;}@@ -16371,14 +16654,15 @@ var Font = (function FontClosure() {if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {type = 'CIDFontType0';}- // XXX: Temporarily change the type for open type so we trigger a warning.- // This should be removed when we add support for open type.if (subtype === 'OpenType') {type = 'OpenType';}var data;switch (type) {+ case 'MMType1':+ info('MMType1 font (' + name + '), falling back to Type1.');+ /* falls through */case 'Type1':case 'CIDFontType0':this.mimetype = 'font/opentype';@@ -16468,7 +16752,6 @@ var Font = (function FontClosure() {var isSymbolic = !!(properties.flags & FontFlags.Symbolic);var isIdentityUnicode =properties.toUnicode instanceof IdentityToUnicodeMap;- var isCidFontType2 = (properties.type === 'CIDFontType2');var newMap = Object.create(null);var toFontChar = [];var usedFontCharCodes = [];@@ -16479,17 +16762,11 @@ var Font = (function FontClosure() {var fontCharCode = originalCharCode;// First try to map the value to a unicode position if a non identity map// was created.- if (!isIdentityUnicode) {- if (toUnicode.get(originalCharCode) !== undefined) {- var unicode = toUnicode.get(fontCharCode);- // TODO: Try to map ligatures to the correct spot.- if (unicode.length === 1) {- fontCharCode = unicode.charCodeAt(0);- }- } else if (isCidFontType2) {- // For CIDFontType2, move characters not present in toUnicode- // to the private use area (fixes bug 1028735 and issue 4881).- fontCharCode = nextAvailableFontCharCode;+ if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {+ var unicode = toUnicode.get(fontCharCode);+ // TODO: Try to map ligatures to the correct spot.+ if (unicode.length === 1) {+ fontCharCode = unicode.charCodeAt(0);}}// Try to move control characters, special characters and already mapped@@ -16502,6 +16779,7 @@ var Font = (function FontClosure() {fontCharCode <= 0x1f || // Control charsfontCharCode === 0x7F || // Control charfontCharCode === 0xAD || // Soft hyphen+ fontCharCode === 0xA0 || // Non breaking space(fontCharCode >= 0x80 && fontCharCode <= 0x9F) || // Control chars// Prevent drawing characters in the specials unicode block.(fontCharCode >= 0xFFF0 && fontCharCode <= 0xFFFF) ||@@ -16978,13 +17256,20 @@ var Font = (function FontClosure() {var offset = font.getInt32() >>> 0;var useTable = false;- if (platformId === 1 && encodingId === 0) {+ if (platformId === 0 && encodingId === 0) {useTable = true;// Continue the loop since there still may be a higher priority// table.- } else if (!isSymbolicFont && platformId === 3 && encodingId === 1) {+ } else if (platformId === 1 && encodingId === 0) {useTable = true;- canBreak = true;+ // Continue the loop since there still may be a higher priority+ // table.+ } else if (platformId === 3 && encodingId === 1 &&+ (!isSymbolicFont || !potentialTable)) {+ useTable = true;+ if (!isSymbolicFont) {+ canBreak = true;+ }} else if (isSymbolicFont && platformId === 3 && encodingId === 0) {useTable = true;canBreak = true;@@ -17162,16 +17447,12 @@ var Font = (function FontClosure() {var numMissing = numOfSidebearings -((metrics.length - numOfMetrics * 4) >> 1);- var i, ii;if (numMissing > 0) {- font.pos = (font.start ? font.start : 0) + metrics.offset;- var entries = '';- for (i = 0, ii = metrics.length; i < ii; i++) {- entries += String.fromCharCode(font.getByte());- }- for (i = 0; i < numMissing; i++) {- entries += '\x00\x00';- }+ // For each missing glyph, we set both the width and lsb to 0 (zero).+ // Since we need to add two properties for each glyph, this explains+ // the use of |numMissing * 2| when initializing the typed array.+ var entries = new Uint8Array(metrics.length + numMissing * 2);+ entries.set(metrics.data);metrics.data = entries;}}@@ -17333,6 +17614,7 @@ var Font = (function FontClosure() {var newGlyfData = new Uint8Array(oldGlyfDataLength);var startOffset = itemDecode(locaData, 0);var writeOffset = 0;+ var missingGlyphData = {};itemEncode(locaData, 0, writeOffset);var i, j;for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {@@ -17350,6 +17632,10 @@ var Font = (function FontClosure() {continue;}+ if (startOffset === endOffset) {+ missingGlyphData[i] = true;+ }+var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset,newGlyfData, writeOffset, hintsValid);writeOffset += newLength;@@ -17366,7 +17652,7 @@ var Font = (function FontClosure() {itemEncode(locaData, j, simpleGlyph.length);}glyf.data = simpleGlyph;- return;+ return missingGlyphData;}if (dupFirstEntry) {@@ -17383,6 +17669,7 @@ var Font = (function FontClosure() {} else {glyf.data = newGlyfData.subarray(0, writeOffset);}+ return missingGlyphData;}function readPostScriptTable(post, properties, maxpNumGlyphs) {@@ -17773,7 +18060,8 @@ var Font = (function FontClosure() {var isTrueType = !tables['CFF '];if (!isTrueType) {// OpenType font- if (!tables.head || !tables.hhea || !tables.maxp || !tables.post) {+ if (header.version === 'OTTO' ||+ !tables.head || !tables.hhea || !tables.maxp || !tables.post) {// no major tables: throwing everything at CFFFontcffFile = new Stream(tables['CFF '].data);cff = new CFFFont(cffFile, properties);@@ -17842,11 +18130,13 @@ var Font = (function FontClosure() {sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);+ var missingGlyphs = {};if (isTrueType) {var isGlyphLocationsLong = int16(tables.head.data[50],tables.head.data[51]);- sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs,- isGlyphLocationsLong, hintsValid, dupFirstEntry);+ missingGlyphs = sanitizeGlyphLocations(tables.loca, tables.glyf,+ numGlyphs, isGlyphLocationsLong,+ hintsValid, dupFirstEntry);}if (!tables.hhea) {@@ -17868,19 +18158,33 @@ var Font = (function FontClosure() {}}- var charCodeToGlyphId = [], charCode;+ var charCodeToGlyphId = [], charCode, toUnicode = properties.toUnicode;++ function hasGlyph(glyphId, charCode) {+ if (!missingGlyphs[glyphId]) {+ return true;+ }+ if (charCode >= 0 && toUnicode.has(charCode)) {+ return true;+ }+ return false;+ }+if (properties.type === 'CIDFontType2') {var cidToGidMap = properties.cidToGidMap || [];- var cidToGidMapLength = cidToGidMap.length;+ var isCidToGidMapEmpty = cidToGidMap.length === 0;+properties.cMap.forEach(function(charCode, cid) {assert(cid <= 0xffff, 'Max size of CID is 65,535');var glyphId = -1;- if (cidToGidMapLength === 0) {+ if (isCidToGidMapEmpty) {glyphId = charCode;} else if (cidToGidMap[cid] !== undefined) {glyphId = cidToGidMap[cid];}- if (glyphId >= 0 && glyphId < numGlyphs) {++ if (glyphId >= 0 && glyphId < numGlyphs &&+ hasGlyph(glyphId, charCode)) {charCodeToGlyphId[charCode] = glyphId;}});@@ -17903,7 +18207,15 @@ var Font = (function FontClosure() {// where the the font is symbolic and it has an encoding.if (hasEncoding &&(cmapPlatformId === 3 && cmapEncodingId === 1 ||- cmapPlatformId === 1 && cmapEncodingId === 0)) {+ cmapPlatformId === 1 && cmapEncodingId === 0) ||+ (cmapPlatformId === -1 && cmapEncodingId === -1 && // Temporary hack+ !!Encodings[properties.baseEncodingName])) { // Temporary hack+ // When no preferred cmap table was found and |baseEncodingName| is+ // one of the predefined encodings, we seem to obtain a better+ // |charCodeToGlyphId| map from the code below (fixes bug 1057544).+ // TODO: Note that this is a hack which should be removed as soon as+ // we have proper support for more exotic cmap tables.+var baseEncoding = [];if (properties.baseEncodingName === 'MacRomanEncoding' ||properties.baseEncodingName === 'WinAnsiEncoding') {@@ -17932,7 +18244,8 @@ var Font = (function FontClosure() {var found = false;for (i = 0; i < cmapMappingsLength; ++i) {- if (cmapMappings[i].charCode === unicodeOrCharCode) {+ if (cmapMappings[i].charCode === unicodeOrCharCode &&+ hasGlyph(cmapMappings[i].glyphId, unicodeOrCharCode)) {charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;found = true;break;@@ -17942,11 +18255,17 @@ var Font = (function FontClosure() {// Try to map using the post table. There are currently no known// pdfs that this fixes.var glyphId = properties.glyphNames.indexOf(glyphName);- if (glyphId > 0) {+ if (glyphId > 0 && hasGlyph(glyphId, -1)) {charCodeToGlyphId[charCode] = glyphId;}}}+ } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {+ // Default Unicode semantics, use the charcodes as is.+ for (i = 0; i < cmapMappingsLength; ++i) {+ charCodeToGlyphId[cmapMappings[i].charCode] =+ cmapMappings[i].glyphId;+ }} else {// For (3, 0) cmap tables:// The charcode key being stored in charCodeToGlyphId is the lower@@ -18516,6 +18835,8 @@ function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {glyphId = glyphNames.indexOf(baseEncoding[charCode]);if (glyphId >= 0) {charCodeToGlyphId[charCode] = glyphId;+ } else {+ charCodeToGlyphId[charCode] = 0; // notdef}}} else if (!!(properties.flags & FontFlags.Symbolic)) {@@ -18532,6 +18853,8 @@ function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {glyphId = glyphNames.indexOf(baseEncoding[charCode]);if (glyphId >= 0) {charCodeToGlyphId[charCode] = glyphId;+ } else {+ charCodeToGlyphId[charCode] = 0; // notdef}}}@@ -18544,6 +18867,8 @@ function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {glyphId = glyphNames.indexOf(glyphName);if (glyphId >= 0) {charCodeToGlyphId[charCode] = glyphId;+ } else {+ charCodeToGlyphId[charCode] = 0; // notdef}}}@@ -21705,7 +22030,6 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {})();-var GlyphsUnicode = {A: 0x0041,AE: 0x00C6,@@ -25913,6 +26237,211 @@ var GlyphsUnicode = {'.notdef': 0x0000};+var DingbatsGlyphsUnicode = {+ space: 0x0020,+ a1: 0x2701,+ a2: 0x2702,+ a202: 0x2703,+ a3: 0x2704,+ a4: 0x260E,+ a5: 0x2706,+ a119: 0x2707,+ a118: 0x2708,+ a117: 0x2709,+ a11: 0x261B,+ a12: 0x261E,+ a13: 0x270C,+ a14: 0x270D,+ a15: 0x270E,+ a16: 0x270F,+ a105: 0x2710,+ a17: 0x2711,+ a18: 0x2712,+ a19: 0x2713,+ a20: 0x2714,+ a21: 0x2715,+ a22: 0x2716,+ a23: 0x2717,+ a24: 0x2718,+ a25: 0x2719,+ a26: 0x271A,+ a27: 0x271B,+ a28: 0x271C,+ a6: 0x271D,+ a7: 0x271E,+ a8: 0x271F,+ a9: 0x2720,+ a10: 0x2721,+ a29: 0x2722,+ a30: 0x2723,+ a31: 0x2724,+ a32: 0x2725,+ a33: 0x2726,+ a34: 0x2727,+ a35: 0x2605,+ a36: 0x2729,+ a37: 0x272A,+ a38: 0x272B,+ a39: 0x272C,+ a40: 0x272D,+ a41: 0x272E,+ a42: 0x272F,+ a43: 0x2730,+ a44: 0x2731,+ a45: 0x2732,+ a46: 0x2733,+ a47: 0x2734,+ a48: 0x2735,+ a49: 0x2736,+ a50: 0x2737,+ a51: 0x2738,+ a52: 0x2739,+ a53: 0x273A,+ a54: 0x273B,+ a55: 0x273C,+ a56: 0x273D,+ a57: 0x273E,+ a58: 0x273F,+ a59: 0x2740,+ a60: 0x2741,+ a61: 0x2742,+ a62: 0x2743,+ a63: 0x2744,+ a64: 0x2745,+ a65: 0x2746,+ a66: 0x2747,+ a67: 0x2748,+ a68: 0x2749,+ a69: 0x274A,+ a70: 0x274B,+ a71: 0x25CF,+ a72: 0x274D,+ a73: 0x25A0,+ a74: 0x274F,+ a203: 0x2750,+ a75: 0x2751,+ a204: 0x2752,+ a76: 0x25B2,+ a77: 0x25BC,+ a78: 0x25C6,+ a79: 0x2756,+ a81: 0x25D7,+ a82: 0x2758,+ a83: 0x2759,+ a84: 0x275A,+ a97: 0x275B,+ a98: 0x275C,+ a99: 0x275D,+ a100: 0x275E,+ a101: 0x2761,+ a102: 0x2762,+ a103: 0x2763,+ a104: 0x2764,+ a106: 0x2765,+ a107: 0x2766,+ a108: 0x2767,+ a112: 0x2663,+ a111: 0x2666,+ a110: 0x2665,+ a109: 0x2660,+ a120: 0x2460,+ a121: 0x2461,+ a122: 0x2462,+ a123: 0x2463,+ a124: 0x2464,+ a125: 0x2465,+ a126: 0x2466,+ a127: 0x2467,+ a128: 0x2468,+ a129: 0x2469,+ a130: 0x2776,+ a131: 0x2777,+ a132: 0x2778,+ a133: 0x2779,+ a134: 0x277A,+ a135: 0x277B,+ a136: 0x277C,+ a137: 0x277D,+ a138: 0x277E,+ a139: 0x277F,+ a140: 0x2780,+ a141: 0x2781,+ a142: 0x2782,+ a143: 0x2783,+ a144: 0x2784,+ a145: 0x2785,+ a146: 0x2786,+ a147: 0x2787,+ a148: 0x2788,+ a149: 0x2789,+ a150: 0x278A,+ a151: 0x278B,+ a152: 0x278C,+ a153: 0x278D,+ a154: 0x278E,+ a155: 0x278F,+ a156: 0x2790,+ a157: 0x2791,+ a158: 0x2792,+ a159: 0x2793,+ a160: 0x2794,+ a161: 0x2192,+ a163: 0x2194,+ a164: 0x2195,+ a196: 0x2798,+ a165: 0x2799,+ a192: 0x279A,+ a166: 0x279B,+ a167: 0x279C,+ a168: 0x279D,+ a169: 0x279E,+ a170: 0x279F,+ a171: 0x27A0,+ a172: 0x27A1,+ a173: 0x27A2,+ a162: 0x27A3,+ a174: 0x27A4,+ a175: 0x27A5,+ a176: 0x27A6,+ a177: 0x27A7,+ a178: 0x27A8,+ a179: 0x27A9,+ a193: 0x27AA,+ a180: 0x27AB,+ a199: 0x27AC,+ a181: 0x27AD,+ a200: 0x27AE,+ a182: 0x27AF,+ a201: 0x27B1,+ a183: 0x27B2,+ a184: 0x27B3,+ a197: 0x27B4,+ a185: 0x27B5,+ a194: 0x27B6,+ a198: 0x27B7,+ a186: 0x27B8,+ a195: 0x27B9,+ a187: 0x27BA,+ a188: 0x27BB,+ a189: 0x27BC,+ a190: 0x27BD,+ a191: 0x27BE,+ a89: 0x2768, // 0xF8D7+ a90: 0x2769, // 0xF8D8+ a93: 0x276A, // 0xF8D9+ a94: 0x276B, // 0xF8DA+ a91: 0x276C, // 0xF8DB+ a92: 0x276D, // 0xF8DC+ a205: 0x276E, // 0xF8DD+ a85: 0x276F, // 0xF8DE+ a206: 0x2770, // 0xF8DF+ a86: 0x2771, // 0xF8E0+ a87: 0x2772, // 0xF8E1+ a88: 0x2773, // 0xF8E2+ a95: 0x2774, // 0xF8E3+ a96: 0x2775, // 0xF8E4+ '.notdef': 0x0000+};var PDFImage = (function PDFImageClosure() {@@ -29507,23 +30036,20 @@ var Metrics = {};-var EOF = {};function isEOF(v) {return (v === EOF);}+var MAX_LENGTH_TO_CACHE = 1000;+var Parser = (function ParserClosure() {function Parser(lexer, allowStreams, xref) {this.lexer = lexer;this.allowStreams = allowStreams;this.xref = xref;- this.imageCache = {- length: 0,- adler32: 0,- stream: null- };+ this.imageCache = {};this.refill();}@@ -29614,31 +30140,14 @@ var Parser = (function ParserClosure() {// simple objectreturn buf1;},- makeInlineImage: function Parser_makeInlineImage(cipherTransform) {- var lexer = this.lexer;- var stream = lexer.stream;-- // parse dictionary- var dict = new Dict(null);- while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) {- if (!isName(this.buf1)) {- error('Dictionary key must be a name object');- }-- var key = this.buf1.name;- this.shift();- if (isEOF(this.buf1)) {- break;- }- dict.set(key, this.getObj(cipherTransform));- }-- // parse image stream- var startPos = stream.pos;-- // searching for the /EI\s/- var state = 0, ch, i, ii;- var E = 0x45, I = 0x49, SPACE = 0x20, NL = 0xA, CR = 0xD;+ /**+ * Find the end of the stream by searching for the /EI\s/.+ * @returns {number} The inline stream length.+ */+ findDefaultInlineStreamEnd:+ function Parser_findDefaultInlineStreamEnd(stream) {+ var E = 0x45, I = 0x49, SPACE = 0x20, LF = 0xA, CR = 0xD;+ var startPos = stream.pos, state = 0, ch, i, n, followingBytes;while ((ch = stream.getByte()) !== -1) {if (state === 0) {state = (ch === E) ? 1 : 0;@@ -29646,13 +30155,13 @@ var Parser = (function ParserClosure() {state = (ch === I) ? 2 : 0;} else {assert(state === 2);- if (ch === SPACE || ch === NL || ch === CR) {+ if (ch === SPACE || ch === LF || ch === CR) {// Let's check the next five bytes are ASCII... just be sure.- var n = 5;- var followingBytes = stream.peekBytes(n);+ n = 5;+ followingBytes = stream.peekBytes(n);for (i = 0; i < n; i++) {ch = followingBytes[i];- if (ch !== NL && ch !== CR && (ch < SPACE || ch > 0x7F)) {+ if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) {// Not a LF, CR, SPACE or any visible ASCII character, i.e.// it's binary stuff. Resetting the state.state = 0;@@ -29660,45 +30169,236 @@ var Parser = (function ParserClosure() {}}if (state === 2) {- break; // finished!+ break; // Finished!}} else {state = 0;}}}+ return ((stream.pos - 4) - startPos);+ },+ /**+ * Find the EOI (end-of-image) marker 0xFFD9 of the stream.+ * @returns {number} The inline stream length.+ */+ findDCTDecodeInlineStreamEnd:+ function Parser_findDCTDecodeInlineStreamEnd(stream) {+ var startPos = stream.pos, foundEOI = false, b, markerLength, length;+ while ((b = stream.getByte()) !== -1) {+ if (b !== 0xFF) { // Not a valid marker.+ continue;+ }+ switch (stream.getByte()) {+ case 0x00: // Byte stuffing.+ // 0xFF00 appears to be a very common byte sequence in JPEG images.+ break;++ case 0xFF: // Fill byte.+ // Avoid skipping a valid marker, resetting the stream position.+ stream.skip(-1);+ break;++ case 0xD9: // EOI+ foundEOI = true;+ break;++ case 0xC0: // SOF0+ case 0xC1: // SOF1+ case 0xC2: // SOF2+ case 0xC3: // SOF3++ case 0xC5: // SOF5+ case 0xC6: // SOF6+ case 0xC7: // SOF7++ case 0xC9: // SOF9+ case 0xCA: // SOF10+ case 0xCB: // SOF11++ case 0xCD: // SOF13+ case 0xCE: // SOF14+ case 0xCF: // SOF15++ case 0xC4: // DHT+ case 0xCC: // DAC++ case 0xDA: // SOS+ case 0xDB: // DQT+ case 0xDC: // DNL+ case 0xDD: // DRI+ case 0xDE: // DHP+ case 0xDF: // EXP++ case 0xE0: // APP0+ case 0xE1: // APP1+ case 0xE2: // APP2+ case 0xE3: // APP3+ case 0xE4: // APP4+ case 0xE5: // APP5+ case 0xE6: // APP6+ case 0xE7: // APP7+ case 0xE8: // APP8+ case 0xE9: // APP9+ case 0xEA: // APP10+ case 0xEB: // APP11+ case 0xEC: // APP12+ case 0xED: // APP13+ case 0xEE: // APP14+ case 0xEF: // APP15++ case 0xFE: // COM+ // The marker should be followed by the length of the segment.+ markerLength = stream.getUint16();+ if (markerLength > 2) {+ // |markerLength| contains the byte length of the marker segment,+ // including its own length (2 bytes) and excluding the marker.+ stream.skip(markerLength - 2); // Jump to the next marker.+ } else {+ // The marker length is invalid, resetting the stream position.+ stream.skip(-2);+ }+ break;+ }+ if (foundEOI) {+ break;+ }+ }+ length = stream.pos - startPos;+ if (b === -1) {+ warn('Inline DCTDecode image stream: ' ++ 'EOI marker not found, searching for /EI/ instead.');+ stream.skip(-length); // Reset the stream position.+ return this.findDefaultInlineStreamEnd(stream);+ }+ this.inlineStreamSkipEI(stream);+ return length;+ },+ /**+ * Find the EOD (end-of-data) marker '~>' (i.e. TILDE + GT) of the stream.+ * @returns {number} The inline stream length.+ */+ findASCII85DecodeInlineStreamEnd:+ function Parser_findASCII85DecodeInlineStreamEnd(stream) {+ var TILDE = 0x7E, GT = 0x3E;+ var startPos = stream.pos, ch, length;+ while ((ch = stream.getByte()) !== -1) {+ if (ch === TILDE && stream.peekByte() === GT) {+ stream.skip();+ break;+ }+ }+ length = stream.pos - startPos;+ if (ch === -1) {+ warn('Inline ASCII85Decode image stream: ' ++ 'EOD marker not found, searching for /EI/ instead.');+ stream.skip(-length); // Reset the stream position.+ return this.findDefaultInlineStreamEnd(stream);+ }+ this.inlineStreamSkipEI(stream);+ return length;+ },+ /**+ * Find the EOD (end-of-data) marker '>' (i.e. GT) of the stream.+ * @returns {number} The inline stream length.+ */+ findASCIIHexDecodeInlineStreamEnd:+ function Parser_findASCIIHexDecodeInlineStreamEnd(stream) {+ var GT = 0x3E;+ var startPos = stream.pos, ch, length;+ while ((ch = stream.getByte()) !== -1) {+ if (ch === GT) {+ break;+ }+ }+ length = stream.pos - startPos;+ if (ch === -1) {+ warn('Inline ASCIIHexDecode image stream: ' ++ 'EOD marker not found, searching for /EI/ instead.');+ stream.skip(-length); // Reset the stream position.+ return this.findDefaultInlineStreamEnd(stream);+ }+ this.inlineStreamSkipEI(stream);+ return length;+ },+ /**+ * Skip over the /EI/ for streams where we search for an EOD marker.+ */+ inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) {+ var E = 0x45, I = 0x49;+ var state = 0, ch;+ while ((ch = stream.getByte()) !== -1) {+ if (state === 0) {+ state = (ch === E) ? 1 : 0;+ } else if (state === 1) {+ state = (ch === I) ? 2 : 0;+ } else if (state === 2) {+ break;+ }+ }+ },+ makeInlineImage: function Parser_makeInlineImage(cipherTransform) {+ var lexer = this.lexer;+ var stream = lexer.stream;++ // Parse dictionary.+ var dict = new Dict(null);+ while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) {+ if (!isName(this.buf1)) {+ error('Dictionary key must be a name object');+ }+ var key = this.buf1.name;+ this.shift();+ if (isEOF(this.buf1)) {+ break;+ }+ dict.set(key, this.getObj(cipherTransform));+ }- var length = (stream.pos - 4) - startPos;+ // Extract the name of the first (i.e. the current) image filter.+ var filter = this.fetchIfRef(dict.get('Filter', 'F')), filterName;+ if (isName(filter)) {+ filterName = filter.name;+ } else if (isArray(filter) && isName(filter[0])) {+ filterName = filter[0].name;+ }++ // Parse image stream.+ var startPos = stream.pos, length, i, ii;+ if (filterName === 'DCTDecode' || filterName === 'DCT') {+ length = this.findDCTDecodeInlineStreamEnd(stream);+ } else if (filterName === 'ASCII85Decide' || filterName === 'A85') {+ length = this.findASCII85DecodeInlineStreamEnd(stream);+ } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') {+ length = this.findASCIIHexDecodeInlineStreamEnd(stream);+ } else {+ length = this.findDefaultInlineStreamEnd(stream);+ }var imageStream = stream.makeSubStream(startPos, length, dict);- // trying to cache repeat images, first we are trying to "warm up" caching- // using length, then comparing adler32- var MAX_LENGTH_TO_CACHE = 1000;- var cacheImage = false, adler32;- if (length < MAX_LENGTH_TO_CACHE && this.imageCache.length === length) {+ // Cache all images below the MAX_LENGTH_TO_CACHE threshold by their+ // adler32 checksum.+ var adler32;+ if (length < MAX_LENGTH_TO_CACHE) {var imageBytes = imageStream.getBytes();imageStream.reset();var a = 1;var b = 0;for (i = 0, ii = imageBytes.length; i < ii; ++i) {- a = (a + (imageBytes[i] & 0xff)) % 65521;- b = (b + a) % 65521;+ // No modulo required in the loop if imageBytes.length < 5552.+ a += imageBytes[i] & 0xff;+ b += a;}- adler32 = (b << 16) | a;+ adler32 = ((b % 65521) << 16) | (a % 65521);- if (this.imageCache.stream && this.imageCache.adler32 === adler32) {+ if (this.imageCache.adler32 === adler32) {this.buf2 = Cmd.get('EI');this.shift();- this.imageCache.stream.reset();- return this.imageCache.stream;+ this.imageCache[adler32].reset();+ return this.imageCache[adler32];}- cacheImage = true;- }- if (!cacheImage && !this.imageCache.stream) {- this.imageCache.length = length;- this.imageCache.stream = null;}if (cipherTransform) {@@ -29707,10 +30407,9 @@ var Parser = (function ParserClosure() {imageStream = this.filter(imageStream, dict, length);imageStream.dict = dict;- if (cacheImage) {+ if (adler32 !== undefined) {imageStream.cacheKey = 'inline_' + length + '_' + adler32;- this.imageCache.adler32 = adler32;- this.imageCache.stream = imageStream;+ this.imageCache[adler32] = imageStream;}this.buf2 = Cmd.get('EI');@@ -29832,6 +30531,9 @@ var Parser = (function ParserClosure() {return new NullStream(stream);}try {+ if (params) {+ params = this.fetchIfRef(params);+ }var xrefStreamStats = this.xref.stats.streamTypes;if (name === 'FlateDecode' || name === 'Fl') {xrefStreamStats[StreamType.FLATE] = true;@@ -29961,7 +30663,7 @@ var Lexer = (function LexerClosure() {return (this.currentChar = this.stream.getByte());},peekChar: function Lexer_peekChar() {- return this.stream.peekBytes(1)[0];+ return this.stream.peekByte();},getNumber: function Lexer_getNumber() {var ch = this.currentChar;@@ -30592,6 +31294,9 @@ var Stream = (function StreamClosure() {getUint16: function Stream_getUint16() {var b0 = this.getByte();var b1 = this.getByte();+ if (b0 === -1 || b1 === -1) {+ return -1;+ }return (b0 << 8) + b1;},getInt32: function Stream_getInt32() {@@ -30618,6 +31323,11 @@ var Stream = (function StreamClosure() {this.pos = end;return bytes.subarray(pos, end);},+ peekByte: function Stream_peekByte() {+ var peekedByte = this.getByte();+ this.pos--;+ return peekedByte;+ },peekBytes: function Stream_peekBytes(length) {var bytes = this.getBytes(length);this.pos -= bytes.length;@@ -30714,6 +31424,9 @@ var DecodeStream = (function DecodeStreamClosure() {getUint16: function DecodeStream_getUint16() {var b0 = this.getByte();var b1 = this.getByte();+ if (b0 === -1 || b1 === -1) {+ return -1;+ }return (b0 << 8) + b1;},getInt32: function DecodeStream_getInt32() {@@ -30747,6 +31460,11 @@ var DecodeStream = (function DecodeStreamClosure() {this.pos = end;return this.buffer.subarray(pos, end);},+ peekByte: function DecodeStream_peekByte() {+ var peekedByte = this.getByte();+ this.pos--;+ return peekedByte;+ },peekBytes: function DecodeStream_peekBytes(length) {var bytes = this.getBytes(length);this.pos -= bytes.length;@@ -31072,7 +31790,7 @@ var FlateStream = (function FlateStreamClosure() {var end = bufferLength + blockLen;this.bufferLength = end;if (blockLen === 0) {- if (str.peekBytes(1).length === 0) {+ if (str.peekByte() === -1) {this.eof = true;}} else {@@ -31392,8 +32110,15 @@ var PredictorStream = (function PredictorStreamClosure() {*/var JpegStream = (function JpegStreamClosure() {function JpegStream(stream, maybeLength, dict, xref) {- // TODO: per poppler, some images may have 'junk' before that- // need to be removed+ // Some images may contain 'junk' before the SOI (start-of-image) marker.+ // Note: this seems to mainly affect inline images.+ var ch;+ while ((ch = stream.getByte()) !== -1) {+ if (ch === 0xFF) { // Find the first byte of the SOI marker (0xFFD8).+ stream.skip(-1); // Reset the stream position to the SOI.+ break;+ }+ }this.stream = stream;this.maybeLength = maybeLength;this.dict = dict;@@ -31419,7 +32144,7 @@ var JpegStream = (function JpegStreamClosure() {var jpegImage = new JpegImage();// checking if values needs to be transformed before conversion- if (this.dict && isArray(this.dict.get('Decode'))) {+ if (this.forceRGB && this.dict && isArray(this.dict.get('Decode'))) {var decodeArr = this.dict.get('Decode');var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;var decodeArrLength = decodeArr.length;@@ -31578,7 +32303,8 @@ var Jbig2Stream = (function Jbig2StreamClosure() {var jbig2Image = new Jbig2Image();- var chunks = [], decodeParams = this.dict.get('DecodeParms');+ var chunks = [], xref = this.dict.xref;+ var decodeParams = xref.fetchIfRef(this.dict.get('DecodeParms'));// According to the PDF specification, DecodeParms can be either// a dictionary, or an array whose elements are dictionaries.@@ -31587,7 +32313,7 @@ var Jbig2Stream = (function Jbig2StreamClosure() {warn('JBIG2 - \'DecodeParms\' array with multiple elements ' +'not supported.');}- decodeParams = decodeParams[0];+ decodeParams = xref.fetchIfRef(decodeParams[0]);}if (decodeParams && decodeParams.has('JBIG2Globals')) {var globalsStream = decodeParams.get('JBIG2Globals');@@ -32565,9 +33291,13 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {var gotEOL = false;+ if (this.byteAlign) {+ this.inputBits &= ~7;+ }+if (!this.eoblock && this.row === this.rows - 1) {this.eof = true;- } else if (this.eoline || !this.byteAlign) {+ } else {code1 = this.lookBits(12);if (this.eoline) {while (code1 !== EOF && code1 !== 1) {@@ -32588,10 +33318,6 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {}}- if (this.byteAlign && !gotEOL) {- this.inputBits &= ~7;- }-if (!this.eof && this.encoding > 0) {this.nextLine2D = !this.lookBits(1);this.eatBits(1);@@ -33052,6 +33778,7 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {httpHeaders: source.httpHeaders,withCredentials: source.withCredentials});+ var cachedChunks = [];var fullRequestXhrId = networkManager.requestFull({onHeadersReceived: function onHeadersReceived() {if (disableRange) {@@ -33071,6 +33798,20 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {var length = fullRequestXhr.getResponseHeader('Content-Length');length = parseInt(length, 10);+ if (fullRequestXhr.status === 206) {+ // Since Chrome 39, there exists a bug where cached responses are+ // served with status code 206 for non-range requests.+ // Content-Length does not specify the total size of the resource+ // when the status code is 206 (see RFC 2616, section 14.16).+ // In this case, extract the file size from the Content-Range+ // header, which is defined to be "bytes start-end/length" for+ // byte range requests.+ // See https://github.com/mozilla/pdf.js/issues/5512 and+ // https://code.google.com/p/chromium/issues/detail?id=442318+ length = fullRequestXhr.getResponseHeader('Content-Range');+ length = length && /bytes \d+-\d+\/(\d+)/.exec(length);+ length = length && parseInt(length[1], 10);+ }if (!isInt(length)) {return;}@@ -33082,11 +33823,18 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {return;}- // NOTE: by cancelling the full request, and then issuing range- // requests, there will be an issue for sites where you can only- // request the pdf once. However, if this is the case, then the- // server should not be returning that it can support range requests.- networkManager.abortRequest(fullRequestXhrId);+ if (networkManager.isStreamingRequest(fullRequestXhrId)) {+ // We can continue fetching when progressive loading is enabled,+ // and we don't need the autoFetch feature.+ source.disableAutoFetch = true;+ } else {+ // NOTE: by cancelling the full request, and then issuing range+ // requests, there will be an issue for sites where you can only+ // request the pdf once. However, if this is the case, then the+ // server should not be returning that it can support range+ // requests.+ networkManager.abortRequest(fullRequestXhrId);+ }try {pdfManager = new NetworkPdfManager(source, handler);@@ -33096,10 +33844,44 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {}},+ onProgressiveData: source.disableStream ? null :+ function onProgressiveData(chunk) {+ if (!pdfManager) {+ cachedChunks.push(chunk);+ return;+ }+ pdfManager.sendProgressiveData(chunk);+ },+onDone: function onDone(args) {+ if (pdfManager) {+ return; // already processed+ }++ var pdfFile;+ if (args === null) {+ // TODO add some streaming manager, e.g. for unknown length files.+ // The data was returned in the onProgressiveData, combining...+ var pdfFileLength = 0, pos = 0;+ cachedChunks.forEach(function (chunk) {+ pdfFileLength += chunk.byteLength;+ });+ if (source.length && pdfFileLength !== source.length) {+ warn('reported HTTP length is different from actual');+ }+ var pdfFileArray = new Uint8Array(pdfFileLength);+ cachedChunks.forEach(function (chunk) {+ pdfFileArray.set(new Uint8Array(chunk), pos);+ pos += chunk.byteLength;+ });+ pdfFile = pdfFileArray.buffer;+ } else {+ pdfFile = args.chunk;+ }+// the data is array, instantiating directly from ittry {- pdfManager = new LocalPdfManager(args.chunk, source.password);+ pdfManager = new LocalPdfManager(pdfFile, source.password);pdfManagerCapability.resolve();} catch (ex) {pdfManagerCapability.reject(ex);@@ -33107,14 +33889,16 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {},onError: function onError(status) {+ var exception;if (status === 404) {- var exception = new MissingPDFException('Missing PDF "' +- source.url + '".');- handler.send('MissingPDF', { exception: exception });+ exception = new MissingPDFException('Missing PDF "' ++ source.url + '".');+ handler.send('MissingPDF', exception);} else {- handler.send('DocError', 'Unexpected server response (' +- status + ') while retrieving PDF "' +- source.url + '".');+ exception = new UnexpectedResponseException(+ 'Unexpected server response (' + status ++ ') while retrieving PDF "' + source.url + '".', status);+ handler.send('UnexpectedResponse', exception);}},@@ -33166,26 +33950,19 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {var onFailure = function(e) {if (e instanceof PasswordException) {if (e.code === PasswordResponses.NEED_PASSWORD) {- handler.send('NeedPassword', {- exception: e- });+ handler.send('NeedPassword', e);} else if (e.code === PasswordResponses.INCORRECT_PASSWORD) {- handler.send('IncorrectPassword', {- exception: e- });+ handler.send('IncorrectPassword', e);}} else if (e instanceof InvalidPDFException) {- handler.send('InvalidPDF', {- exception: e- });+ handler.send('InvalidPDF', e);} else if (e instanceof MissingPDFException) {- handler.send('MissingPDF', {- exception: e- });+ handler.send('MissingPDF', e);+ } else if (e instanceof UnexpectedResponseException) {+ handler.send('UnexpectedResponse', e);} else {- handler.send('UnknownError', {- exception: new UnknownErrorException(e.message, e.toString())- });+ handler.send('UnknownError',+ new UnknownErrorException(e.message, e.toString()));}};@@ -33199,6 +33976,7 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {PDFJS.cMapPacked = data.cMapPacked === true;getPdfManager(data).then(function () {+ handler.send('PDFManagerReady', null);pdfManager.onLoadedStream().then(function(stream) {handler.send('DataLoaded', { length: stream.bytes.byteLength });});@@ -33253,6 +34031,12 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {});+ handler.on('GetDestination',+ function wphSetupGetDestination(data) {+ return pdfManager.ensureCatalog('getDestination', [ data.id ]);+ }+ );+handler.on('GetAttachments',function wphSetupGetAttachments(data) {return pdfManager.ensureCatalog('attachments');@@ -33423,9 +34207,9 @@ if (typeof window === 'undefined') {/* This class implements the QM Coder decoding as defined in* JPEG 2000 Part I Final Committee Draft Version 1.0- * Annex C.3 Arithmetic decoding procedure+ * Annex C.3 Arithmetic decoding procedure* available at http://www.jpeg.org/public/fcd15444-1.pdf- *+ ** The arithmetic decoder is used in conjunction with context models to decode* JPEG2000 and JBIG2 streams.*/@@ -33688,9 +34472,8 @@ var JpegImage = (function jpegImage() {function decodeHuffman(tree) {var node = tree;- var bit;- while ((bit = readBit()) !== null) {- node = node[bit];+ while (true) {+ node = node[readBit()];if (typeof node === 'number') {return node;}@@ -33698,17 +34481,12 @@ var JpegImage = (function jpegImage() {throw 'invalid huffman sequence';}}- return null;}function receive(length) {var n = 0;while (length > 0) {- var bit = readBit();- if (bit === null) {- return;- }- n = (n << 1) | bit;+ n = (n << 1) | readBit();length--;}return n;@@ -34067,7 +34845,7 @@ var JpegImage = (function jpegImage() {// stage 3// Shift v0 by 128.5 << 5 here, so we don't need to shift p0...p7 when- // converting to UInt8 range later.+ // converting to UInt8 range later.v0 = ((v0 + v1 + 1) >> 1) + 4112;v1 = v0 - v1;t = (v2 * dctSin6 + v3 * dctCos6 + 2048) >> 12;@@ -34233,9 +35011,9 @@ var JpegImage = (function jpegImage() {if (fileMarker === 0xFFEE) {if (appData[0] === 0x41 && appData[1] === 0x64 &&appData[2] === 0x6F && appData[3] === 0x62 &&- appData[4] === 0x65 && appData[5] === 0) { // 'Adobe\x00'+ appData[4] === 0x65) { // 'Adobe'adobe = {- version: appData[6],+ version: (appData[5] << 8) | appData[6],flags0: (appData[7] << 8) | appData[8],flags1: (appData[9] << 8) | appData[10],transformCode: appData[11]@@ -34356,6 +35134,13 @@ var JpegImage = (function jpegImage() {successiveApproximation >> 4, successiveApproximation & 15);offset += processed;break;++ case 0xFFFF: // Fill bytes+ if (data[offset] !== 0xFF) { // Avoid skipping a valid marker.+ offset--;+ }+ break;+default:if (data[offset - 3] === 0xFF &&data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {@@ -34424,8 +35209,7 @@ var JpegImage = (function jpegImage() {}}- // decodeTransform will contains pairs of multiplier (-256..256) and- // additive+ // decodeTransform contains pairs of multiplier (-256..256) and additivevar transform = this.decodeTransform;if (transform) {for (i = 0; i < dataLength;) {@@ -34462,7 +35246,7 @@ var JpegImage = (function jpegImage() {},_convertYcckToRgb: function convertYcckToRgb(data) {- var Y, Cb, Cr, k, CbCb, CbCr, CbY, Cbk, CrCr, Crk, CrY, YY, Yk, kk;+ var Y, Cb, Cr, k;var offset = 0;for (var i = 0, length = data.length; i < length; i += 4) {Y = data[i];@@ -34470,43 +35254,35 @@ var JpegImage = (function jpegImage() {Cr = data[i + 2];k = data[i + 3];- CbCb = Cb * Cb;- CbCr = Cb * Cr;- CbY = Cb * Y;- Cbk = Cb * k;- CrCr = Cr * Cr;- Crk = Cr * k;- CrY = Cr * Y;- YY = Y * Y;- Yk = Y * k;- kk = k * k;-- var r = - 122.67195406894 -- 6.60635669420364e-5 * CbCb + 0.000437130475926232 * CbCr -- 5.4080610064599e-5* CbY + 0.00048449797120281* Cbk -- 0.154362151871126 * Cb - 0.000957964378445773 * CrCr +- 0.000817076911346625 * CrY - 0.00477271405408747 * Crk +- 1.53380253221734 * Cr + 0.000961250184130688 * YY -- 0.00266257332283933 * Yk + 0.48357088451265 * Y -- 0.000336197177618394 * kk + 0.484791561490776 * k;+ var r = -122.67195406894 ++ Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr -+ 5.4080610064599e-5 * Y + 0.00048449797120281 * k -+ 0.154362151871126) ++ Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y -+ 0.00477271405408747 * k + 1.53380253221734) ++ Y * (0.000961250184130688 * Y - 0.00266257332283933 * k ++ 0.48357088451265) ++ k * (-0.000336197177618394 * k + 0.484791561490776);var g = 107.268039397724 +- 2.19927104525741e-5 * CbCb - 0.000640992018297945 * CbCr +- 0.000659397001245577* CbY + 0.000426105652938837* Cbk -- 0.176491792462875 * Cb - 0.000778269941513683 * CrCr +- 0.00130872261408275 * CrY + 0.000770482631801132 * Crk -- 0.151051492775562 * Cr + 0.00126935368114843 * YY -- 0.00265090189010898 * Yk + 0.25802910206845 * Y -- 0.000318913117588328 * kk - 0.213742400323665 * k;-- var b = - 20.810012546947 -- 0.000570115196973677 * CbCb - 2.63409051004589e-5 * CbCr +- 0.0020741088115012* CbY - 0.00288260236853442* Cbk +- 0.814272968359295 * Cb - 1.53496057440975e-5 * CrCr -- 0.000132689043961446 * CrY + 0.000560833691242812 * Crk -- 0.195152027534049 * Cr + 0.00174418132927582 * YY -- 0.00255243321439347 * Yk + 0.116935020465145 * Y -- 0.000343531996510555 * kk + 0.24165260232407 * k;+ Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr ++ 0.000659397001245577 * Y + 0.000426105652938837 * k -+ 0.176491792462875) ++ Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y ++ 0.000770482631801132 * k - 0.151051492775562) ++ Y * (0.00126935368114843 * Y - 0.00265090189010898 * k ++ 0.25802910206845) ++ k * (-0.000318913117588328 * k - 0.213742400323665);++ var b = -20.810012546947 ++ Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr ++ 0.0020741088115012 * Y - 0.00288260236853442 * k ++ 0.814272968359295) ++ Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y ++ 0.000560833691242812 * k - 0.195152027534049) ++ Y * (0.00174418132927582 * Y - 0.00255243321439347 * k ++ 0.116935020465145) ++ k * (-0.000343531996510555 * k + 0.24165260232407);data[offset++] = clamp0to255(r);data[offset++] = clamp0to255(g);@@ -34647,18 +35423,52 @@ var JpxImage = (function JpxImageClosure() {var dataLength = lbox - headerSize;var jumpDataLength = true;switch (tbox) {- case 0x6A501A1A: // 'jP\032\032'- // TODO- break;case 0x6A703268: // 'jp2h'jumpDataLength = false; // parsing child boxesbreak;case 0x636F6C72: // 'colr'- // TODO+ // Colorspaces are not used, the CS from the PDF is used.+ var method = data[position];+ var precedence = data[position + 1];+ var approximation = data[position + 2];+ if (method === 1) {+ // enumerated colorspace+ var colorspace = readUint32(data, position + 3);+ switch (colorspace) {+ case 16: // this indicates a sRGB colorspace+ case 17: // this indicates a grayscale colorspace+ case 18: // this indicates a YUV colorspace+ break;+ default:+ warn('Unknown colorspace ' + colorspace);+ break;+ }+ } else if (method === 2) {+ info('ICC profile not supported');+ }break;case 0x6A703263: // 'jp2c'this.parseCodestream(data, position, position + dataLength);break;+ case 0x6A502020: // 'jP\024\024'+ if (0x0d0a870a !== readUint32(data, position)) {+ warn('Invalid JP2 signature');+ }+ break;+ // The following header types are valid but currently not used:+ case 0x6A501A1A: // 'jP\032\032'+ case 0x66747970: // 'ftyp'+ case 0x72726571: // 'rreq'+ case 0x72657320: // 'res '+ case 0x69686472: // 'ihdr'+ break;+ default:+ var headerType = String.fromCharCode((tbox >> 24) & 0xFF,+ (tbox >> 16) & 0xFF,+ (tbox >> 8) & 0xFF,+ tbox & 0xFF);+ warn('Unsupported header type ' + tbox + ' (' + headerType + ')');+ break;}if (jumpDataLength) {position += dataLength;@@ -34737,11 +35547,6 @@ var JpxImage = (function JpxImageClosure() {context.QCC = [];context.COC = [];break;- case 0xFF55: // Tile-part lengths, main header (TLM)- var Ltlm = readUint16(data, position); // Marker segment length- // Skip tile length markers- position += Ltlm;- break;case 0xFF5C: // Quantization default (QCD)length = readUint16(data, position);var qcd = {};@@ -34874,12 +35679,6 @@ var JpxImage = (function JpxImageClosure() {cod.precinctsSizes = precinctsSizes;}var unsupported = [];- if (cod.sopMarkerUsed) {- unsupported.push('sopMarkerUsed');- }- if (cod.ephMarkerUsed) {- unsupported.push('ephMarkerUsed');- }if (cod.selectiveArithmeticCodingBypass) {unsupported.push('selectiveArithmeticCodingBypass');}@@ -34937,6 +35736,9 @@ var JpxImage = (function JpxImageClosure() {length = tile.dataEnd - position;parseTilePackets(context, data, position, length);break;+ case 0xFF55: // Tile-part lengths, main header (TLM)+ case 0xFF57: // Packet length, main header (PLM)+ case 0xFF58: // Packet length, tile-part header (PLT)case 0xFF64: // Comment (COM)length = readUint16(data, position);// skipping content@@ -35030,6 +35832,23 @@ var JpxImage = (function JpxImageClosure() {// Section B.6 Division resolution to precinctsvar precinctWidth = 1 << dimensions.PPx;var precinctHeight = 1 << dimensions.PPy;+ // Jasper introduces codeblock groups for mapping each subband codeblocks+ // to precincts. Precinct partition divides a resolution according to width+ // and height parameters. The subband that belongs to the resolution level+ // has a different size than the level, unless it is the zero resolution.++ // From Jasper documentation: jpeg2000.pdf, section K: Tier-2 coding:+ // The precinct partitioning for a particular subband is derived from a+ // partitioning of its parent LL band (i.e., the LL band at the next higher+ // resolution level)... The LL band associated with each resolution level is+ // divided into precincts... Each of the resulting precinct regions is then+ // mapped into its child subbands (if any) at the next lower resolution+ // level. This is accomplished by using the coordinate transformation+ // (u, v) = (ceil(x/2), ceil(y/2)) where (x, y) and (u, v) are the+ // coordinates of a point in the LL band and child subband, respectively.+ var isZeroRes = resolution.resLevel === 0;+ var precinctWidthInSubband = 1 << (dimensions.PPx + (isZeroRes ? 0 : -1));+ var precinctHeightInSubband = 1 << (dimensions.PPy + (isZeroRes ? 0 : -1));var numprecinctswide = (resolution.trx1 > resolution.trx0 ?Math.ceil(resolution.trx1 / precinctWidth) -Math.floor(resolution.trx0 / precinctWidth) : 0);@@ -35037,18 +35856,15 @@ var JpxImage = (function JpxImageClosure() {Math.ceil(resolution.try1 / precinctHeight) -Math.floor(resolution.try0 / precinctHeight) : 0);var numprecincts = numprecinctswide * numprecinctshigh;- var precinctXOffset = Math.floor(resolution.trx0 / precinctWidth) *- precinctWidth;- var precinctYOffset = Math.floor(resolution.try0 / precinctHeight) *- precinctHeight;+resolution.precinctParameters = {- precinctXOffset: precinctXOffset,- precinctYOffset: precinctYOffset,precinctWidth: precinctWidth,precinctHeight: precinctHeight,numprecinctswide: numprecinctswide,numprecinctshigh: numprecinctshigh,- numprecincts: numprecincts+ numprecincts: numprecincts,+ precinctWidthInSubband: precinctWidthInSubband,+ precinctHeightInSubband: precinctHeightInSubband};}function buildCodeblocks(context, subband, dimensions) {@@ -35075,21 +35891,29 @@ var JpxImage = (function JpxImageClosure() {tbx1: codeblockWidth * (i + 1),tby1: codeblockHeight * (j + 1)};- // calculate precinct number- var pi = Math.floor((codeblock.tbx0 -- precinctParameters.precinctXOffset) /- precinctParameters.precinctWidth);- var pj = Math.floor((codeblock.tby0 -- precinctParameters.precinctYOffset) /- precinctParameters.precinctHeight);- precinctNumber = pj + pi * precinctParameters.numprecinctswide;+codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);++ // Calculate precinct number for this codeblock, codeblock position+ // should be relative to its subband, use actual dimension and position+ // See comment about codeblock group width and height+ var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) /+ precinctParameters.precinctWidthInSubband);+ var pj = Math.floor((codeblock.tby0_ - subband.tby0) /+ precinctParameters.precinctHeightInSubband);+ precinctNumber = pi + (pj * precinctParameters.numprecinctswide);+codeblock.precinctNumber = precinctNumber;codeblock.subbandType = subband.type;codeblock.Lblock = 3;++ if (codeblock.tbx1_ <= codeblock.tbx0_ ||+ codeblock.tby1_ <= codeblock.tby0_) {+ continue;+ }codeblocks.push(codeblock);// building precinct for the sub-bandvar precinct = precincts[precinctNumber];@@ -35119,7 +35943,7 @@ var JpxImage = (function JpxImageClosure() {codeblockWidth: xcb_,codeblockHeight: ycb_,numcodeblockwide: cbx1 - cbx0 + 1,- numcodeblockhigh: cby1 - cby1 + 1+ numcodeblockhigh: cby1 - cby0 + 1};subband.codeblocks = codeblocks;subband.precincts = precincts;@@ -35225,6 +36049,230 @@ var JpxImage = (function JpxImageClosure() {throw new Error('JPX Error: Out of packets');};}+ function ResolutionPositionComponentLayerIterator(context) {+ var siz = context.SIZ;+ var tileIndex = context.currentTile.index;+ var tile = context.tiles[tileIndex];+ var layersCount = tile.codingStyleDefaultParameters.layersCount;+ var componentsCount = siz.Csiz;+ var l, r, c, p;+ var maxDecompositionLevelsCount = 0;+ for (c = 0; c < componentsCount; c++) {+ var component = tile.components[c];+ maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount,+ component.codingStyleParameters.decompositionLevelsCount);+ }+ var maxNumPrecinctsInLevel = new Int32Array(+ maxDecompositionLevelsCount + 1);+ for (r = 0; r <= maxDecompositionLevelsCount; ++r) {+ var maxNumPrecincts = 0;+ for (c = 0; c < componentsCount; ++c) {+ var resolutions = tile.components[c].resolutions;+ if (r < resolutions.length) {+ maxNumPrecincts = Math.max(maxNumPrecincts,+ resolutions[r].precinctParameters.numprecincts);+ }+ }+ maxNumPrecinctsInLevel[r] = maxNumPrecincts;+ }+ l = 0;+ r = 0;+ c = 0;+ p = 0;++ this.nextPacket = function JpxImage_nextPacket() {+ // Section B.12.1.3 Resolution-position-component-layer+ for (; r <= maxDecompositionLevelsCount; r++) {+ for (; p < maxNumPrecinctsInLevel[r]; p++) {+ for (; c < componentsCount; c++) {+ var component = tile.components[c];+ if (r > component.codingStyleParameters.decompositionLevelsCount) {+ continue;+ }+ var resolution = component.resolutions[r];+ var numprecincts = resolution.precinctParameters.numprecincts;+ if (p >= numprecincts) {+ continue;+ }+ for (; l < layersCount;) {+ var packet = createPacket(resolution, p, l);+ l++;+ return packet;+ }+ l = 0;+ }+ c = 0;+ }+ p = 0;+ }+ throw new Error('JPX Error: Out of packets');+ };+ }+ function PositionComponentResolutionLayerIterator(context) {+ var siz = context.SIZ;+ var tileIndex = context.currentTile.index;+ var tile = context.tiles[tileIndex];+ var layersCount = tile.codingStyleDefaultParameters.layersCount;+ var componentsCount = siz.Csiz;+ var precinctsSizes = getPrecinctSizesInImageScale(tile);+ var precinctsIterationSizes = precinctsSizes;+ var l = 0, r = 0, c = 0, px = 0, py = 0;++ this.nextPacket = function JpxImage_nextPacket() {+ // Section B.12.1.4 Position-component-resolution-layer+ for (; py < precinctsIterationSizes.maxNumHigh; py++) {+ for (; px < precinctsIterationSizes.maxNumWide; px++) {+ for (; c < componentsCount; c++) {+ var component = tile.components[c];+ var decompositionLevelsCount =+ component.codingStyleParameters.decompositionLevelsCount;+ for (; r <= decompositionLevelsCount; r++) {+ var resolution = component.resolutions[r];+ var sizeInImageScale =+ precinctsSizes.components[c].resolutions[r];+ var k = getPrecinctIndexIfExist(+ px,+ py,+ sizeInImageScale,+ precinctsIterationSizes,+ resolution);+ if (k === null) {+ continue;+ }+ for (; l < layersCount;) {+ var packet = createPacket(resolution, k, l);+ l++;+ return packet;+ }+ l = 0;+ }+ r = 0;+ }+ c = 0;+ }+ px = 0;+ }+ throw new Error('JPX Error: Out of packets');+ };+ }+ function ComponentPositionResolutionLayerIterator(context) {+ var siz = context.SIZ;+ var tileIndex = context.currentTile.index;+ var tile = context.tiles[tileIndex];+ var layersCount = tile.codingStyleDefaultParameters.layersCount;+ var componentsCount = siz.Csiz;+ var precinctsSizes = getPrecinctSizesInImageScale(tile);+ var l = 0, r = 0, c = 0, px = 0, py = 0;++ this.nextPacket = function JpxImage_nextPacket() {+ // Section B.12.1.5 Component-position-resolution-layer+ for (; c < componentsCount; ++c) {+ var component = tile.components[c];+ var precinctsIterationSizes = precinctsSizes.components[c];+ var decompositionLevelsCount =+ component.codingStyleParameters.decompositionLevelsCount;+ for (; py < precinctsIterationSizes.maxNumHigh; py++) {+ for (; px < precinctsIterationSizes.maxNumWide; px++) {+ for (; r <= decompositionLevelsCount; r++) {+ var resolution = component.resolutions[r];+ var sizeInImageScale = precinctsIterationSizes.resolutions[r];+ var k = getPrecinctIndexIfExist(+ px,+ py,+ sizeInImageScale,+ precinctsIterationSizes,+ resolution);+ if (k === null) {+ continue;+ }+ for (; l < layersCount;) {+ var packet = createPacket(resolution, k, l);+ l++;+ return packet;+ }+ l = 0;+ }+ r = 0;+ }+ px = 0;+ }+ py = 0;+ }+ throw new Error('JPX Error: Out of packets');+ };+ }+ function getPrecinctIndexIfExist(+ pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {+ var posX = pxIndex * precinctIterationSizes.minWidth;+ var posY = pyIndex * precinctIterationSizes.minHeight;+ if (posX % sizeInImageScale.width !== 0 ||+ posY % sizeInImageScale.height !== 0) {+ return null;+ }+ var startPrecinctRowIndex =+ (posY / sizeInImageScale.width) *+ resolution.precinctParameters.numprecinctswide;+ return (posX / sizeInImageScale.height) + startPrecinctRowIndex;+ }+ function getPrecinctSizesInImageScale(tile) {+ var componentsCount = tile.components.length;+ var minWidth = Number.MAX_VALUE;+ var minHeight = Number.MAX_VALUE;+ var maxNumWide = 0;+ var maxNumHigh = 0;+ var sizePerComponent = new Array(componentsCount);+ for (var c = 0; c < componentsCount; c++) {+ var component = tile.components[c];+ var decompositionLevelsCount =+ component.codingStyleParameters.decompositionLevelsCount;+ var sizePerResolution = new Array(decompositionLevelsCount + 1);+ var minWidthCurrentComponent = Number.MAX_VALUE;+ var minHeightCurrentComponent = Number.MAX_VALUE;+ var maxNumWideCurrentComponent = 0;+ var maxNumHighCurrentComponent = 0;+ var scale = 1;+ for (var r = decompositionLevelsCount; r >= 0; --r) {+ var resolution = component.resolutions[r];+ var widthCurrentResolution =+ scale * resolution.precinctParameters.precinctWidth;+ var heightCurrentResolution =+ scale * resolution.precinctParameters.precinctHeight;+ minWidthCurrentComponent = Math.min(+ minWidthCurrentComponent,+ widthCurrentResolution);+ minHeightCurrentComponent = Math.min(+ minHeightCurrentComponent,+ heightCurrentResolution);+ maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent,+ resolution.precinctParameters.numprecinctswide);+ maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent,+ resolution.precinctParameters.numprecinctshigh);+ sizePerResolution[r] = {+ width: widthCurrentResolution,+ height: heightCurrentResolution+ };+ scale <<= 1;+ }+ minWidth = Math.min(minWidth, minWidthCurrentComponent);+ minHeight = Math.min(minHeight, minHeightCurrentComponent);+ maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);+ maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);+ sizePerComponent[c] = {+ resolutions: sizePerResolution,+ minWidth: minWidthCurrentComponent,+ minHeight: minHeightCurrentComponent,+ maxNumWide: maxNumWideCurrentComponent,+ maxNumHigh: maxNumHighCurrentComponent+ };+ }+ return {+ components: sizePerComponent,+ minWidth: minWidth,+ minHeight: minHeight,+ maxNumWide: maxNumWide,+ maxNumHigh: maxNumHigh+ };+ }function buildPackets(context) {var siz = context.SIZ;var tileIndex = context.currentTile.index;@@ -35246,6 +36294,7 @@ var JpxImage = (function JpxImageClosure() {resolution.try0 = Math.ceil(component.tcy0 / scale);resolution.trx1 = Math.ceil(component.tcx1 / scale);resolution.try1 = Math.ceil(component.tcy1 / scale);+ resolution.resLevel = r;buildPrecincts(context, resolution, blocksDimensions);resolutions.push(resolution);@@ -35316,6 +36365,18 @@ var JpxImage = (function JpxImageClosure() {tile.packetsIterator =new ResolutionLayerComponentPositionIterator(context);break;+ case 2:+ tile.packetsIterator =+ new ResolutionPositionComponentLayerIterator(context);+ break;+ case 3:+ tile.packetsIterator =+ new PositionComponentResolutionLayerIterator(context);+ break;+ case 4:+ tile.packetsIterator =+ new ComponentPositionResolutionLayerIterator(context);+ break;default:throw new Error('JPX Error: Unsupported progression order ' +progressionOrder);@@ -35343,6 +36404,21 @@ var JpxImage = (function JpxImageClosure() {bufferSize -= count;return (buffer >>> bufferSize) & ((1 << count) - 1);}+ function skipMarkerIfEqual(value) {+ if (data[offset + position - 1] === 0xFF &&+ data[offset + position] === value) {+ skipBytes(1);+ return true;+ } else if (data[offset + position] === 0xFF &&+ data[offset + position + 1] === value) {+ skipBytes(2);+ return true;+ }+ return false;+ }+ function skipBytes(count) {+ position += count;+ }function alignToByte() {bufferSize = 0;if (skipNextBit) {@@ -35370,11 +36446,17 @@ var JpxImage = (function JpxImageClosure() {}var tileIndex = context.currentTile.index;var tile = context.tiles[tileIndex];+ var sopMarkerUsed = context.COD.sopMarkerUsed;+ var ephMarkerUsed = context.COD.ephMarkerUsed;var packetsIterator = tile.packetsIterator;while (position < dataLength) {+ alignToByte();+ if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {+ // Skip also marker segment length and packet sequence ID+ skipBytes(4);+ }var packet = packetsIterator.nextPacket();if (!readBits(1)) {- alignToByte();continue;}var layerNumber = packet.layerNumber;@@ -35387,13 +36469,13 @@ var JpxImage = (function JpxImageClosure() {var codeblockIncluded = false;var firstTimeInclusion = false;var valueReady;- if ('included' in codeblock) {+ if (codeblock['included'] !== undefined) {codeblockIncluded = !!readBits(1);} else {// reading inclusion treeprecinct = codeblock.precinct;var inclusionTree, zeroBitPlanesTree;- if ('inclusionTree' in precinct) {+ if (precinct['inclusionTree'] !== undefined) {inclusionTree = precinct.inclusionTree;} else {// building inclusion and zero bit-planes trees@@ -35455,10 +36537,13 @@ var JpxImage = (function JpxImageClosure() {});}alignToByte();+ if (ephMarkerUsed) {+ skipMarkerIfEqual(0x92);+ }while (queue.length > 0) {var packetItem = queue.shift();codeblock = packetItem.codeblock;- if (!('data' in codeblock)) {+ if (codeblock['data'] === undefined) {codeblock.data = [];}codeblock.data.push({@@ -35488,7 +36573,7 @@ var JpxImage = (function JpxImageClosure() {if (blockWidth === 0 || blockHeight === 0) {continue;}- if (!('data' in codeblock)) {+ if (codeblock['data'] === undefined) {continue;}@@ -35743,10 +36828,10 @@ var JpxImage = (function JpxImageClosure() {var tile = context.tiles[tileIndex];for (var c = 0; c < componentsCount; c++) {var component = tile.components[c];- var qcdOrQcc = (c in context.currentTile.QCC ?+ var qcdOrQcc = (context.currentTile.QCC[c] !== undefined ?context.currentTile.QCC[c] : context.currentTile.QCD);component.quantizationParameters = qcdOrQcc;- var codOrCoc = (c in context.currentTile.COC ?+ var codOrCoc = (context.currentTile.COC[c] !== undefined ?context.currentTile.COC[c] : context.currentTile.COD);component.codingStyleParameters = codOrCoc;}@@ -35775,7 +36860,7 @@ var JpxImage = (function JpxImageClosure() {while (currentLevel < this.levels.length) {level = this.levels[currentLevel];var index = i + j * level.width;- if (index in level.items) {+ if (level.items[index] !== undefined) {value = level.items[index];break;}@@ -36490,7 +37575,6 @@ var JpxImage = (function JpxImageClosure() {})();-var Jbig2Image = (function Jbig2ImageClosure() {// Utility data structuresfunction ContextCache() {}@@ -36651,10 +37735,9 @@ var Jbig2Image = (function Jbig2ImageClosure() {// At each pixel: Clear contextLabel pixels that are shifted// out of the context, then add new ones.- // If j + n is out of range at the right image border, then- // the undefined value of bitmap[i - 2][j + n] is shifted to 0contextLabel = ((contextLabel & OLD_PIXEL_MASK) << 1) |- (row2[j + 3] << 11) | (row1[j + 4] << 4) | pixel;+ (j + 3 < width ? row2[j + 3] << 11 : 0) |+ (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;}}@@ -37968,7 +39051,6 @@ var bidi = PDFJS.bidi = (function bidiClosure() {return bidi;})();-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- *//* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */diff --git a/data/ext/viewerPDF/web/compatibility.js b/data/ext/viewerPDF/web/compatibility.jsindex 2c7776610..00429dded 100644--- a/data/ext/viewerPDF/web/compatibility.js+++ b/data/ext/viewerPDF/web/compatibility.js@@ -167,6 +167,21 @@ if (typeof PDFJS === 'undefined') {// The worker will be using XHR, so we can save time and disable worker.PDFJS.disableWorker = true;+ Object.defineProperty(xhrPrototype, 'responseType', {+ get: function xmlHttpRequestGetResponseType() {+ return this._responseType || 'text';+ },+ set: function xmlHttpRequestSetResponseType(value) {+ if (value === 'text' || value === 'arraybuffer') {+ this._responseType = value;+ if (value === 'arraybuffer' &&+ typeof this.overrideMimeType === 'function') {+ this.overrideMimeType('text/plain; charset=x-user-defined');+ }+ }+ }+ });+// Support: IE9if (typeof VBArray !== 'undefined') {Object.defineProperty(xhrPrototype, 'response', {@@ -181,25 +196,20 @@ if (typeof PDFJS === 'undefined') {return;}- // other browsers- function responseTypeSetter() {- // will be only called to set "arraybuffer"- this.overrideMimeType('text/plain; charset=x-user-defined');- }- if (typeof xhr.overrideMimeType === 'function') {- Object.defineProperty(xhrPrototype, 'responseType',- { set: responseTypeSetter });- }- function responseGetter() {- var text = this.responseText;- var i, n = text.length;- var result = new Uint8Array(n);- for (i = 0; i < n; ++i) {- result[i] = text.charCodeAt(i) & 0xFF;+ Object.defineProperty(xhrPrototype, 'response', {+ get: function xmlHttpRequestResponseGet() {+ if (this.responseType !== 'arraybuffer') {+ return this.responseText;+ }+ var text = this.responseText;+ var i, n = text.length;+ var result = new Uint8Array(n);+ for (i = 0; i < n; ++i) {+ result[i] = text.charCodeAt(i) & 0xFF;+ }+ return result.buffer;}- return result.buffer;- }- Object.defineProperty(xhrPrototype, 'response', { get: responseGetter });+ });})();// window.btoa (base64 encode function) ?@@ -437,20 +447,10 @@ if (typeof PDFJS === 'undefined') {// Checks if navigator.language is supported(function checkNavigatorLanguage() {- if ('language' in navigator &&- /^[a-z]+(-[A-Z]+)?$/.test(navigator.language)) {+ if ('language' in navigator) {return;}- function formatLocale(locale) {- var split = locale.split(/[-_]/);- split[0] = split[0].toLowerCase();- if (split.length > 1) {- split[1] = split[1].toUpperCase();- }- return split.join('-');- }- var language = navigator.language || navigator.userLanguage || 'en-US';- PDFJS.locale = formatLocale(language);+ PDFJS.locale = navigator.userLanguage || 'en-US';})();(function checkRangeRequests() {@@ -471,6 +471,7 @@ if (typeof PDFJS === 'undefined') {if (isSafari || isOldAndroid) {PDFJS.disableRange = true;+ PDFJS.disableStream = true;}})();@@ -561,3 +562,13 @@ if (typeof PDFJS === 'undefined') {PDFJS.maxCanvasPixels = 5242880;}})();++// Disable fullscreen support for certain problematic configurations.+// Support: IE11+ (when embedded).+(function checkFullscreenSupport() {+ var isEmbeddedIE = (navigator.userAgent.indexOf('Trident') >= 0 &&+ window.parent !== window);+ if (isEmbeddedIE) {+ PDFJS.disableFullscreen = true;+ }+})();diff --git a/data/ext/viewerPDF/web/debugger.js b/data/ext/viewerPDF/web/debugger.jsindex 2251682d8..046fd34ad 100644--- a/data/ext/viewerPDF/web/debugger.js+++ b/data/ext/viewerPDF/web/debugger.js@@ -112,13 +112,20 @@ var FontInspector = (function FontInspectorClosure() {return moreInfo;}var moreInfo = properties(fontObj, ['name', 'type']);- var m = /url\(['"]?([^\)"']+)/.exec(url);var fontName = fontObj.loadedName;var font = document.createElement('div');var name = document.createElement('span');name.textContent = fontName;var download = document.createElement('a');- download.href = m[1];+ if (url) {+ url = /url\(['"]?([^\)"']+)/.exec(url);+ download.href = url[1];+ } else if (fontObj.data) {+ url = URL.createObjectURL(new Blob([fontObj.data], {+ type: fontObj.mimeType+ }));+ download.href = url;+ }download.textContent = 'Download';var logIt = document.createElement('a');logIt.href = '';@@ -211,6 +218,7 @@ var StepperManager = (function StepperManagerClosure() {},selectStepper: function selectStepper(pageIndex, selectPanel) {var i;+ pageIndex = pageIndex | 0;if (selectPanel) {this.manager.selectPanel(this);}@@ -419,7 +427,7 @@ var Stepper = (function StepperClosure() {var allRows = this.panel.getElementsByClassName('line');for (var x = 0, xx = allRows.length; x < xx; ++x) {var row = allRows[x];- if (parseInt(row.dataset.idx, 10) === idx) {+ if ((row.dataset.idx | 0) === idx) {row.style.backgroundColor = 'rgb(251,250,207)';row.scrollIntoView();} else {diff --git a/data/ext/viewerPDF/web/images/loading-small.png b/data/ext/viewerPDF/web/images/loading-small.pngindex 51848a70f..8831a8058 100644Binary files a/data/ext/viewerPDF/web/images/loading-small.png and b/data/ext/viewerPDF/web/images/loading-small.png differdiff --git a/data/ext/viewerPDF/web/l10n.js b/data/ext/viewerPDF/web/l10n.jsindex 37f3950c5..3d5ecffaf 100644--- a/data/ext/viewerPDF/web/l10n.js+++ b/data/ext/viewerPDF/web/l10n.js@@ -24,9 +24,10 @@- Disables language initialization on page loading;- Removes consoleWarn and consoleLog and use console.log/warn directly.- Removes window._ assignment.+ - Remove compatibility code for OldIE.*/-/*jshint browser: true, devel: true, globalstrict: true */+/*jshint browser: true, devel: true, es5: true, globalstrict: true */'use strict';document.webL10n = (function(window, document, undefined) {@@ -98,14 +99,14 @@ document.webL10n = (function(window, document, undefined) {document.dispatchEvent(evtObject);}- function xhrLoadText(url, onSuccess, onFailure, asynchronous) {+ function xhrLoadText(url, onSuccess, onFailure) {onSuccess = onSuccess || function _onSuccess(data) {};onFailure = onFailure || function _onFailure() {console.warn(url + ' not found.');};var xhr = new XMLHttpRequest();- xhr.open('GET', url, asynchronous);+ xhr.open('GET', url, gAsyncResourceLoading);if (xhr.overrideMimeType) {xhr.overrideMimeType('text/plain; charset=utf-8');}@@ -142,7 +143,7 @@ document.webL10n = (function(window, document, undefined) {* URL of the l10n resource to parse.** @param {string} lang- * locale (language) to parse.+ * locale (language) to parse. Must be a lowercase string.** @param {Function} successCallback* triggered when the l10n resource has been successully parsed.@@ -174,8 +175,10 @@ document.webL10n = (function(window, document, undefined) {}// parse *.properties text data into an l10n dictionary- function parseProperties(text) {- var dictionary = [];+ // If gAsyncResourceLoading is false, then the callback will be called+ // synchronously. Otherwise it is called asynchronously.+ function parseProperties(text, parsedPropertiesCallback) {+ var dictionary = {};// token expressionsvar reBlank = /^\s*|\s*$/;@@ -185,55 +188,69 @@ document.webL10n = (function(window, document, undefined) {var reSplit = /^([^=\s]*)\s*=\s*(.+)$/; // TODO: escape EOLs with '\'// parse the *.properties file into an associative array- function parseRawLines(rawText, extendedSyntax) {+ function parseRawLines(rawText, extendedSyntax, parsedRawLinesCallback) {var entries = rawText.replace(reBlank, '').split(/[\r\n]+/);var currentLang = '*';- var genericLang = lang.replace(/-[a-z]+$/i, '');+ var genericLang = lang.split('-', 1)[0];var skipLang = false;var match = '';- for (var i = 0; i < entries.length; i++) {- var line = entries[i];+ function nextEntry() {+ // Use infinite loop instead of recursion to avoid reaching the+ // maximum recursion limit for content with many lines.+ while (true) {+ if (!entries.length) {+ parsedRawLinesCallback();+ return;+ }+ var line = entries.shift();- // comment or blank line?- if (reComment.test(line))- continue;+ // comment or blank line?+ if (reComment.test(line))+ continue;- // the extended syntax supports [lang] sections and @import rules- if (extendedSyntax) {- if (reSection.test(line)) { // section start?+ // the extended syntax supports [lang] sections and @import rules+ if (extendedSyntax) {match = reSection.exec(line);- currentLang = match[1];- skipLang = (currentLang !== '*') &&- (currentLang !== lang) && (currentLang !== genericLang);- continue;- } else if (skipLang) {- continue;- }- if (reImport.test(line)) { // @import rule?+ if (match) { // section start?+ // RFC 4646, section 4.4, "All comparisons MUST be performed+ // in a case-insensitive manner."++ currentLang = match[1].toLowerCase();+ skipLang = (currentLang !== '*') &&+ (currentLang !== lang) && (currentLang !== genericLang);+ continue;+ } else if (skipLang) {+ continue;+ }match = reImport.exec(line);- loadImport(baseURL + match[1]); // load the resource synchronously+ if (match) { // @import rule?+ loadImport(baseURL + match[1], nextEntry);+ return;+ }}- }- // key-value pair- var tmp = line.match(reSplit);- if (tmp && tmp.length == 3) {- dictionary[tmp[1]] = evalString(tmp[2]);+ // key-value pair+ var tmp = line.match(reSplit);+ if (tmp && tmp.length == 3) {+ dictionary[tmp[1]] = evalString(tmp[2]);+ }}}+ nextEntry();}// import another *.properties file- function loadImport(url) {+ function loadImport(url, callback) {xhrLoadText(url, function(content) {- parseRawLines(content, false); // don't allow recursive imports- }, null, false); // load synchronously+ parseRawLines(content, false, callback); // don't allow recursive imports+ }, null);}// fill the dictionary- parseRawLines(text, true);- return dictionary;+ parseRawLines(text, true, function() {+ parsedPropertiesCallback(dictionary);+ });}// load and parse l10n data (warning: global variables are used here)@@ -241,33 +258,40 @@ document.webL10n = (function(window, document, undefined) {gTextData += response; // mostly for debug// parse *.properties text data into an l10n dictionary- var data = parseProperties(response);-- // find attribute descriptions, if any- for (var key in data) {- var id, prop, index = key.lastIndexOf('.');- if (index > 0) { // an attribute has been specified- id = key.substring(0, index);- prop = key.substr(index + 1);- } else { // no attribute: assuming text content by default- id = key;- prop = gTextProp;- }- if (!gL10nData[id]) {- gL10nData[id] = {};+ parseProperties(response, function(data) {++ // find attribute descriptions, if any+ for (var key in data) {+ var id, prop, index = key.lastIndexOf('.');+ if (index > 0) { // an attribute has been specified+ id = key.substring(0, index);+ prop = key.substr(index + 1);+ } else { // no attribute: assuming text content by default+ id = key;+ prop = gTextProp;+ }+ if (!gL10nData[id]) {+ gL10nData[id] = {};+ }+ gL10nData[id][prop] = data[key];}- gL10nData[id][prop] = data[key];- }- // trigger callback- if (successCallback) {- successCallback();- }- }, failureCallback, gAsyncResourceLoading);+ // trigger callback+ if (successCallback) {+ successCallback();+ }+ });+ }, failureCallback);}// load and parse all resources for the specified localefunction loadLocale(lang, callback) {+ // RFC 4646, section 2.1 states that language tags have to be treated as+ // case-insensitive. Convert to lowercase for case-insensitive comparisons.+ if (lang) {+ lang = lang.toLowerCase();+ }+callback = callback || function _callback() {};clear();@@ -282,7 +306,19 @@ document.webL10n = (function(window, document, undefined) {var dict = getL10nDictionary();if (dict && dict.locales && dict.default_locale) {console.log('using the embedded JSON directory, early way out');- gL10nData = dict.locales[lang] || dict.locales[dict.default_locale];+ gL10nData = dict.locales[lang];+ if (!gL10nData) {+ var defaultLocale = dict.default_locale.toLowerCase();+ for (var anyCaseLang in dict.locales) {+ anyCaseLang = anyCaseLang.toLowerCase();+ if (anyCaseLang === lang) {+ gL10nData = dict.locales[lang];+ break;+ } else if (anyCaseLang === defaultLocale) {+ gL10nData = dict.locales[defaultLocale];+ }+ }+ }callback();} else {console.log('no resource to load, early way out');@@ -308,24 +344,23 @@ document.webL10n = (function(window, document, undefined) {// load all resource filesfunction L10nResourceLink(link) {var href = link.href;- var type = link.type;+ // Note: If |gAsyncResourceLoading| is false, then the following callbacks+ // are synchronously called.this.load = function(lang, callback) {- var applied = lang;parseResource(href, lang, callback, function() {console.warn(href + ' not found.');- applied = '';+ // lang not found, used default resource instead+ console.warn('"' + lang + '" resource not found');+ gLanguage = '';+ // Resource not loaded, but we still need to call the callback.+ callback();});- return applied; // return lang if found, an empty string if not found};}for (var i = 0; i < langCount; i++) {var resource = new L10nResourceLink(langLinks[i]);- var rv = resource.load(lang, onResourceLoaded);- if (rv != lang) { // lang not found, used default resource instead- console.warn('"' + lang + '" resource not found');- gLanguage = '';- }+ resource.load(lang, onResourceLoaded);}}@@ -841,28 +876,17 @@ document.webL10n = (function(window, document, undefined) {// replace {{arguments}} with their valuesfunction substArguments(str, args, key) {- var reArgs = /\{\{\s*(.+?)\s*\}\}/;- var match = reArgs.exec(str);- while (match) {- if (!match || match.length < 2)- return str; // argument key not found-- var arg = match[1];- var sub = '';+ var reArgs = /\{\{\s*(.+?)\s*\}\}/g;+ return str.replace(reArgs, function(matched_text, arg) {if (args && arg in args) {- sub = args[arg];- } else if (arg in gL10nData) {- sub = gL10nData[arg][gTextProp];- } else {- console.log('argument {{' + arg + '}} for #' + key + ' is undefined.');- return str;+ return args[arg];}-- str = str.substring(0, match.index) + sub +- str.substr(match.index + match[0].length);- match = reArgs.exec(str);- }- return str;+ if (arg in gL10nData) {+ return gL10nData[arg];+ }+ console.log('argument {{' + arg + '}} for #' + key + ' is undefined.');+ return matched_text;+ });}// translate an HTML element@@ -942,7 +966,6 @@ document.webL10n = (function(window, document, undefined) {translateElement(element);}- // cross-browser API (sorry, oldIE doesn't support getters & setters)return {// get a localized stringget: function(key, args, fallbackString) {@@ -970,14 +993,21 @@ document.webL10n = (function(window, document, undefined) {// get|set the document languagegetLanguage: function() { return gLanguage; },- setLanguage: function(lang) { loadLocale(lang, translateFragment); },+ setLanguage: function(lang, callback) {+ loadLocale(lang, function() {+ if (callback)+ callback();+ translateFragment();+ });+ },// get the direction (ltr|rtl) of the current languagegetDirection: function() {// http://www.w3.org/International/questions/qa-scripts// Arabic, Hebrew, Farsi, Pashto, Urduvar rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];- return (rtlList.indexOf(gLanguage) >= 0) ? 'rtl' : 'ltr';+ var shortCode = gLanguage.split('-', 1)[0];+ return (rtlList.indexOf(shortCode) >= 0) ? 'rtl' : 'ltr';},// translate an element or document fragment@@ -989,14 +1019,13 @@ document.webL10n = (function(window, document, undefined) {if (!callback) {return;} else if (gReadyState == 'complete' || gReadyState == 'interactive') {- window.setTimeout(callback);+ window.setTimeout(function() {+ callback();+ });} else if (document.addEventListener) {- document.addEventListener('localized', callback);- } else if (document.attachEvent) {- document.documentElement.attachEvent('onpropertychange', function(e) {- if (e.propertyName === 'localized') {- callback();- }+ document.addEventListener('localized', function once() {+ document.removeEventListener('localized', once);+ callback();});}}diff --git a/data/ext/viewerPDF/web/locale/ach/viewer.properties b/data/ext/viewerPDF/web/locale/ach/viewer.propertiesindex 829adbd15..04cb71ae8 100644--- a/data/ext/viewerPDF/web/locale/ach/viewer.properties+++ b/data/ext/viewerPDF/web/locale/ach/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Lac me iye pot bukpage_scale_fit=Porre me pot bukpage_scale_auto=Kwot pire kenepage_scale_actual=Dite kikome+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Balloading_error=Bal otime kun cano PDF.invalid_file_error=Pwail me PDF ma pe atir onyo obale woko.missing_file_error=Pwail me PDF tye ka rem.+unexpected_response_error=Lagam mape kigeno pa lapok tic# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/af/viewer.properties b/data/ext/viewerPDF/web/locale/af/viewer.propertiesindex 5bda09b75..d866b4d3f 100644--- a/data/ext/viewerPDF/web/locale/af/viewer.properties+++ b/data/ext/viewerPDF/web/locale/af/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Bladsywydtepage_scale_fit=Pas bladsypage_scale_auto=Outomatiese zoempage_scale_actual=Werklike grootte+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Foutloading_error='n Fout het voorgekom met die laai van die PDF.invalid_file_error=Ongeldige of korrupte PDF-lêer.missing_file_error=PDF-lêer is weg.+unexpected_response_error=Onverwagse antwoord van bediener.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/an/viewer.properties b/data/ext/viewerPDF/web/locale/an/viewer.propertiesindex dc6107719..d9b7f66ac 100644--- a/data/ext/viewerPDF/web/locale/an/viewer.properties+++ b/data/ext/viewerPDF/web/locale/an/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Amplaria d'a pachinapage_scale_fit=Achuste d'a pachinapage_scale_auto=Grandaria automaticapage_scale_actual=Grandaria actual+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Errorloading_error=S'ha produciu una error en cargar o PDF.invalid_file_error=O PDF no ye valido u ye estorbau.missing_file_error=No i ha fichero PDF.+unexpected_response_error=Respuesta a lo servicio inasperada.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/ar/viewer.properties b/data/ext/viewerPDF/web/locale/ar/viewer.propertiesindex 949b656df..d114bbb1a 100644--- a/data/ext/viewerPDF/web/locale/ar/viewer.properties+++ b/data/ext/viewerPDF/web/locale/ar/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=عرض الصفحةpage_scale_fit=ملائمة الصفحةpage_scale_auto=تقريب تلقائيpage_scale_actual=الحجم الحقيقي+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}٪# Loading indicator messagesloading_error_indicator=عطلloading_error=حدث عطل أثناء تحميل ملف PDF.-invalid_file_error=ملف PDF تالف أو غير صحيح-missing_file_error=ملف PDF غير موجود+invalid_file_error=ملف PDF تالف أو غير صحيح.+missing_file_error=ملف PDF غير موجود.+unexpected_response_error=استجابة خادوم غير متوقعة.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/as/viewer.properties b/data/ext/viewerPDF/web/locale/as/viewer.propertiesindex 852ad0308..a0d637f83 100644--- a/data/ext/viewerPDF/web/locale/as/viewer.properties+++ b/data/ext/viewerPDF/web/locale/as/viewer.properties@@ -146,6 +146,7 @@ loading_error_indicator=ত্ৰুটিloading_error=PDF ল'ড কৰোতে এটা ত্ৰুটি দেখা দিলে।invalid_file_error=অবৈধ অথবা ক্ষতিগ্ৰস্থ PDF file।missing_file_error=সন্ধানহিন PDF ফাইল।+unexpected_response_error=অপ্ৰত্যাশিত চাৰ্ভাৰ প্ৰতিক্ৰিয়া।# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/ast/viewer.properties b/data/ext/viewerPDF/web/locale/ast/viewer.propertiesindex fd5fb11db..daa5cbf0c 100644--- a/data/ext/viewerPDF/web/locale/ast/viewer.properties+++ b/data/ext/viewerPDF/web/locale/ast/viewer.properties@@ -105,3 +105,6 @@ document_properties_creation_date = Data de creación:document_properties_close = Zarrardocument_properties_author = Autor:document_properties.title = Propiedaes del documentu…+attachments_label = Axuntos+attachments.title = Amosar axuntos+unexpected_response_error = Rempuesta inesperada del sirvidor.diff --git a/data/ext/viewerPDF/web/locale/az/viewer.properties b/data/ext/viewerPDF/web/locale/az/viewer.propertiesindex c9bea3b43..ef77c6449 100644--- a/data/ext/viewerPDF/web/locale/az/viewer.properties+++ b/data/ext/viewerPDF/web/locale/az/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Səhifə genişliyipage_scale_fit=Səhifəni sığdırpage_scale_auto=Avtomatik yaxınlaşdırpage_scale_actual=Hazırki Həcm+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Səhvloading_error=PDF yüklenərkən bir səhv yarandı.invalid_file_error=Səhv və ya zədələnmiş olmuş PDF fayl.missing_file_error=PDF fayl yoxdur.+unexpected_response_error=Gözlənilməz server cavabı.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/bg/viewer.properties b/data/ext/viewerPDF/web/locale/bg/viewer.propertiesindex 8681774d3..7b3cd53b0 100644--- a/data/ext/viewerPDF/web/locale/bg/viewer.properties+++ b/data/ext/viewerPDF/web/locale/bg/viewer.properties@@ -140,6 +140,8 @@ page_scale_width=Ширина на страницатаpage_scale_fit=Вместване в страницатаpage_scale_auto=Автоматично мащабиранеpage_scale_actual=Действителен размер+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.# Loading indicator messagesloading_error_indicator=Грешкаdiff --git a/data/ext/viewerPDF/web/locale/bn-IN/viewer.properties b/data/ext/viewerPDF/web/locale/bn-IN/viewer.propertiesindex 8bf265d90..84391bf17 100644--- a/data/ext/viewerPDF/web/locale/bn-IN/viewer.properties+++ b/data/ext/viewerPDF/web/locale/bn-IN/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=পৃষ্ঠার প্রস্থ অনুযায়ীpage_scale_fit=পৃষ্ঠার মাপ অনুযায়ীpage_scale_auto=স্বয়ংক্রিয় মাপ নির্ধারণpage_scale_actual=প্রকৃত মাপ+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=ত্রুটিloading_error=PDF লোড করার সময় সমস্যা দেখা দিয়েছে।invalid_file_error=অবৈধ বা ক্ষতিগ্রস্ত পিডিএফ ফাইল।missing_file_error=অনুপস্থিত PDF ফাইল+unexpected_response_error=সার্ভার থেকে অপ্রত্যাশিত সাড়া পাওয়া গেছে।# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/br/viewer.properties b/data/ext/viewerPDF/web/locale/br/viewer.propertiesindex de8063955..7f7926c29 100644--- a/data/ext/viewerPDF/web/locale/br/viewer.properties+++ b/data/ext/viewerPDF/web/locale/br/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Led ar bajennpage_scale_fit=Pajenn a-bezhpage_scale_auto=Zoum emgefreekpage_scale_actual=Ment wir+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Faziloading_error=Degouezhet ez eus bet ur fazi e-pad kargañ ar PDF.invalid_file_error=Restr PDF didalvoudek pe kontronet.missing_file_error=Restr PDF o vankout.+unexpected_response_error=Respont dic'hortoz a-berzh an dafariad# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/ca/viewer.properties b/data/ext/viewerPDF/web/locale/ca/viewer.propertiesindex 3a872e9b7..94229be66 100644--- a/data/ext/viewerPDF/web/locale/ca/viewer.properties+++ b/data/ext/viewerPDF/web/locale/ca/viewer.properties@@ -80,7 +80,7 @@ document_properties_creator=Creador:document_properties_producer=Generador de PDF:document_properties_version=Versió de PDF:document_properties_page_count=Nombre de pàgines:-document_properties_close=Close+document_properties_close=Tanca# Tooltips and alt text for side panel toolbar buttons# (the _label strings are alt text for the buttons, the .title strings are@@ -140,12 +140,16 @@ page_scale_width=Amplària de la pàginapage_scale_fit=Ajusta la pàginapage_scale_auto=Zoom automàticpage_scale_actual=Mida real+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Errorloading_error=S'ha produït un error en carregar el PDF.invalid_file_error=El fitxer PDF no és vàlid o està malmès.missing_file_error=Falta el fitxer PDF.+unexpected_response_error=Resposta inesperada del servidor.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/cs/viewer.properties b/data/ext/viewerPDF/web/locale/cs/viewer.propertiesindex 7ff9ac9d4..2033c5a21 100644--- a/data/ext/viewerPDF/web/locale/cs/viewer.properties+++ b/data/ext/viewerPDF/web/locale/cs/viewer.properties@@ -67,8 +67,8 @@ document_properties.title=Vlastnosti dokumentu…document_properties_label=Vlastnosti dokumentu…document_properties_file_name=Název souboru:document_properties_file_size=Velikost souboru:-document_properties_kb={{size_kb}} kB ({{size_b}} bytes)-document_properties_mb={{size_mb}} MB ({{size_b}} bytes)+document_properties_kb={{size_kb}} kB ({{size_b}} bajtů)+document_properties_mb={{size_mb}} MB ({{size_b}} bajtů)document_properties_title=Nadpis:document_properties_author=Autor:document_properties_subject=Subjekt:@@ -140,12 +140,16 @@ page_scale_width=Podle šířkypage_scale_fit=Podle výškypage_scale_auto=Automatická velikostpage_scale_actual=Aktuální velikost+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Chybaloading_error=Při nahrávání PDF nastala chyba.invalid_file_error=Neplatný nebo chybný soubor PDF.missing_file_error=Chybí soubor PDF.+unexpected_response_error=Neočekávaná odpověď serveru.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -160,4 +164,4 @@ password_cancel=Zrušitprinting_not_supported=Upozornění: Tisk není v tomto prohlížeči plně podporován.printing_not_ready=Upozornění: Dokument PDF není kompletně načten.web_fonts_disabled=Webová písma jsou zakázána, proto není možné použít vložená písma PDF.-document_colors_disabled=PDF dokumenty nemají povoleny používání vlastních barev: volba \'Povolit stránkám používat vlastní barvy namísto výše zvolených\' je v prohlížeči deaktivována.+document_colors_disabled=PDF dokumenty nemají povoleny používání vlastních barev: volba "Povolit stránkám používat vlastní barvy namísto výše zvolených" je v prohlížeči deaktivována.diff --git a/data/ext/viewerPDF/web/locale/cy/viewer.properties b/data/ext/viewerPDF/web/locale/cy/viewer.propertiesindex 15d2656e0..3ba7ceffb 100644--- a/data/ext/viewerPDF/web/locale/cy/viewer.properties+++ b/data/ext/viewerPDF/web/locale/cy/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Lled Tudalenpage_scale_fit=Ffit Tudalenpage_scale_auto=Chwyddo Awtomatigpage_scale_actual=Maint Gwirioneddol+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Gwallloading_error=Digwyddodd gwall wrth lwytho'r PDF.invalid_file_error=Ffeil PDF annilys neu llwgr.missing_file_error=Ffeil PDF coll.+unexpected_response_error=Ymateb annisgwyl gan y gweinydd.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/da/viewer.properties b/data/ext/viewerPDF/web/locale/da/viewer.propertiesindex f72c94abc..ddd428bf6 100644--- a/data/ext/viewerPDF/web/locale/da/viewer.properties+++ b/data/ext/viewerPDF/web/locale/da/viewer.properties@@ -32,8 +32,8 @@ zoom_in_label=Zoom indzoom.title=Zoomprint.title=Udskrivprint_label=Udskriv-presentation_mode.title=Skift til præsentations-tilstand-presentation_mode_label=Præsentations-tilstand+presentation_mode.title=Skift til fuldskærmsvisning+presentation_mode_label=Fuldskærmsvisningopen_file.title=Åbn filopen_file_label=Åbndownload.title=Hent@@ -42,8 +42,8 @@ bookmark.title=Aktuel visning (kopier eller åbn i et nyt vindue)bookmark_label=Aktuel visning# Secondary toolbar and context menu-tools.title=Værktøj-tools_label=Værktøj+tools.title=Funktioner+tools_label=Funktionerfirst_page.title=Gå til første sidefirst_page.label=Gå til første sidefirst_page_label=Gå til første side@@ -140,12 +140,16 @@ page_scale_width=Sidebreddepage_scale_fit=Tilpas til sidepage_scale_auto=Automatisk zoompage_scale_actual=Faktisk størrelse+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Fejlloading_error=Der opstod en fejl ved indlæsning af PDF-filen.invalid_file_error=PDF-filen er ugyldig eller ødelagt.missing_file_error=Manglende PDF-fil.+unexpected_response_error=Uventet svar fra serveren.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -160,4 +164,4 @@ password_cancel=Fortrydprinting_not_supported=Advarsel: Udskrivning er ikke fuldt understøttet af browseren.printing_not_ready=Advarsel: PDF-filen er ikke fuldt indlæst til udskrivning.web_fonts_disabled=Webskrifttyper er deaktiverede. De indlejrede skrifttyper i PDF-filen kan ikke anvendes.-document_colors_disabled=PDF-dokumenter må ikke bruge deres egne farver: \'Tillad sider at vælge deres egne farver\' er deaktiveret i browseren.+document_colors_disabled=PDF-dokumenter må ikke bruge deres egne farver: \u0022'Tillad sider at vælge deres egne farver\u0022' er deaktiveret i browseren.diff --git a/data/ext/viewerPDF/web/locale/de/viewer.properties b/data/ext/viewerPDF/web/locale/de/viewer.propertiesindex b641e2bc1..685154c97 100644--- a/data/ext/viewerPDF/web/locale/de/viewer.properties+++ b/data/ext/viewerPDF/web/locale/de/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Seitenbreitepage_scale_fit=Seitengrößepage_scale_auto=Automatischer Zoompage_scale_actual=Originalgröße+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Fehlerloading_error=Beim Laden der PDF-Datei trat ein Fehler auf.invalid_file_error=Ungültige oder beschädigte PDF-Dateimissing_file_error=Fehlende PDF-Datei+unexpected_response_error=Unerwartete Antwort des Servers# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/en-GB/viewer.properties b/data/ext/viewerPDF/web/locale/en-GB/viewer.propertiesindex 64239d285..f9e1dfb63 100644--- a/data/ext/viewerPDF/web/locale/en-GB/viewer.properties+++ b/data/ext/viewerPDF/web/locale/en-GB/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Page Widthpage_scale_fit=Page Fitpage_scale_auto=Automatic Zoompage_scale_actual=Actual Size+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Errorloading_error=An error occurred while loading the PDF.invalid_file_error=Invalid or corrupted PDF file.missing_file_error=Missing PDF file.+unexpected_response_error=Unexpected server response.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -160,4 +164,4 @@ password_cancel=Cancelprinting_not_supported=Warning: Printing is not fully supported by this browser.printing_not_ready=Warning: The PDF is not fully loaded for printing.web_fonts_disabled=Web fonts are disabled: unable to use embedded PDF fonts.-document_colors_disabled=PDF documents are not allowed to use their own colours: \'Allow pages to choose their own colours\' is deactivated in the browser.+document_colors_disabled=PDF documents are not allowed to use their own colours: 'Allow pages to choose their own colours' is deactivated in the browser.diff --git a/data/ext/viewerPDF/web/locale/en-US/viewer.properties b/data/ext/viewerPDF/web/locale/en-US/viewer.propertiesindex dadfe4143..4a3a6aaa2 100644--- a/data/ext/viewerPDF/web/locale/en-US/viewer.properties+++ b/data/ext/viewerPDF/web/locale/en-US/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Page Widthpage_scale_fit=Page Fitpage_scale_auto=Automatic Zoompage_scale_actual=Actual Size+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Errorloading_error=An error occurred while loading the PDF.invalid_file_error=Invalid or corrupted PDF file.missing_file_error=Missing PDF file.+unexpected_response_error=Unexpected server response.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/en-ZA/viewer.properties b/data/ext/viewerPDF/web/locale/en-ZA/viewer.propertiesindex 5588ff195..6c063a424 100644--- a/data/ext/viewerPDF/web/locale/en-ZA/viewer.properties+++ b/data/ext/viewerPDF/web/locale/en-ZA/viewer.properties@@ -89,6 +89,8 @@ toggle_sidebar.title=Toggle Sidebartoggle_sidebar_label=Toggle Sidebaroutline.title=Show Document Outlineoutline_label=Document Outline+attachments.title=Show Attachments+attachments_label=Attachmentsthumbs.title=Show Thumbnailsthumbs_label=Thumbnailsfindbar.title=Find in Documentdiff --git a/data/ext/viewerPDF/web/locale/eo/viewer.properties b/data/ext/viewerPDF/web/locale/eo/viewer.propertiesindex 78b822943..65bb15f6f 100644--- a/data/ext/viewerPDF/web/locale/eo/viewer.properties+++ b/data/ext/viewerPDF/web/locale/eo/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Larĝo de paĝopage_scale_fit=Adapti paĝonpage_scale_auto=Aŭtomata skalopage_scale_actual=Reala gandeco+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Eraroloading_error=Okazis eraro dum la ŝargado de la PDF dosiero.invalid_file_error=Nevalida aŭ difektita PDF dosiero.missing_file_error=Mankas dosiero PDF.+unexpected_response_error=Neatendita respondo de servilo.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/es-AR/viewer.properties b/data/ext/viewerPDF/web/locale/es-AR/viewer.propertiesindex c931a101c..733be7ba1 100644--- a/data/ext/viewerPDF/web/locale/es-AR/viewer.properties+++ b/data/ext/viewerPDF/web/locale/es-AR/viewer.properties@@ -104,12 +104,6 @@ thumb_page_title=Página {{page}}# number.thumb_page_canvas=Miniatura de página {{page}}-# Context menu-first_page.label=Ir a la primera página-last_page.label=Ir a la última página-page_rotate_cw.label=Rotar en sentido horario-page_rotate_ccw.label=Rotar en sentido antihorario-# Find panel button title and messagesfind_label=Buscar:find_previous.title=Buscar la aparición anterior de la frase@@ -146,12 +140,16 @@ page_scale_width=Ancho de páginapage_scale_fit=Ajustar páginapage_scale_auto=Zoom automáticopage_scale_actual=Tamaño real+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Errorloading_error=Ocurrió un error al cargar el PDF.invalid_file_error=Archivo PDF no válido o cocrrupto.missing_file_error=Archivo PDF faltante.+unexpected_response_error=Respuesta del servidor inesperada.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/es-CL/viewer.properties b/data/ext/viewerPDF/web/locale/es-CL/viewer.propertiesindex a53d93c7d..f5660c358 100644--- a/data/ext/viewerPDF/web/locale/es-CL/viewer.properties+++ b/data/ext/viewerPDF/web/locale/es-CL/viewer.properties@@ -111,10 +111,12 @@ page_scale_width = Ancho de páginapage_scale_fit = Ajuste de páginapage_scale_auto = Aumento automáticopage_scale_actual = Tamaño actual+page_scale_percent={{scale}}%loading_error_indicator = Errorloading_error = Ha ocurrido un error al cargar el PDF.invalid_file_error = Archivo PDF inválido o corrupto.missing_file_error=Falta el archivo PDF.+unexpected_response_error=Respuesta del servidor inesperada.text_annotation_type.alt=[{{type}} Anotación]password_label=Ingrese la contraseña para abrir este archivo PDF.@@ -125,4 +127,4 @@ password_cancel=Cancelarprinting_not_supported = Advertencia: Imprimir no está soportado completamente por este navegador.printing_not_ready=Advertencia: El PDF no está completamente cargado para ser impreso.web_fonts_disabled=Las fuentes web están desactivadas: imposible usar las fuentes PDF embebidas.-document_colors_disabled=Los documentos PDF no tienen permitido usar sus propios colores: \'Permitir a las páginas elegir sus propios colores\' está desactivado en el navegador.+document_colors_disabled=Los documentos PDF no tienen permitido usar sus propios colores: 'Permitir a las páginas elegir sus propios colores' está desactivado en el navegador.diff --git a/data/ext/viewerPDF/web/locale/es-ES/viewer.properties b/data/ext/viewerPDF/web/locale/es-ES/viewer.propertiesindex e0db6b00d..ee53ab177 100644--- a/data/ext/viewerPDF/web/locale/es-ES/viewer.properties+++ b/data/ext/viewerPDF/web/locale/es-ES/viewer.properties@@ -94,10 +94,12 @@ page_scale_width = Anchura de la páginapage_scale_fit = Ajuste de la páginapage_scale_auto = Tamaño automáticopage_scale_actual = Tamaño actual+page_scale_percent = {{scale}}%loading_error_indicator = Errorloading_error = Ocurrió un error al cargar el PDF.invalid_file_error = Fichero PDF no válido o corrupto.missing_file_error = No hay fichero PDF.+unexpected_response_error = Respuesta inesperada del servidor.text_annotation_type.alt = [Anotación {{type}}]password_label = Introduzca la contraseña para abrir este archivo PDF.password_invalid = Contraseña no válida. Vuelva a intentarlo.diff --git a/data/ext/viewerPDF/web/locale/es-MX/viewer.properties b/data/ext/viewerPDF/web/locale/es-MX/viewer.propertiesindex 962d22dba..1372a7616 100644--- a/data/ext/viewerPDF/web/locale/es-MX/viewer.properties+++ b/data/ext/viewerPDF/web/locale/es-MX/viewer.properties@@ -38,7 +38,7 @@ print.title=Imprimirprint_label=Imprimirdownload.title=Descargardownload_label=Descargar-bookmark.title=Vista actual (copia o abierta en ventana nueva)+bookmark.title=Vista actual (copiar o abrir en una nueva ventana)bookmark_label=Vista actual# Secondary toolbar and context menu@@ -140,12 +140,16 @@ page_scale_width=Ancho de páginapage_scale_fit=Ajustar páginapage_scale_auto=Zoom automáticopage_scale_actual=Tamaño real+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{escala}}%# Loading indicator messagesloading_error_indicator=Errorloading_error=Un error ocurrió al cargar el PDF.invalid_file_error=Archivo PDF invalido o dañado.missing_file_error=Archivo PDF no encontrado.+unexpected_response_error=Respuesta inesperada del servidor.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/et/viewer.properties b/data/ext/viewerPDF/web/locale/et/viewer.propertiesindex 89a4a92a5..83da357b3 100644--- a/data/ext/viewerPDF/web/locale/et/viewer.properties+++ b/data/ext/viewerPDF/web/locale/et/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Mahuta laiuselepage_scale_fit=Mahuta leheküljelepage_scale_auto=Automaatne suurendaminepage_scale_actual=Tegelik suurus+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Vigaloading_error=PDFi laadimisel esines viga.invalid_file_error=Vigane või rikutud PDF-fail.missing_file_error=PDF-fail puudub.+unexpected_response_error=Ootamatu vastus serverilt.# LOCALIZATION NOTE (text_annotation_type): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/eu/viewer.properties b/data/ext/viewerPDF/web/locale/eu/viewer.propertiesindex 0829055e7..52d50baa7 100644--- a/data/ext/viewerPDF/web/locale/eu/viewer.properties+++ b/data/ext/viewerPDF/web/locale/eu/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Orriaren zabalerapage_scale_fit=Doitu orrirapage_scale_auto=Zoom automatikoapage_scale_actual=Benetako tamaina+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent=%{{scale}}# Loading indicator messagesloading_error_indicator=Errorealoading_error=Errorea gertatu da PDFa kargatzean.invalid_file_error=PDF fitxategi baliogabe edo hondatua.missing_file_error=PDF fitxategia falta da.+unexpected_response_error=Espero gabeko zerbitzariaren erantzuna.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/fa/viewer.properties b/data/ext/viewerPDF/web/locale/fa/viewer.propertiesindex 062f2c2d9..51bda1b4f 100644--- a/data/ext/viewerPDF/web/locale/fa/viewer.properties+++ b/data/ext/viewerPDF/web/locale/fa/viewer.properties@@ -14,7 +14,9 @@# Main toolbar buttons (tooltips and alt text for images)previous.title=صفحهٔ قبلی+previous_label=قبلیnext.title=صفحهٔ بعدی+next_label=بعدی# LOCALIZATION NOTE (page_label, page_of):# These strings are concatenated to form the "Page: X of Y" string.@@ -40,14 +42,58 @@ bookmark.title=نمای فعلی (کپی کن، یا در پنجرۀ دیگریbookmark_label=نمای فعلی# Secondary toolbar and context menu+tools.title=ابزارها+tools_label=ابزارها+first_page.title=برو به اولین صفحه+first_page.label=برو یه اولین صفحه+first_page_label=برو به اولین صفحه+last_page.title=برو به آخرین صفحه+last_page.label=برو به آخرین صفحه+last_page_label=برو به آخرین صفحه+page_rotate_cw.title=چرخش ساعتگرد+page_rotate_cw.label=چرخش ساعتگرد+page_rotate_cw_label=چرخش ساعتگرد+page_rotate_ccw.title=چرخش پاد ساعتگرد+page_rotate_ccw.label=چرخش پاد ساعتگرد+page_rotate_ccw_label=چرخش پاد ساعتگرد++hand_tool_enable.title=فعال سازی ابزار دست+hand_tool_enable_label=فعال سازی ابزار دست+hand_tool_disable.title=غیرفعال سازی ابزار دست+hand_tool_disable_label=غیرفعال سازی ابزار دست++# Document properties dialog box+document_properties.title=خصوصیات سند...+document_properties_label=خصوصیات سند...+document_properties_file_name=نام فایل:+document_properties_file_size=حجم پرونده:+document_properties_kb={{size_kb}} کیلوبایت ({{size_b}} بایت)+document_properties_mb={{size_mb}} مگابایت ({{size_b}} بایت)+document_properties_title=عنوان:+document_properties_author=نویسنده:+document_properties_subject=موضوع:+document_properties_keywords=کلیدواژهها:+document_properties_creation_date=تاریخ ایجاد:+document_properties_modification_date=تاریخ ویرایش:+document_properties_date_string={{date}}، {{time}}+document_properties_creator=ایجاد کننده:+document_properties_producer=ایجاد کننده PDF:+document_properties_version=نسخه PDF:+document_properties_page_count=تعداد صفحات:+document_properties_close=بستن# Tooltips and alt text for side panel toolbar buttons# (the _label strings are alt text for the buttons, the .title strings are# tooltips)+toggle_sidebar.title=باز و بسته کردن نوار کناری+toggle_sidebar_label=تغییرحالت نوارکناریoutline.title=نمایش طرح نوشتارoutline_label=طرح نوشتار+attachments.title=نمایش پیوستها+attachments_label=پیوستهاthumbs.title=نمایش تصاویر بندانگشتیthumbs_label=تصاویر بندانگشتی+findbar.title=جستجو در سندfindbar_label=پیدا کردن# Thumbnails panel item (tooltip and alt text for images)@@ -59,8 +105,15 @@ thumb_page_title=صفحه {{page}}thumb_page_canvas=تصویر بند انگشتی صفحه {{page}}# Find panel button title and messages+find_label=جستجو:find_previous.title=پیدا کردن رخداد قبلی عبارت+find_previous_label=قبلیfind_next.title=پیدا کردن رخداد بعدی عبارت+find_next_label=بعدی+find_highlight=برجسته و هایلایت کردن همه موارد+find_match_case_label=تطبیق کوچکی و بزرگی حروف+find_reached_top=به بالای صفحه رسیدیم، از پایین ادامه میدهیم+find_reached_bottom=به آخر صفحه رسیدیم، از بالا ادامه میدهیمfind_not_found=عبارت پیدا نشد# Error panel labels@@ -69,6 +122,7 @@ error_less_info=اطلاعات کمترerror_close=بستن# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be# replaced by the PDF.JS version and build ID.+error_version_info=PDF.js ورژن{{version}} (ساخت: {{build}})# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an# english string describing the error.error_message=پیام: {{message}}@@ -86,17 +140,27 @@ page_scale_width=عرض صفحهpage_scale_fit=اندازه کردن صفحهpage_scale_auto=بزرگنمایی خودکارpage_scale_actual=اندازه واقعی+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.# Loading indicator messagesloading_error_indicator=خطاloading_error=هنگام بارگیری پرونده (PDF) خطایی رخ داد.+invalid_file_error=پرونده PDF نامعتبر یامعیوب میباشد.+missing_file_error=پرونده PDF یافت نشد.+unexpected_response_error=پاسخ پیش بینی نشده سرور# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in# the PDF spec (32000-1:2008 Table 169 – Annotation types).# Some common types are e.g.: "Check", "Text", "Comment", "Note"text_annotation_type.alt=[{{type}} Annotation]+password_label=جهت باز کردن پرونده PDF گذرواژه را وارد نمائید.+password_invalid=گذرواژه نامعتبر. لطفا مجددا تلاش کنید.password_ok=تأییدpassword_cancel=انصرافprinting_not_supported=هشدار: قابلیت چاپ بهطور کامل در این مرورگر پشتیبانی نمیشود.+printing_not_ready=اخطار: پرونده PDF بطور کامل بارگیری نشده و امکان چاپ وجود ندارد.+web_fonts_disabled=فونت های تحت وب غیر فعال شده اند: امکان استفاده از نمایش دهنده داخلی PDF وجود ندارد.+document_colors_disabled=فایلهای PDF نمیتوانند که رنگ های خود را داشته باشند. لذا گزینه 'اجازه تغییر رنگ" در مرورگر غیر فعال شده است.diff --git a/data/ext/viewerPDF/web/locale/ff/viewer.properties b/data/ext/viewerPDF/web/locale/ff/viewer.propertiesindex 9720c3eef..8a64098b4 100644--- a/data/ext/viewerPDF/web/locale/ff/viewer.properties+++ b/data/ext/viewerPDF/web/locale/ff/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Njaajeendi Hellopage_scale_fit=Keƴeendi Hellopage_scale_auto=Loongorde Jaajolpage_scale_actual=Ɓetol Jaati+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Juumreloading_error=Juumre waɗii tuma nde loowata PDF oo.invalid_file_error=Fiilde PDF moƴƴaani walla jiibii.missing_file_error=Fiilde PDF ena ŋakki.+unexpected_response_error=Jaabtol sarworde tijjinooka.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/fi/viewer.properties b/data/ext/viewerPDF/web/locale/fi/viewer.propertiesindex c0a0288aa..d64a0a88a 100644--- a/data/ext/viewerPDF/web/locale/fi/viewer.properties+++ b/data/ext/viewerPDF/web/locale/fi/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Sivun leveyspage_scale_fit=Koko sivupage_scale_auto=Automaattinen suurennuspage_scale_actual=Todellinen koko+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}} %# Loading indicator messagesloading_error_indicator=Virheloading_error=Tapahtui virhe ladattaessa PDF-tiedostoa.invalid_file_error=Virheellinen tai vioittunut PDF-tiedosto.missing_file_error=Puuttuva PDF-tiedosto.+unexpected_response_error=Odottamaton vastaus palvelimelta.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -160,4 +164,4 @@ password_cancel=Peruutaprinting_not_supported=Varoitus: Selain ei tue kaikkia tulostustapoja.printing_not_ready=Varoitus: PDF-tiedosto ei ole vielä latautunut kokonaan, eikä sitä voi vielä tulostaa.web_fonts_disabled=Verkkosivujen omat kirjasinlajit on estetty: ei voida käyttää upotettuja PDF-kirjasinlajeja.-document_colors_disabled=PDF-dokumenttien ei ole sallittua käyttää omia värejään: Asetusta \"Sivut saavat käyttää omia värejään oletusten sijaan\" ei ole valittu selaimen asetuksissa.+document_colors_disabled=PDF-dokumenttien ei ole sallittua käyttää omia värejään: Asetusta "Sivut saavat käyttää omia värejään oletusten sijaan" ei ole valittu selaimen asetuksissa.diff --git a/data/ext/viewerPDF/web/locale/fr/viewer.properties b/data/ext/viewerPDF/web/locale/fr/viewer.propertiesindex 41d1860cf..a65e06d72 100644--- a/data/ext/viewerPDF/web/locale/fr/viewer.properties+++ b/data/ext/viewerPDF/web/locale/fr/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Pleine largeurpage_scale_fit=Page entièrepage_scale_auto=Zoom automatiquepage_scale_actual=Taille réelle+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}} %# Loading indicator messagesloading_error_indicator=Erreurloading_error=Une erreur s'est produite lors du chargement du fichier PDF.invalid_file_error=Fichier PDF invalide ou corrompu.missing_file_error=Fichier PDF manquant.+unexpected_response_error=Réponse inattendue du serveur.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/fy-NL/viewer.properties b/data/ext/viewerPDF/web/locale/fy-NL/viewer.propertiesindex 8110e86a7..d81561c78 100644--- a/data/ext/viewerPDF/web/locale/fy-NL/viewer.properties+++ b/data/ext/viewerPDF/web/locale/fy-NL/viewer.properties@@ -49,7 +49,7 @@ first_page.label=Gean nei earste sidefirst_page_label=Gean nei earste sidelast_page.title=Gean nei lêste sidelast_page.label=Gean nei lêste side-last_page_label=Gean nei lêste v+last_page_label=Gean nei lêste sidepage_rotate_cw.title=Rjochtsom draaiepage_rotate_cw.label=Rjochtsom draaiepage_rotate_cw_label=Rjochtsom draaie@@ -118,8 +118,8 @@ find_next.title=It folgjende foarkommen fan de tekst sykjefind_next_label=Folgjendefind_highlight=Alles markearjefind_match_case_label=Haadlettergefoelich-find_reached_top=Boppekant fan dokumint berikt, trochgien fanôf ûnderkant-find_reached_bottom=Ein fan dokumint berikt, trochgien fanôf boppekant+find_reached_top=Boppekant fan dokumint berikt, trochgien fanôf ûnder+find_reached_bottom=Ein fan dokumint berikt, trochgien fanôf boppefind_not_found=Tekst net fûn# Error panel labels@@ -128,7 +128,7 @@ error_less_info=Minder ynformaasjeerror_close=Slute# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be# replaced by the PDF.JS version and build ID.-error_version_info=PDF.js v{{version}} (build: {{build}})+error_version_info=PDF.js f{{version}} (build: {{build}})# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an# english string describing the error.error_message=Berjocht: {{message}}@@ -146,24 +146,28 @@ page_scale_width=Sidebreedtepage_scale_fit=Hiele sidepage_scale_auto=Automatysk zoomepage_scale_actual=Wurklike grutte+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Flaterloading_error=Der is in flater bard by it laden fan de PDF.invalid_file_error=Ynfalide of korruptearre PDF-bestân.missing_file_error=PDF-bestân ûntbrekt.+unexpected_response_error=Unferwacht tsjinnerantwurd.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in# the PDF spec (32000-1:2008 Table 169 – Annotation types).# Some common types are e.g.: "Check", "Text", "Comment", "Note"-text_annotation_type.alt=[{{type}} Annotation]+text_annotation_type.alt=[{{type}}-annotaasje]password_label=Jou it wachtwurd om dit PDF-bestân te iepenjen.password_invalid=Ferkeard wachtwurd. Probearje opnij.password_ok=OKpassword_cancel=Annulearje-printing_not_supported=Warning: Printing is net folslein stipe troch dizze browser.+printing_not_supported=Warning: Printen is net folslein stipe troch dizze browser.printing_not_ready=Warning: PDF is net folslein laden om ôf te drukken.web_fonts_disabled=Weblettertypen binne útskeakele: gebrûk fan ynsluten PDF-lettertypen is net mooglik.-document_colors_disabled=PDF-dokuminten binne net tastien om har eigen kleuren te brûken: \'Siden tastean har eigen kleuren te kiezen\' is útskeakele yn de browser.+document_colors_disabled=PDF-dokuminten binne net tastien om har eigen kleuren te brûken: ‘Siden tastean har eigen kleuren te kiezen’ is útskeakele yn de browser.diff --git a/data/ext/viewerPDF/web/locale/ga-IE/viewer.properties b/data/ext/viewerPDF/web/locale/ga-IE/viewer.propertiesindex 66c48760f..038195968 100644--- a/data/ext/viewerPDF/web/locale/ga-IE/viewer.properties+++ b/data/ext/viewerPDF/web/locale/ga-IE/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Leithead Leathanaighpage_scale_fit=Laghdaigh go dtí an Leathanachpage_scale_auto=Súmáil Uathoibríochpage_scale_actual=Fíormhéid+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Earráidloading_error=Tharla earráid agus an cháipéis PDF á luchtú.invalid_file_error=Comhad neamhbhailí nó truaillithe PDF.missing_file_error=Comhad PDF ar iarraidh.+unexpected_response_error=Freagra ón bhfreastalaí gan súil leis.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/gd/viewer.properties b/data/ext/viewerPDF/web/locale/gd/viewer.propertiesindex f535f0660..c2edf028e 100644--- a/data/ext/viewerPDF/web/locale/gd/viewer.properties+++ b/data/ext/viewerPDF/web/locale/gd/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Leud na duilleigepage_scale_fit=Freagair ri meud na duilleigepage_scale_auto=Sùm fèin-obrachailpage_scale_actual=Am fìor-mheud+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Mearachdloading_error=Thachair mearachd rè luchdadh a' PDF.invalid_file_error=Faidhle PDF a tha mì-dhligheach no coirbte.missing_file_error=Faidhle PDF a tha a dhìth.+unexpected_response_error=Freagairt on fhrithealaiche ris nach robh dùil.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/gl/viewer.properties b/data/ext/viewerPDF/web/locale/gl/viewer.propertiesindex 08729fee6..0a1f17b5b 100644--- a/data/ext/viewerPDF/web/locale/gl/viewer.properties+++ b/data/ext/viewerPDF/web/locale/gl/viewer.properties@@ -30,17 +30,58 @@ zoom_out_label=Reducirzoom_in.title=Ampliarzoom_in_label=Ampliarzoom.title=Zoom-print.title=Imprimir-print_label=Imprimirpresentation_mode.title=Cambiar ao modo presentaciónpresentation_mode_label=Modo presentaciónopen_file.title=Abrir ficheiroopen_file_label=Abrir+print.title=Imprimir+print_label=Imprimirdownload.title=Descargardownload_label=Descargarbookmark.title=Vista actual (copiar ou abrir nunha nova xanela)bookmark_label=Vista actual+# Secondary toolbar and context menu+tools.title=Ferramentas+tools_label=Ferramentas+first_page.title=Ir á primeira páxina+first_page.label=Ir á primeira páxina+first_page_label=Ir á primeira páxina+last_page.title=Ir á última páxina+last_page.label=Ir á última páxina+last_page_label=Ir á última páxina+page_rotate_cw.title=Rotar no sentido das agullas do reloxo+page_rotate_cw.label=Rotar no sentido das agullas do reloxo+page_rotate_cw_label=Rotar no sentido das agullas do reloxo+page_rotate_ccw.title=Rotar no sentido contrario ás agullas do reloxo+page_rotate_ccw.label=Rotar no sentido contrario ás agullas do reloxo+page_rotate_ccw_label=Rotar no sentido contrario ás agullas do reloxo++hand_tool_enable.title=Activar ferramenta man+hand_tool_enable_label=Activar ferramenta man+hand_tool_disable.title=Desactivar ferramenta man+hand_tool_disable_label=Desactivar ferramenta man++# Document properties dialog box+document_properties.title=Propiedades do documento…+document_properties_label=Propiedades do documento…+document_properties_file_name=Nome do ficheiro:+document_properties_file_size=Tamaño do ficheiro:+document_properties_kb={{size_kb}} KB ({{size_b}} bytes)+document_properties_mb={{size_mb}} MB ({{size_b}} bytes)+document_properties_title=Título:+document_properties_author=Autor:+document_properties_subject=Asunto:+document_properties_keywords=Palabras clave:+document_properties_creation_date=Data de creación:+document_properties_modification_date=Data de modificación:+document_properties_date_string={{date}}, {{time}}+document_properties_creator=Creado por:+document_properties_producer=Xenerador do PDF:+document_properties_version=Versión de PDF:+document_properties_page_count=Número de páxinas:+document_properties_close=Pechar+# Tooltips and alt text for side panel toolbar buttons# (the _label strings are alt text for the buttons, the .title strings are# tooltips)@@ -48,14 +89,13 @@ toggle_sidebar.title=Amosar/agochar a barra lateraltoggle_sidebar_label=Amosar/agochar a barra lateraloutline.title=Amosar esquema do documentooutline_label=Esquema do documento+attachments.title=Amosar anexos+attachments_label=Anexosthumbs.title=Amosar miniaturasthumbs_label=Miniaturasfindbar.title=Atopar no documentofindbar_label=Atopar-# Document outline messages-no_outline=Ningún esquema dispoñíbel-# Thumbnails panel item (tooltip and alt text for images)# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page# number.@@ -64,12 +104,6 @@ thumb_page_title=Páxina {{page}}# number.thumb_page_canvas=Miniatura da páxina {{page}}-# Context menu-first_page.label=Ir á primeira páxina-last_page.label=Ir á última páxina-page_rotate_cw.label=Rotar no sentido das agullas do reloxo-page_rotate_ccw.label=Rotar no sentido contrario ás agullas do reloxo-# Find panel button title and messagesfind_label=Atopar:find_previous.title=Atopar a anterior aparición da frase@@ -112,13 +146,19 @@ loading_error_indicator=Erroloading_error=Produciuse un erro ao cargar o PDF.invalid_file_error=Ficheiro PDF danado ou incorrecto.missing_file_error=Falta o ficheiro PDF.+unexpected_response_error=Resposta inesperada do servidor.-# LOCALIZATION NOTE (text_annotation_type): This is used as a tooltip.+# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in# the PDF spec (32000-1:2008 Table 169 – Annotation types).# Some common types are e.g.: "Check", "Text", "Comment", "Note"-text_annotation_type=[Anotación {{type}}]-request_password=O PDF está protexido por un contrasinal:+text_annotation_type.alt=[Anotación {{type}}]+password_label=Escriba o contrasinal para abrir este ficheiro PDF.+password_invalid=Contrasinal incorrecto. Tente de novo.+password_ok=Aceptar+password_cancel=Cancelarprinting_not_supported=Aviso: A impresión non é compatíbel de todo con este navegador.+printing_not_ready=Aviso: O PDF non se cargou completamente para imprimirse.web_fonts_disabled=Desactiváronse as fontes web: foi imposíbel usar as fontes incrustadas no PDF.+document_colors_disabled=Non se permite que os documentos PDF usen as súas propias cores: «Permitir que as páxinas escollan as súas propias cores» está desactivado no navegador.diff --git a/data/ext/viewerPDF/web/locale/gu-IN/viewer.properties b/data/ext/viewerPDF/web/locale/gu-IN/viewer.propertiesindex 2c33bdd86..1e58d3fe3 100644--- a/data/ext/viewerPDF/web/locale/gu-IN/viewer.properties+++ b/data/ext/viewerPDF/web/locale/gu-IN/viewer.properties@@ -104,7 +104,7 @@ printing_not_ready=Warning: PDF એ છાપવા માટે સંપૂરtoggle_sidebar.title=ટૉગલ બાજુપટ્ટીtoggle_sidebar_label=ટૉગલ બાજુપટ્ટીweb_fonts_disabled=વેબ ફોન્ટ નિષ્ક્રિય થયેલ છે: ઍમ્બેડ થયેલ PDF ફોન્ટને વાપરવાનું અસમર્થ.-document_colors_disabled=PDF દસ્તાવેજો તેનાં પોતાના રંગોને વાપરવા પરવાનગી આપતા નથી: \'તેનાં પોતાનાં રંગોને પસંદ કરવા માટે પાનાંને પરવાનગી આપો\' બ્રાઉઝરમાં નિષ્ક્રિય થયેલ છે.+document_colors_disabled=PDF દસ્તાવેજો તેનાં પોતાના રંગોને વાપરવા પરવાનગી આપતા નથી: 'તેનાં પોતાનાં રંગોને પસંદ કરવા માટે પાનાંને પરવાનગી આપો' બ્રાઉઝરમાં નિષ્ક્રિય થયેલ છે.text_annotation_type.alt=[{{type}} Annotation]attachments.title=જોડાણોને બતાવો@@ -143,6 +143,7 @@ password_label=આ PDF ફાઇલને ખોલવા પાસવર્ડpassword_ok=બરાબરtools.title=સાધનોtools_label=સાધનો-ocument_properties.title=દસ્તાવેજ ગુણધર્મો…+document_properties_version=PDF આવૃત્તિ:+document_properties.title=દસ્તાવેજ ગુણધર્મો…diff --git a/data/ext/viewerPDF/web/locale/he/viewer.properties b/data/ext/viewerPDF/web/locale/he/viewer.propertiesindex 078d401ab..6a1116f3a 100644--- a/data/ext/viewerPDF/web/locale/he/viewer.properties+++ b/data/ext/viewerPDF/web/locale/he/viewer.properties@@ -78,6 +78,8 @@ toggle_sidebar.title=הצגה/הסתרה של סרגל הצדtoggle_sidebar_label=הצגה/הסתרה של סרגל הצדoutline.title=הצגת מתאר מסמךoutline_label=מתאר מסמך+attachments.title=הצגת צרופות+attachments_label=צרופותthumbs.title=הצגת תצוגה מקדימהthumbs_label=תצוגה מקדימהfindbar.title=חיפוש במסמךdiff --git a/data/ext/viewerPDF/web/locale/hi-IN/viewer.properties b/data/ext/viewerPDF/web/locale/hi-IN/viewer.propertiesindex 6ab2e7e86..0c476c921 100644--- a/data/ext/viewerPDF/web/locale/hi-IN/viewer.properties+++ b/data/ext/viewerPDF/web/locale/hi-IN/viewer.properties@@ -89,6 +89,8 @@ toggle_sidebar.title=स्लाइडर टॉगल करेंtoggle_sidebar_label=स्लाइडर टॉगल करेंoutline.title=दस्तावेज़ आउटलाइन दिखाएँoutline_label=दस्तावेज़ आउटलाइन+attachments.title=संलग्नक दिखायें+attachments_label=संलग्नकthumbs.title=लघुछवियाँ दिखाएँthumbs_label=लघु छविfindbar.title=दस्तावेज़ में ढूँढ़ेंdiff --git a/data/ext/viewerPDF/web/locale/hr/viewer.properties b/data/ext/viewerPDF/web/locale/hr/viewer.propertiesindex 9c829b3eb..50a43a7ce 100644--- a/data/ext/viewerPDF/web/locale/hr/viewer.properties+++ b/data/ext/viewerPDF/web/locale/hr/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Širina stranicepage_scale_fit=Pristajanje stranicipage_scale_auto=Automatsko uvećanjepage_scale_actual=Prava veličina+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Greškaloading_error=Došlo je do greške pri učitavanju PDF-a.invalid_file_error=Kriva ili oštećena PDF datoteka.missing_file_error=Nedostaje PDF datoteka.+unexpected_response_error=Neočekivani odgovor poslužitelja.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/hu/viewer.properties b/data/ext/viewerPDF/web/locale/hu/viewer.propertiesindex b7a6973a2..dc261b2db 100644--- a/data/ext/viewerPDF/web/locale/hu/viewer.properties+++ b/data/ext/viewerPDF/web/locale/hu/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Oldalszélességpage_scale_fit=Teljes oldalpage_scale_auto=Automatikus nagyításpage_scale_actual=Valódi méret+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Hibaloading_error=Hiba történt a PDF betöltésekor.invalid_file_error=Érvénytelen vagy sérült PDF fájl.missing_file_error=Hiányzó PDF fájl.+unexpected_response_error=Váratlan kiszolgálóválasz.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/hy-AM/viewer.properties b/data/ext/viewerPDF/web/locale/hy-AM/viewer.propertiesindex eda49756f..b26af7d66 100644--- a/data/ext/viewerPDF/web/locale/hy-AM/viewer.properties+++ b/data/ext/viewerPDF/web/locale/hy-AM/viewer.properties@@ -94,7 +94,7 @@ attachments_label=Կցորդներthumbs.title=Ցուցադրել Մանրապատկերըthumbs_label=Մանրապատկերըfindbar.title=Գտնել փաստաթղթում-findbar_label=Փնտրել+findbar_label=Որոնում# Thumbnails panel item (tooltip and alt text for images)# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page@@ -140,12 +140,16 @@ page_scale_width=Էջի լայնքըpage_scale_fit=Ձգել էջըpage_scale_auto=Ինքնաշխատpage_scale_actual=Իրական չափը+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Սխալloading_error=Սխալ՝ PDF ֆայլը բացելիս։invalid_file_error=Սխալ կամ բնասված PDF ֆայլ:missing_file_error=PDF ֆայլը բացակայում է:+unexpected_response_error=Սպասարկիչի անսպասելի պատասխան:# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/id/viewer.properties b/data/ext/viewerPDF/web/locale/id/viewer.propertiesindex 698a2ba11..b9cfc74c3 100644--- a/data/ext/viewerPDF/web/locale/id/viewer.properties+++ b/data/ext/viewerPDF/web/locale/id/viewer.properties@@ -30,12 +30,12 @@ zoom_out_label=Perkecilzoom_in.title=Perbesarzoom_in_label=Perbesarzoom.title=Perbesaran-print.title=Cetak-print_label=Cetakpresentation_mode.title=Ganti ke Mode Presentasipresentation_mode_label=Mode Presentasiopen_file.title=Buka Berkasopen_file_label=Buka+print.title=Cetak+print_label=Cetakdownload.title=Unduhdownload_label=Unduhbookmark.title=Tampilan Sekarang (salin atau buka di jendela baru)@@ -45,10 +45,10 @@ bookmark_label=Tampilan Sekarangtools.title=Alattools_label=Alatfirst_page.title=Buka Halaman Pertama-first_page.label=Buka Halaman Pertama+first_page.label=Ke Halaman Pertamafirst_page_label=Buka Halaman Pertamalast_page.title=Buka Halaman Terakhir-last_page.label=Buka Halaman Terakhir+last_page.label=Ke Halaman Terakhirlast_page_label=Buka Halaman Terakhirpage_rotate_cw.title=Putar Searah Jarum Jampage_rotate_cw.label=Putar Searah Jarum Jam@@ -104,12 +104,6 @@ thumb_page_title=Laman {{page}}# number.thumb_page_canvas=Miniatur Laman {{page}}-# Context menu-first_page.label=Ke Halaman Pertama-last_page.label=Ke Halaman Terakhir-page_rotate_cw.label=Putar Searah Jarum Jam-page_rotate_ccw.label=Putar Berlawanan Arah Jarum Jam-# Find panel button title and messagesfind_label=Temukan:find_previous.title=Temukan kata sebelumnya@@ -146,14 +140,18 @@ page_scale_width=Lebar Lamanpage_scale_fit=Muat Lamanpage_scale_auto=Perbesaran Otomatispage_scale_actual=Ukuran Asli+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Galatloading_error=Galat terjadi saat memuat PDF.invalid_file_error=Berkas PDF tidak valid atau rusak.missing_file_error=Berkas PDF tidak ada.+unexpected_response_error=Balasan server yang tidak diharapkan.-# LOCALIZATION NOTE (text_annotation_type): This is used as a tooltip.+# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in# the PDF spec (32000-1:2008 Table 169 – Annotation types).# Some common types are e.g.: "Check", "Text", "Comment", "Note"@@ -166,4 +164,4 @@ password_cancel=Batalprinting_not_supported=Peringatan: Pencetakan tidak didukung secara lengkap pada peramban ini.printing_not_ready=Peringatan: Berkas PDF masih belum dimuat secara lengkap untuk dapat dicetak.web_fonts_disabled=Font web dinonaktifkan: tidak dapat menggunakan font PDF yang tersemat.-document_colors_disabled=Dokumen PDF tidak diizinkan untuk menggunakan warnanya sendiri karena setelan \'Izinkan laman memilih warna sendiri\’ dinonaktifkan pada pengaturan.+document_colors_disabled=Dokumen PDF tidak diizinkan untuk menggunakan warnanya sendiri karena setelan 'Izinkan laman memilih warna sendiri' dinonaktifkan pada pengaturan.diff --git a/data/ext/viewerPDF/web/locale/is/viewer.properties b/data/ext/viewerPDF/web/locale/is/viewer.propertiesindex 27db046df..ffc055a54 100644--- a/data/ext/viewerPDF/web/locale/is/viewer.properties+++ b/data/ext/viewerPDF/web/locale/is/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Síðubreiddpage_scale_fit=Passa á síðupage_scale_auto=Sjálfvirkur aðdrátturpage_scale_actual=Raunstærð+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Villaloading_error=Villa kom upp við að hlaða inn PDF.invalid_file_error=Ógild eða skemmd PDF skrá.missing_file_error=Vantar PDF skrá.+unexpected_response_error=Óvænt svar frá netþjóni.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -154,7 +158,7 @@ missing_file_error=Vantar PDF skrá.text_annotation_type.alt=[{{type}} Skýring]password_label=Sláðu inn lykilorð til að opna þessa PDF skrá.password_invalid=Ógilt lykilorð. Reyndu aftur.-password_ok=Í lagi\u0020+password_ok=Í lagipassword_cancel=Hætta viðprinting_not_supported=Aðvörun: Prentun er ekki með fyllilegan stuðning á þessum vafra.diff --git a/data/ext/viewerPDF/web/locale/it/viewer.properties b/data/ext/viewerPDF/web/locale/it/viewer.propertiesindex 7457e2164..4453b7bc6 100644--- a/data/ext/viewerPDF/web/locale/it/viewer.properties+++ b/data/ext/viewerPDF/web/locale/it/viewer.properties@@ -94,10 +94,12 @@ page_scale_width = Larghezza paginapage_scale_fit = Adatta a una paginapage_scale_auto = Zoom automaticopage_scale_actual = Dimensioni effettive+page_scale_percent = {{scale}}%loading_error_indicator = Erroreloading_error = Si è verificato un errore durante il caricamento del PDF.invalid_file_error = File PDF non valido o danneggiato.missing_file_error = File PDF non disponibile.+unexpected_response_error = Risposta imprevista del servertext_annotation_type.alt = [Annotazione: {{type}}]password_label = Inserire la password per aprire questo file PDF.password_invalid = Password non corretta. Riprovare.diff --git a/data/ext/viewerPDF/web/locale/ja/viewer.properties b/data/ext/viewerPDF/web/locale/ja/viewer.propertiesindex 40e21849c..04a6a0b3f 100644--- a/data/ext/viewerPDF/web/locale/ja/viewer.properties+++ b/data/ext/viewerPDF/web/locale/ja/viewer.properties@@ -112,8 +112,8 @@ find_next.title=指定文字列に一致する次の部分を検索しますfind_next_label=次へfind_highlight=すべて強調表示find_match_case_label=大文字/小文字を区別-find_reached_top=文書先頭まで検索したので末尾に戻って検索しました。-find_reached_bottom=文書末尾まで検索したので先頭に戻って検索しました。+find_reached_top=文書先頭に到達したので末尾に戻って検索しました。+find_reached_bottom=文書末尾に到達したので先頭に戻って検索しました。find_not_found=見つかりませんでした。# Error panel labels@@ -132,7 +132,7 @@ error_stack=スタック: {{stack}}# LOCALIZATION NOTE (error_file): "{{file}}" will be replaced with a filenameerror_file=ファイル: {{file}}# LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line number-error_line=ライン: {{line}}+error_line=行: {{line}}rendering_error=ページのレンダリング中にエラーが発生しました# Predefined zoom values@@ -140,12 +140,16 @@ page_scale_width=幅に合わせるpage_scale_fit=ページのサイズに合わせるpage_scale_auto=自動ズームpage_scale_actual=実際のサイズ+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=エラーloading_error=PDF の読み込み中にエラーが発生しましたinvalid_file_error=無効または破損した PDF ファイルmissing_file_error=PDF ファイルが見つかりません。+unexpected_response_error=サーバから予期せぬ応答がありました。# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -159,5 +163,5 @@ password_cancel=キャンセルprinting_not_supported=警告: このブラウザでは印刷が完全にサポートされていませんprinting_not_ready=警告: PDF を印刷するための読み込みが終了していません-web_fonts_disabled=Web フォントが無効になっています: 埋め込まれた PDF のフォントを使用することができません-document_colors_disabled=PDF 文書は、Web ページが指定した配色を使用することができません: \'Web ページが指定した配色\' はブラウザで無効になっています。+web_fonts_disabled=Web フォントが無効になっています: 埋め込まれた PDF のフォントを使用できません+document_colors_disabled=PDF 文書は、Web ページが指定した配色を使用することができません: \u0027Web ページが指定した配色\u0027 はブラウザで無効になっています。diff --git a/data/ext/viewerPDF/web/locale/kk/viewer.properties b/data/ext/viewerPDF/web/locale/kk/viewer.propertiesindex 7d02ae599..c6fbb8dfb 100644--- a/data/ext/viewerPDF/web/locale/kk/viewer.properties+++ b/data/ext/viewerPDF/web/locale/kk/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Парақ еніpage_scale_fit=Парақты сыйдыруpage_scale_auto=Автомасштабтауpage_scale_actual=Нақты өлшемі+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Қатеloading_error=PDF жүктеу кезінде қате кетті.invalid_file_error=Зақымдалған немесе қате PDF файл.missing_file_error=PDF файлы жоқ.+unexpected_response_error=Сервердің күтпеген жауабы.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/km/viewer.properties b/data/ext/viewerPDF/web/locale/km/viewer.propertiesindex 45acd63cf..6ea40053e 100644--- a/data/ext/viewerPDF/web/locale/km/viewer.properties+++ b/data/ext/viewerPDF/web/locale/km/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=ទទឹងទំព័រpage_scale_fit=សមទំព័រpage_scale_auto=ពង្រីកស្វ័យប្រវត្តិpage_scale_actual=ទំហំជាក់ស្ដែង+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=កំហុសloading_error=មានកំហុសបានកើតឡើងពេលកំពុងផ្ទុក PDF ។invalid_file_error=ឯកសារ PDF ខូច ឬមិនត្រឹមត្រូវ ។missing_file_error=បាត់ឯកសារ PDF+unexpected_response_error=ការឆ្លើយតមម៉ាស៊ីនមេដែលមិនបានរំពឹង។# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/kn/viewer.properties b/data/ext/viewerPDF/web/locale/kn/viewer.propertiesindex a2a231d46..c50cd20f7 100644--- a/data/ext/viewerPDF/web/locale/kn/viewer.properties+++ b/data/ext/viewerPDF/web/locale/kn/viewer.properties@@ -42,15 +42,45 @@ bookmark.title=ಪ್ರಸಕ್ತ ನೋಟ (ಪ್ರತಿ ಮಾಡು ಅbookmark_label=ಪ್ರಸಕ್ತ ನೋಟ# Secondary toolbar and context menu+tools.title=ಉಪಕರಣಗಳು+tools_label=ಉಪಕರಣಗಳು+first_page.title=ಮೊದಲ ಪುಟಕ್ಕೆ ತೆರಳು+first_page.label=ಮೊದಲ ಪುಟಕ್ಕೆ ತೆರಳು+first_page_label=ಮೊದಲ ಪುಟಕ್ಕೆ ತೆರಳುlast_page.title=ಕೊನೆಯ ಪುಟಕ್ಕೆ ತೆರಳು+last_page.label=ಕೊನೆಯ ಪುಟಕ್ಕೆ ತೆರಳು+last_page_label=ಕೊನೆಯ ಪುಟಕ್ಕೆ ತೆರಳು+page_rotate_cw.title=ಪ್ರದಕ್ಷಿಣೆಯಲ್ಲಿ ತಿರುಗಿಸು+page_rotate_cw.label=ಪ್ರದಕ್ಷಿಣೆಯಲ್ಲಿ ತಿರುಗಿಸು+page_rotate_cw_label=ಪ್ರದಕ್ಷಿಣೆಯಲ್ಲಿ ತಿರುಗಿಸು+page_rotate_ccw.title=ಅಪ್ರದಕ್ಷಿಣೆಯಲ್ಲಿ ತಿರುಗಿಸು+page_rotate_ccw.label=ಅಪ್ರದಕ್ಷಿಣೆಯಲ್ಲಿ ತಿರುಗಿಸು+page_rotate_ccw_label=ಅಪ್ರದಕ್ಷಿಣೆಯಲ್ಲಿ ತಿರುಗಿಸು+hand_tool_enable.title=ಕೈ ಉಪಕರಣವನ್ನು ಸಕ್ರಿಯಗೊಳಿಸು+hand_tool_enable_label=ಕೈ ಉಪಕರಣವನ್ನು ಸಕ್ರಿಯಗೊಳಿಸು+hand_tool_disable.title=ಕೈ ಉಪಕರಣವನ್ನು ನಿಷ್ಕ್ರಿಯಗೊಳಿಸು+hand_tool_disable_label=ಕೈ ಉಪಕರಣವನ್ನು ನಿಷ್ಕ್ರಿಯಗೊಳಿಸು# Document properties dialog box+document_properties.title=ಡಾಕ್ಯುಮೆಂಟ್ ಗುಣಗಳು...+document_properties_label=ಡಾಕ್ಯುಮೆಂಟ್ ಗುಣಗಳು...+document_properties_file_name=ಕಡತದ ಹೆಸರು:+document_properties_file_size=ಕಡತದ ಗಾತ್ರ:document_properties_kb={{size_kb}} KB ({{size_b}} ಬೈಟ್ಗಳು)document_properties_mb={{size_mb}} MB ({{size_b}} ಬೈಟ್ಗಳು)document_properties_title=ಶೀರ್ಷಿಕೆ:document_properties_author=ಕರ್ತೃ:+document_properties_subject=ವಿಷಯ:+document_properties_keywords=ಮುಖ್ಯಪದಗಳು:+document_properties_creation_date=ರಚಿಸಿದ ದಿನಾಂಕ:+document_properties_modification_date=ಮಾರ್ಪಡಿಸಲಾದ ದಿನಾಂಕ:document_properties_date_string={{date}}, {{time}}+document_properties_creator=ರಚಿಸಿದವರು:+document_properties_producer=PDF ಉತ್ಪಾದಕ:+document_properties_version=PDF ಆವೃತ್ತಿ:+document_properties_page_count=ಪುಟದ ಎಣಿಕೆ:+document_properties_close=ಮುಚ್ಚು# Tooltips and alt text for side panel toolbar buttons# (the _label strings are alt text for the buttons, the .title strings are@@ -59,6 +89,7 @@ toggle_sidebar.title=ಬದಿಪಟ್ಟಿಯನ್ನು ಹೊರಳಿಸtoggle_sidebar_label=ಬದಿಪಟ್ಟಿಯನ್ನು ಹೊರಳಿಸುoutline.title=ದಸ್ತಾವೇಜಿನ ಹೊರರೇಖೆಯನ್ನು ತೋರಿಸುoutline_label=ದಸ್ತಾವೇಜಿನ ಹೊರರೇಖೆ+attachments.title=ಲಗತ್ತುಗಳನ್ನು ತೋರಿಸುattachments_label=ಲಗತ್ತುಗಳುthumbs.title=ಚಿಕ್ಕಚಿತ್ರದಂತೆ ತೋರಿಸುthumbs_label=ಚಿಕ್ಕಚಿತ್ರಗಳು@@ -109,18 +140,24 @@ page_scale_width=ಪುಟದ ಅಗಲpage_scale_fit=ಪುಟದ ಸರಿಹೊಂದಿಕೆpage_scale_auto=ಸ್ವಯಂಚಾಲಿತ ಗಾತ್ರಬದಲಾವಣೆpage_scale_actual=ನಿಜವಾದ ಗಾತ್ರ+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=ದೋಷloading_error=PDF ಅನ್ನು ಲೋಡ್ ಮಾಡುವಾಗ ಒಂದು ದೋಷ ಎದುರಾಗಿದೆ.invalid_file_error=ಅಮಾನ್ಯವಾದ ಅಥವ ಹಾಳಾದ PDF ಕಡತ.missing_file_error=PDF ಕಡತ ಇಲ್ಲ.+unexpected_response_error=ಅನಿರೀಕ್ಷಿತವಾದ ಪೂರೈಕೆಗಣಕದ ಪ್ರತಿಕ್ರಿಯೆ.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in# the PDF spec (32000-1:2008 Table 169 – Annotation types).# Some common types are e.g.: "Check", "Text", "Comment", "Note"text_annotation_type.alt=[{{type}} ಟಿಪ್ಪಣಿ]+password_label=PDF ಅನ್ನು ತೆರೆಯಲು ಗುಪ್ತಪದವನ್ನು ನಮೂದಿಸಿ.+password_invalid=ಅಮಾನ್ಯವಾದ ಗುಪ್ತಪದ, ದಯವಿಟ್ಟು ಇನ್ನೊಮ್ಮೆ ಪ್ರಯತ್ನಿಸಿ.password_ok=OKpassword_cancel=ರದ್ದು ಮಾಡುdiff --git a/data/ext/viewerPDF/web/locale/ko/viewer.properties b/data/ext/viewerPDF/web/locale/ko/viewer.propertiesindex 282be99d2..eca6ffaca 100644--- a/data/ext/viewerPDF/web/locale/ko/viewer.properties+++ b/data/ext/viewerPDF/web/locale/ko/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=페이지 너비에 맞춤page_scale_fit=페이지에 맞춤page_scale_auto=알아서 맞춤page_scale_actual=실제 크기에 맞춤+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=오류loading_error=PDF를 읽는 중 오류가 생겼습니다.invalid_file_error=유효하지 않거나 파손된 PDF 파일missing_file_error=PDF 파일이 없습니다.+unexpected_response_error=알 수 없는 서버 응답입니다.# LOCALIZATION NOTE (text_annotation_type): This is used as a tooltip.# "{{[type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/lt/viewer.properties b/data/ext/viewerPDF/web/locale/lt/viewer.propertiesindex 783fcf4b3..c78f44301 100644--- a/data/ext/viewerPDF/web/locale/lt/viewer.properties+++ b/data/ext/viewerPDF/web/locale/lt/viewer.properties@@ -30,12 +30,12 @@ zoom_out_label=Sumažintizoom_in.title=Padidintizoom_in_label=Padidintizoom.title=Mastelis-print.title=Spausdinti-print_label=Spausdintipresentation_mode.title=Pereiti į pateikties veiksenąpresentation_mode_label=Pateikties veiksenaopen_file.title=Atverti failąopen_file_label=Atverti+print.title=Spausdinti+print_label=Spausdintidownload.title=Parsiųstidownload_label=Parsiųstibookmark.title=Esamojo rodinio saitas (kopijavimui ar atvėrimui kitame lange)@@ -140,12 +140,16 @@ page_scale_width=Priderinti prie lapo pločiopage_scale_fit=Pritaikyti prie lapo dydžiopage_scale_auto=Automatinis mastelispage_scale_actual=Tikras dydis+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Klaidaloading_error=Įkeliant PDF failą, įvyko klaida.invalid_file_error=Tai nėra PDF failas arba jis yra sugadintas.missing_file_error=PDF failas nerastas.+unexpected_response_error=Netikėtas serverio atsakas.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/lv/viewer.properties b/data/ext/viewerPDF/web/locale/lv/viewer.propertiesindex f46f13665..ba57762e1 100644--- a/data/ext/viewerPDF/web/locale/lv/viewer.properties+++ b/data/ext/viewerPDF/web/locale/lv/viewer.properties@@ -1,6 +1,16 @@-# This Source Code Form is subject to the terms of the Mozilla Public-# License, v. 2.0. If a copy of the MPL was not distributed with this-# file, You can obtain one at http://mozilla.org/MPL/2.0/.+# Copyright 2012 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.# Main toolbar buttons (tooltips and alt text for images)previous.title=Iepriekšējā lapa@@ -15,57 +25,31 @@ next_label=Nākamāpage_label=Lapa:page_of=no {{pageCount}}-zoom_out.title=Attālināt+zoom_out.title=Attālināt\u0020zoom_out_label=Attālinātzoom_in.title=Pietuvinātzoom_in_label=Pietuvinātzoom.title=Palielinājums-print.title=Drukāšana-print_label=Drukātpresentation_mode.title=Pārslēgties uz Prezentācijas režīmupresentation_mode_label=Prezentācijas režīmsopen_file.title=Atvērt failuopen_file_label=Atvērt+print.title=Drukāšana+print_label=Drukātdownload.title=Lejupielādedownload_label=Lejupielādētbookmark.title=Pašreizējais skats (kopēt vai atvērt jaunā logā)bookmark_label=Pašreizējais skats-findbar.title=Meklēt dokumentā-findbar_label=Meklēt-attachments.title=Rādīt pielikumus-attachments_label=Pielikumi----# Tooltips and alt text for side panel toolbar buttons-# (the _label strings are alt text for the buttons, the .title strings are-# tooltips)-toggle_sidebar.title=Pārslēgt sānu joslu-toggle_sidebar_label=Pārslēgt sānu joslu-outline.title=Parādīt dokumenta saturu-outline_label=Dokumenta saturs-thumbs.title=Parādīt sīktēlus-thumbs_label=Sīktēli-# Find panel button title and messages-find_label=Meklēt:-find_previous.title=Atrast iepriekšējo-find_previous_label=Iepriekšējā-find_next.title=Atrast nākamo-find_next_label=Nākamā-find_highlight=Iekrāsot visas-find_match_case_label=Lielo, mazo burtu jutīgs-find_reached_top=Sasniegts dokumenta sākums, turpinām no beigām-find_reached_bottom=Sasniegtas dokumenta beigas, turpinām no sākuma-find_not_found=Frāze nav atrasta+# Secondary toolbar and context menu+tools.title=Rīki+tools_label=Rīkifirst_page.title=Iet uz pirmo lapufirst_page.label=Iet uz pirmo lapufirst_page_label=Iet uz pirmo lapulast_page.title=Iet uz pēdējo lapulast_page.label=Iet uz pēdējo lapulast_page_label=Iet uz pēdējo lapu-tools.title=Rīki-tools_label=Rīkipage_rotate_cw.title=Pagriezt pa pulkstenipage_rotate_cw.label=Pagriezt pa pulkstenipage_rotate_cw_label=Pagriezt pa pulksteni@@ -73,6 +57,11 @@ page_rotate_ccw.title=Pagriezt pret pulkstenipage_rotate_ccw.label=Pagriezt pret pulkstenipage_rotate_ccw_label=Pagriezt pret pulksteni+hand_tool_enable.title=Aktivēt rokas rīku+hand_tool_enable_label=Aktivēt rokas rīku+hand_tool_disable.title=Deaktivēt rokas rīku+hand_tool_disable_label=Deaktivēt rokas rīku+# Document properties dialog boxdocument_properties.title=Dokumenta iestatījumi…document_properties_label=Dokumenta iestatījumi…@@ -93,12 +82,19 @@ document_properties_version=PDF versija:document_properties_page_count=Lapu skaits:document_properties_close=Aizvērt-hand_tool_enable.title=Aktivēt rokas rīku-hand_tool_enable_label=Aktivēt rokas rīku-hand_tool_disable.title=Deaktivēt rokas rīku-hand_tool_disable_label=Deaktivēt rokas rīku--invalid_file_error=Nederīgs vai bojāts PDF fails.+# Tooltips and alt text for side panel toolbar buttons+# (the _label strings are alt text for the buttons, the .title strings are+# tooltips)+toggle_sidebar.title=Pārslēgt sānu joslu+toggle_sidebar_label=Pārslēgt sānu joslu+outline.title=Parādīt dokumenta saturu+outline_label=Dokumenta saturs+attachments.title=Rādīt pielikumus+attachments_label=Pielikumi+thumbs.title=Parādīt sīktēlus+thumbs_label=Sīktēli+findbar.title=Meklēt dokumentā+findbar_label=Meklēt# Thumbnails panel item (tooltip and alt text for images)# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page@@ -108,11 +104,22 @@ thumb_page_title=Lapa {{page}}# number.thumb_page_canvas=Lapas {{page}} sīktēls+# Find panel button title and messages+find_label=Meklēt:+find_previous.title=Atrast iepriekšējo+find_previous_label=Iepriekšējā+find_next.title=Atrast nākamo+find_next_label=Nākamā+find_highlight=Iekrāsot visas+find_match_case_label=Lielo, mazo burtu jutīgs+find_reached_top=Sasniegts dokumenta sākums, turpinām no beigām+find_reached_bottom=Sasniegtas dokumenta beigas, turpinām no sākuma+find_not_found=Frāze nav atrasta+# Error panel labelserror_more_info=Vairāk informācijaserror_less_info=MAzāk informācijaserror_close=Close-# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be# replaced by the PDF.JS version and build ID.error_version_info=PDF.js v{{version}} (build: {{build}})@@ -127,34 +134,34 @@ error_file=File: {{file}}# LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line numbererror_line=Rindiņa: {{line}}rendering_error=Attēlojot lapu radās kļūda-missing_file_error=PDF fails nav atrasts.# Predefined zoom valuespage_scale_width=Lapas platumāpage_scale_fit=Ietilpinot lapupage_scale_auto=Automātiskais izmērspage_scale_actual=Patiesais izmērs+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messages-# LOCALIZATION NOTE (error_line): "{{[percent}}" will be replaced with a percentageloading_error_indicator=Kļūdaloading_error=Ielādējot PDF notika kļūda.+invalid_file_error=Nederīgs vai bojāts PDF fails.+missing_file_error=PDF fails nav atrasts.+unexpected_response_error=Negaidīa servera atbilde.-# LOCALIZATION NOTE (text_annotation_type): This is used as a tooltip.-# "{{[type}}" will be replaced with an annotation type from a list defined in+# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.+# "{{type}}" will be replaced with an annotation type from a list defined in# the PDF spec (32000-1:2008 Table 169 – Annotation types).# Some common types are e.g.: "Check", "Text", "Comment", "Note"text_annotation_type.alt=[{{type}} anotācija]--text_annotation_type.alt=[{{type}} Anotācija]password_label=Ievadiet paroli, lai atvērtu PDF failu.password_invalid=Nepareiza parole, mēģiniet vēlreiz.password_ok=Labipassword_cancel=Atcelt-printing_not_supported=Uzmanību: Drukāšana no šī pārlūka darbojas tikai daļēji.-web_fonts_disabled=Tīmekļa fonti nav aktivizēti: Nevar iegult PDF fontus.printing_not_ready=Uzmanību: PDF nav pilnībā ielādēts drukāšanai.-document_colors_disabled=PDF dokumentiem nav atļauts izmantot pašiem savas krāsas: \'Atļaut lapām izvēlēties pašām savas krāsas\' ir deaktivēts pārlūkā.-+web_fonts_disabled=Tīmekļa fonti nav aktivizēti: Nevar iegult PDF fontus.+document_colors_disabled=PDF dokumentiem nav atļauts izmantot pašiem savas krāsas: „Atļaut lapām izvēlēties pašām savas krāsas“ ir deaktivēts pārlūkā.diff --git a/data/ext/viewerPDF/web/locale/mai/viewer.properties b/data/ext/viewerPDF/web/locale/mai/viewer.propertiesindex 1775dbfd1..564822fe2 100644--- a/data/ext/viewerPDF/web/locale/mai/viewer.properties+++ b/data/ext/viewerPDF/web/locale/mai/viewer.properties@@ -42,10 +42,45 @@ bookmark.title=मोजुदा दृश्य (नव विंडोमेbookmark_label=वर्तमान दृश्य# Secondary toolbar and context menu+tools.title=अओजार+tools_label=अओजार+first_page.title=प्रथम पृष्ठ पर जाउ+first_page.label=प्रथम पृष्ठ पर जाउ+first_page_label=प्रथम पृष्ठ पर जाउ+last_page.title=अंतिम पृष्ठ पर जाउ+last_page.label=अंतिम पृष्ठ पर जाउ+last_page_label=अंतिम पृष्ठ पर जाउ+page_rotate_cw.title=घड़ीक दिशा मे घुमाउ+page_rotate_cw.label=घड़ीक दिशा मे घुमाउ+page_rotate_cw_label=घड़ीक दिशा मे घुमाउ+page_rotate_ccw.title=घड़ीक दिशा सँ उनटा घुमाउ+page_rotate_ccw.label=घड़ीक दिशा सँ उनटा घुमाउ+page_rotate_ccw_label=घड़ीक दिशा सँ उनटा घुमाउ+hand_tool_enable.title=हाथ अओजार सक्रिय करू+hand_tool_enable_label=हाथ अओजार सक्रिय करू+hand_tool_disable.title=हाथ अओजार निष्क्रिय कएनाइ+hand_tool_disable_label=हाथ अओजार निष्क्रिय कएनाइ# Document properties dialog box+document_properties.title=दस्तावेज़ विशेषता...+document_properties_label=दस्तावेज़ विशेषता...+document_properties_file_name=फाइल नाम:+document_properties_file_size=फ़ाइल आकार:+document_properties_kb={{size_kb}} KB ({{size_b}} बाइट)+document_properties_mb={{size_mb}} MB ({{size_b}} बाइट)document_properties_title=शीर्षक:+document_properties_author=लेखकः+document_properties_subject=विषय+document_properties_keywords=बीजशब्द+document_properties_creation_date=निर्माण तिथि:+document_properties_modification_date=संशोधन दिनांक:+document_properties_date_string=तिथि/समय+document_properties_creator=सृजक:+document_properties_producer=PDF उत्पादक:+document_properties_version=PDF संस्करण:+document_properties_page_count=पृष्ठ गिनती:+document_properties_close=बन्न करू# Tooltips and alt text for side panel toolbar buttons# (the _label strings are alt text for the buttons, the .title strings are@@ -54,6 +89,8 @@ toggle_sidebar.title=स्लाइडर टागलtoggle_sidebar_label=स्लाइडर टागलoutline.title=दस्तावेज आउटलाइन देखाउoutline_label=दस्तावेज खाका+attachments.title=संलग्नक देखाबू+attachments_label=संलग्नकthumbs.title=लघु-छवि देखाउthumbs_label=लघु छविfindbar.title=दस्तावेजमे ढूँढू@@ -82,6 +119,7 @@ find_not_found=वाकींश नहि भेटल# Error panel labelserror_more_info=बेसी सूचनाerror_less_info=कम सूचना+error_close=बन्न करू# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be# replaced by the PDF.JS version and build ID.error_version_info=PDF.js v{{version}} (build: {{build}})@@ -102,6 +140,8 @@ page_scale_width=पृष्ठ चओड़ाइpage_scale_fit=पृष्ठ फिटpage_scale_auto=स्वचालित जूमpage_scale_actual=सही आकार+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.# Loading indicator messagesloading_error_indicator=त्रुटि@@ -114,8 +154,12 @@ missing_file_error=अनुपस्थित PDF फाइल.# the PDF spec (32000-1:2008 Table 169 – Annotation types).# Some common types are e.g.: "Check", "Text", "Comment", "Note"text_annotation_type.alt=[{{type}} Annotation]+password_label=एहि पीडीएफ फ़ाइल केँ खोलबाक लेल कृपया कूटशब्द भरू.+password_invalid=अवैध कूटशब्द, कृपया फिनु कोशिश करू.+password_ok=बेसpassword_cancel=रद्द करू\u0020printing_not_supported=चेतावनी: ई ब्राउजर पर छपाइ पूर्ण तरह सँ समर्थित नहि अछि.printing_not_ready=चेतावनी: पीडीएफ छपाइक लेल पूर्ण तरह सँ लोड नहि अछि.web_fonts_disabled=वेब फॉन्ट्स निष्क्रिय अछि: अंतःस्थापित PDF फान्टसक उपयोगमे असमर्थ.+document_colors_disabled=PDF दस्तावेज़ हुकर अपन रंग केँ उपयोग करबाक लेल अनुमति प्राप्त नहि अछि: 'पृष्ठ केँ हुकर अपन रंग केँ चुनबाक लेल स्वीकृति दिअ जे ओ ओहि ब्राउज़र मे निष्क्रिय अछि.diff --git a/data/ext/viewerPDF/web/locale/ml/viewer.properties b/data/ext/viewerPDF/web/locale/ml/viewer.propertiesindex ca51d4269..ecacc7c68 100644--- a/data/ext/viewerPDF/web/locale/ml/viewer.properties+++ b/data/ext/viewerPDF/web/locale/ml/viewer.properties@@ -57,9 +57,30 @@ page_rotate_ccw.title=ഘടികാര ദിശയ്ക്കു് വിpage_rotate_ccw.label=ഘടികാര ദിശയ്ക്കു് വിപരീതമായി കറക്കുകpage_rotate_ccw_label=ഘടികാര ദിശയ്ക്കു് വിപരീതമായി കറക്കുക+hand_tool_enable.title=ഹാന്ഡ് ടൂള് പ്രവര്ത്തന സജ്ജമാക്കുക+hand_tool_enable_label=ഹാന്ഡ് ടൂള് പ്രവര്ത്തന സജ്ജമാക്കുക+hand_tool_disable.title=ഹാന്ഡ് ടൂള് പ്രവര്ത്തന രഹിതമാക്കുക+hand_tool_disable_label=ഹാന്ഡ് ടൂള് പ്രവര്ത്തന രഹിതമാക്കുക# Document properties dialog box+document_properties.title=രേഖയുടെ വിശേഷതകള്...+document_properties_label=രേഖയുടെ വിശേഷതകള്...+document_properties_file_name=ഫയലിന്റെ പേര്:+document_properties_file_size=ഫയലിന്റെ വലിപ്പം:+document_properties_kb={{size_kb}} കെബി ({{size_b}} ബൈറ്റുകള്)+document_properties_mb={{size_mb}} എംബി ({{size_b}} ബൈറ്റുകള്)document_properties_title=തലക്കെട്ട്\u0020+document_properties_author=രചയിതാവ്:+document_properties_subject=വിഷയം:+document_properties_keywords=കീവേര്ഡുകള്:+document_properties_creation_date=പൂര്ത്തിയാകുന്ന തീയതി:+document_properties_modification_date=മാറ്റം വരുത്തിയ തീയതി:+document_properties_date_string={{date}}, {{time}}+document_properties_creator=സൃഷ്ടികര്ത്താവ്:+document_properties_producer=പിഡിഎഫ് പ്രൊഡ്യൂസര്:+document_properties_version=പിഡിഎഫ് പതിപ്പ്:+document_properties_page_count=താളിന്റെ എണ്ണം:+document_properties_close=അടയ്ക്കുക# Tooltips and alt text for side panel toolbar buttons# (the _label strings are alt text for the buttons, the .title strings are@@ -68,6 +89,8 @@ toggle_sidebar.title=സൈഡ് ബാറിലേക്കു് മാറ്toggle_sidebar_label=സൈഡ് ബാറിലേക്കു് മാറ്റുകoutline.title=രേഖയുടെ ഔട്ട്ലൈന് കാണിയ്ക്കുകoutline_label=രേഖയുടെ ഔട്ട്ലൈന്+attachments.title=അറ്റാച്മെന്റുകള് കാണിയ്ക്കുക+attachments_label=അറ്റാച്മെന്റുകള്thumbs.title=തംബ്നെയിലുകള് കാണിയ്ക്കുകthumbs_label=തംബ്നെയിലുകള്findbar.title=രേഖയില് കണ്ടുപിടിയ്ക്കുക@@ -96,6 +119,7 @@ find_not_found=വാചകം കണ്ടെത്താനായില്ല\# Error panel labelserror_more_info=കൂടുതല് വിവരംerror_less_info=കുറച്ച് വിവരം+error_close=അടയ്ക്കുക# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be# replaced by the PDF.JS version and build ID.error_version_info=PDF.js v{{version}} (build: {{build}})diff --git a/data/ext/viewerPDF/web/locale/mr/viewer.properties b/data/ext/viewerPDF/web/locale/mr/viewer.propertiesindex fafcf754b..0e6f72ff6 100644--- a/data/ext/viewerPDF/web/locale/mr/viewer.properties+++ b/data/ext/viewerPDF/web/locale/mr/viewer.properties@@ -140,6 +140,8 @@ page_scale_width=पृष्ठाची रूंदीpage_scale_fit=पृष्ठ बसवाpage_scale_auto=स्वयं लाहन किंवा मोठे करणेpage_scale_actual=प्रत्यक्ष आकार+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.# Loading indicator messagesloading_error_indicator=त्रुटीdiff --git a/data/ext/viewerPDF/web/locale/ms/viewer.properties b/data/ext/viewerPDF/web/locale/ms/viewer.propertiesindex e110e0028..fd15e5d00 100644--- a/data/ext/viewerPDF/web/locale/ms/viewer.properties+++ b/data/ext/viewerPDF/web/locale/ms/viewer.properties@@ -89,6 +89,8 @@ toggle_sidebar.title=Togol Bar Sisitoggle_sidebar_label=Togol Bar Sisioutline.title=Tunjuk Rangka Dokumenoutline_label=Rangka Dokument+attachments.title=Tunjuk Lampiran+attachments_label=Lampiranthumbs.title=Tunjuk Imej kecilthumbs_label=Imej kecilfindbar.title=Cari didalam Dokumen@@ -138,6 +140,8 @@ page_scale_width=Lebar Halamanpage_scale_fit=Muat Halamanpage_scale_auto=Zoom Automatikpage_scale_actual=Saiz Sebenar+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.# Loading indicator messagesloading_error_indicator=Ralatdiff --git a/data/ext/viewerPDF/web/locale/my/viewer.properties b/data/ext/viewerPDF/web/locale/my/viewer.propertiesindex 721e0d019..18c69e936 100644--- a/data/ext/viewerPDF/web/locale/my/viewer.properties+++ b/data/ext/viewerPDF/web/locale/my/viewer.properties@@ -140,12 +140,15 @@ page_scale_width=စာမျက်နှာ အကျယ်page_scale_fit=စာမျက်နှာ ကွက်တိpage_scale_auto=အလိုအလျောက် ချုံ့ချဲ့page_scale_actual=အမှန်တကယ်ရှိတဲ့ အရွယ်+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.# Loading indicator messagesloading_error_indicator=အမှားloading_error=PDF ဖိုင် ကိုဆွဲတင်နေချိန်မှာ အမှားတစ်ခုတွေ့ရပါတယ်။invalid_file_error=မရသော သို့ ပျက်နေသော PDF ဖိုင်missing_file_error=PDF ပျောက်ဆုံး+unexpected_response_error=မမျှော်လင့်ထားသော ဆာဗာမှ ပြန်ကြားချက်# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/nb-NO/viewer.properties b/data/ext/viewerPDF/web/locale/nb-NO/viewer.propertiesindex e7380519a..9b3839fae 100644--- a/data/ext/viewerPDF/web/locale/nb-NO/viewer.properties+++ b/data/ext/viewerPDF/web/locale/nb-NO/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Sidebreddepage_scale_fit=Tilpass til sidenpage_scale_auto=Automatisk zoompage_scale_actual=Virkelig størrelse+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}} %# Loading indicator messagesloading_error_indicator=Feilloading_error=En feil oppstod ved lasting av PDF.invalid_file_error=Ugyldig eller skadet PDF-fil.missing_file_error=Manglende PDF-fil.+unexpected_response_error=Uventet serverrespons.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -160,4 +164,4 @@ password_cancel=Avbrytprinting_not_supported=Advarsel: Utskrift er ikke fullstendig støttet av denne nettleseren.printing_not_ready=Advarsel: PDF er ikke fullstendig innlastet for utskrift.web_fonts_disabled=Web-fonter er avslått: Kan ikke bruke innbundne PDF-fonter.-document_colors_disabled=PDF-dokumenter tillates ikke å bruke deres egne farger: \'Tillat sider å velge egne farger\' er deaktivert i nettleseren.+document_colors_disabled=PDF-dokumenter tillates ikke å bruke deres egne farger: 'Tillat sider å velge egne farger' er deaktivert i nettleseren.diff --git a/data/ext/viewerPDF/web/locale/nl/viewer.properties b/data/ext/viewerPDF/web/locale/nl/viewer.propertiesindex d5ed70aeb..e3b518305 100644--- a/data/ext/viewerPDF/web/locale/nl/viewer.properties+++ b/data/ext/viewerPDF/web/locale/nl/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Paginabreedtepage_scale_fit=Hele paginapage_scale_auto=Automatisch zoomenpage_scale_actual=Werkelijke grootte+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Foutloading_error=Er is een fout opgetreden bij het laden van de PDF.invalid_file_error=Ongeldig of beschadigd PDF-bestand.missing_file_error=PDF-bestand ontbreekt.+unexpected_response_error=Onverwacht serverantwoord.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/nn-NO/viewer.properties b/data/ext/viewerPDF/web/locale/nn-NO/viewer.propertiesindex 7b016f326..fc955bb5d 100644--- a/data/ext/viewerPDF/web/locale/nn-NO/viewer.properties+++ b/data/ext/viewerPDF/web/locale/nn-NO/viewer.properties@@ -146,6 +146,7 @@ loading_error_indicator=Feilloading_error=Ein feil oppstod ved lasting av PDF.invalid_file_error=Ugyldig eller korrupt PDF fil.missing_file_error=Manglande PDF-fil.+unexpected_response_error=Uventa tenarrespons.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -160,4 +161,4 @@ password_cancel=Avbrytprinting_not_supported=Åtvaring: Utskrift er ikkje fullstendig støtta av denne nettlesaren.printing_not_ready=Åtvaring: PDF ikkje fullstendig innlasta for utskrift.web_fonts_disabled=Vev-fontar er slått av: Kan ikkje bruka innbundne PDF-fontar.-document_colors_disabled=PDF-dokument har ikkje løyve til å bruka eigne fargar: \'Tillat sider å velja eigne fargar\' er slått av i nettlesaren.+document_colors_disabled=PDF-dokument har ikkje løyve til å bruka eigne fargar: 'Tillat sider å velja eigne fargar' er slått av i nettlesaren.diff --git a/data/ext/viewerPDF/web/locale/oc/viewer.properties b/data/ext/viewerPDF/web/locale/oc/viewer.propertiesindex f80fcef9e..a68637339 100644--- a/data/ext/viewerPDF/web/locale/oc/viewer.properties+++ b/data/ext/viewerPDF/web/locale/oc/viewer.properties@@ -140,6 +140,8 @@ page_scale_width=Largor plenapage_scale_fit=Pagina entièrapage_scale_auto=Zoom automaticpage_scale_actual=Talha vertadièra+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.# Loading indicator messagesloading_error_indicator=Errordiff --git a/data/ext/viewerPDF/web/locale/or/viewer.properties b/data/ext/viewerPDF/web/locale/or/viewer.propertiesindex 4706f82e9..39d296275 100644--- a/data/ext/viewerPDF/web/locale/or/viewer.properties+++ b/data/ext/viewerPDF/web/locale/or/viewer.properties@@ -146,6 +146,7 @@ loading_error_indicator=ତ୍ରୁଟିloading_error=PDF ଧାରଣ କରିବା ସମୟରେ ଏକ ତ୍ରୁଟି ଘଟିଲା।invalid_file_error=ଅବୈଧ କିମ୍ବା ତ୍ରୁଟିଯୁକ୍ତ PDF ଫାଇଲ।missing_file_error=ହଜିଯାଇଥିବା PDF ଫାଇଲ।+unexpected_response_error=ଅପ୍ରତ୍ୟାଶିତ ସର୍ଭର ଉତ୍ତର।# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/pa-IN/viewer.properties b/data/ext/viewerPDF/web/locale/pa-IN/viewer.propertiesindex 6eb5ca1db..fb26fc311 100644--- a/data/ext/viewerPDF/web/locale/pa-IN/viewer.properties+++ b/data/ext/viewerPDF/web/locale/pa-IN/viewer.properties@@ -35,7 +35,7 @@ print_label=ਪਰਿੰਟpresentation_mode.title=ਪਰਿਜੈਂਟੇਸ਼ਨ ਮੋਡ ਵਿੱਚ ਜਾਓpresentation_mode_label=ਪਰਿਜੈਂਟੇਸ਼ਨ ਮੋਡ-open_file.title=ਫਾਇਲ ਖੋਲ੍ਹੋ+open_file.title=ਫਾਈਲ ਖੋਲ੍ਹੋopen_file_label=ਖੋਲ੍ਹੋdownload.title=ਡਾਊਨਲੋਡdownload_label=ਡਾਊਨਲੋਡ@@ -65,10 +65,10 @@ hand_tool_disable_label=ਹੱਥ ਟੂਲ ਬੰਦ# Document properties dialog boxdocument_properties.title=…ਦਸਤਾਵੇਜ਼ ਵਿਸ਼ੇਸ਼ਤਾdocument_properties_label=…ਦਸਤਾਵੇਜ਼ ਵਿਸ਼ੇਸ਼ਤਾ-document_properties_file_name=ਫਾਇਲ ਨਾਂ:-document_properties_file_size=ਫਾਇਲ ਆਕਾਰ:-document_properties_kb={{size_kb}} KB ({{size_b}} bytes)-document_properties_mb={{size_mb}} MB ({{size_b}} bytes)+document_properties_file_name=ਫਾਈਲ ਨਾਂ:+document_properties_file_size=ਫਾਈਲ ਆਕਾਰ:+document_properties_kb={{size_kb}} KB ({{size_b}} ਬਾਈਟ)+document_properties_mb={{size_mb}} MB ({{size_b}} ਬਾਈਟ)document_properties_title=ਟਾਈਟਲ:document_properties_author=ਲੇਖਕ:document_properties_subject=ਵਿਸ਼ਾ:@@ -91,8 +91,8 @@ toggle_sidebar_label=ਬਾਹੀ ਬਦਲੋoutline.title=ਦਸਤਾਵੇਜ਼ ਆਉਟਲਾਈਨ ਵੇਖਾਓoutline_label=ਦਸਤਾਵੇਜ਼ ਆਉਟਲਾਈਨ-attachments.title=Show Attachments-attachments_label=Attachments+attachments.title=ਅਟੈਚਮੈਂਟ ਵੇਖਾਓ+attachments_label=ਅਟੈਚਮੈਂਟthumbs.title=ਥੰਮਨੇਲ ਵੇਖਾਓthumbs_label=ਥੰਮਨੇਲfindbar.title=ਦਸਤਾਵੇਜ਼ ਵਿੱਚ ਲੱਭੋ@@ -143,7 +143,7 @@ error_message=ਸੁਨੇਹਾ: {{message}}# trace.error_stack=ਸਟੈਕ: {{stack}}# LOCALIZATION NOTE (error_file): "{{file}}" will be replaced with a filename-error_file=ਫਾਇਲ: {{file}}+error_file=ਫਾਈਲ: {{file}}# LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line numbererror_line=ਲਾਈਨ: {{line}}rendering_error=ਸਫ਼ਾ ਰੈਡਰ ਕਰਨ ਦੇ ਦੌਰਾਨ ਗਲਤੀ ਆਈ ਹੈ।@@ -153,25 +153,29 @@ page_scale_width=ਸਫ਼ਾ ਚੌੜਾਈpage_scale_fit=ਸਫ਼ਾ ਫਿੱਟpage_scale_auto=ਆਟੋਮੈਟਿਕ ਜ਼ੂਮpage_scale_actual=ਆਟੋਮੈਟਿਕ ਆਕਾਰ+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messages# LOCALIZATION NOTE (error_line): "{{[percent}}" will be replaced with a percentageloading_error_indicator=ਗਲਤੀloading_error=PDF ਲੋਡ ਕਰਨ ਦੇ ਦੌਰਾਨ ਗਲਤੀ ਆਈ ਹੈ।-invalid_file_error=ਗਲਤ ਜਾਂ ਨਿਕਾਰਾ PDF ਫਾਇਲ ਹੈ।-missing_file_error=ਨਾ-ਮੌਜੂਦ PDF ਫਾਇਲ।+invalid_file_error=ਗਲਤ ਜਾਂ ਨਿਕਾਰਾ PDF ਫਾਈਲ ਹੈ।+missing_file_error=ਨਾ-ਮੌਜੂਦ PDF ਫਾਈਲ।+unexpected_response_error=ਅਣਜਾਣ ਸਰਵਰ ਜਵਾਬ।# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in# the PDF spec (32000-1:2008 Table 169 – Annotation types).# Some common types are e.g.: "Check", "Text", "Comment", "Note"text_annotation_type.alt=[{{type}} ਵਿਆਖਿਆ]-password_label=ਇਹ PDF ਫਾਇਲ ਖੋਲ੍ਹਣ ਲਈ ਪਾਸਵਰਡ ਦਿਉ।+password_label=ਇਹ PDF ਫਾਈਲ ਖੋਲ੍ਹਣ ਲਈ ਪਾਸਵਰਡ ਦਿਉ।password_invalid=ਗਲਤ ਪਾਸਵਰਡ। ਫੇਰ ਕੋਸ਼ਿਸ਼ ਕਰੋ ਜੀ।password_ok=ਠੀਕ ਹੈpassword_cancel=ਰੱਦ ਕਰੋprinting_not_supported=ਸਾਵਧਾਨ: ਇਹ ਬਰਾਊਜ਼ਰ ਪਰਿੰਟ ਕਰਨ ਲਈ ਪੂਰੀ ਤਰ੍ਹਾਂ ਸਹਾਇਕ ਨਹੀਂ ਹੈ।-printing_not_ready=ਸਾਵਧਾਨ: ਪੀਡੀਐਫ(PDF) ਪਰਿੰਟ ਕਰਨ ਲਈ ਪੂਰੀ ਤਰ੍ਹਾਂ ਲੋਡ ਨਹੀਂ ਹੈ।-web_fonts_disabled=ਵੈਬ ਫੋਂਟ ਬੰਦ ਹਨ: ਇੰਬੈਡ ਪੀਡੀਐਫ (PDF) ਫੋਂਟ ਵਰਤਨ ਲਈ ਅਸਮਰੱਥ ਹੈ।-document_colors_disabled=PDF ਡੌਕੂਮੈਂਟ ਨੂੰ ਆਪਣੇ ਰੰਗ ਵਰਤਣ ਦੀ ਇਜ਼ਾਜ਼ਤ ਨਹੀਂ ਹੈ।: ਬਰਾਊਜ਼ਰ ਵਿੱਚ \'ਸਫ਼ਿਆਂ ਨੂੰ ਆਪਣੇ ਰੰਗ ਵਰਤਣ ਦਿਉ\' ਨੂੰ ਬੰਦ ਕੀਤਾ ਹੋਇਆ ਹੈ।+printing_not_ready=ਸਾਵਧਾਨ: PDF ਪਰਿੰਟ ਕਰਨ ਲਈ ਪੂਰੀ ਤਰ੍ਹਾਂ ਲੋਡ ਨਹੀਂ ਹੈ।+web_fonts_disabled=ਵੈਬ ਫੋਂਟ ਬੰਦ ਹਨ: ਇੰਬੈਡ PDF ਫੋਂਟ ਵਰਤਨ ਲਈ ਅਸਮਰੱਥ ਹੈ।+document_colors_disabled=PDF ਡੌਕੂਮੈਂਟ ਨੂੰ ਆਪਣੇ ਰੰਗ ਵਰਤਣ ਦੀ ਇਜ਼ਾਜ਼ਤ ਨਹੀਂ ਹੈ।: ਬਰਾਊਜ਼ਰ ਵਿੱਚ \u0022ਸਫ਼ਿਆਂ ਨੂੰ ਆਪਣੇ ਰੰਗ ਵਰਤਣ ਦਿਉ\u0022 ਨੂੰ ਬੰਦ ਕੀਤਾ ਹੋਇਆ ਹੈ।\ No newline at end of filediff --git a/data/ext/viewerPDF/web/locale/pl/viewer.properties b/data/ext/viewerPDF/web/locale/pl/viewer.propertiesindex d603cfee9..143c52aef 100644--- a/data/ext/viewerPDF/web/locale/pl/viewer.properties+++ b/data/ext/viewerPDF/web/locale/pl/viewer.properties@@ -28,7 +28,7 @@ print.title=Drukowanieprint_label=Drukujdownload.title=Pobieraniedownload_label=Pobierz-bookmark.title=Bieżąca pozycja (skopiuj lub otwórz jako odnośnik w nowym oknie)+bookmark.title=Bieżąca pozycja (skopiuj lub otwórz jako odnośnik w nowym oknie)bookmark_label=Bieżąca pozycjatools.title=Tools@@ -39,9 +39,9 @@ first_page_label=Przejdź do pierwszej stronylast_page.title=Przechodzenie do ostatniej stronylast_page.label=Przejdź do ostatniej stronylast_page_label=Przejdź do ostatniej strony-page_rotate_cw.title=Obracanie zgodnie z ruchem wskazówek zegara-page_rotate_cw.label=Obróć zgodnie z ruchem wskazówek zegara-page_rotate_cw_label=Obróć zgodnie z ruchem wskazówek zegara+page_rotate_cw.title=Obracanie zgodnie z ruchem wskazówek zegara+page_rotate_cw.label=Obróć zgodnie z ruchem wskazówek zegara+page_rotate_cw_label=Obróć zgodnie z ruchem wskazówek zegarapage_rotate_ccw.title=Obracanie przeciwnie do ruchu wskazówek zegarapage_rotate_ccw.label=Obróć przeciwnie do ruchu wskazówek zegarapage_rotate_ccw_label=Obróć przeciwnie do ruchu wskazówek zegara@@ -81,7 +81,7 @@ attachments.title=Wyświetlanie załącznikówattachments_label=Załącznikithumbs.title=Wyświetlanie miniaturekthumbs_label=Miniaturki-findbar.title=Znajdź w dokumencie+findbar.title=Znajdź w dokumenciefindbar_label=Znajdź# Thumbnails panel item (tooltip and alt text for images)@@ -128,12 +128,13 @@ page_scale_width=Szerokość stronypage_scale_fit=Dopasowanie stronypage_scale_auto=Skala automatycznapage_scale_actual=Rozmiar rzeczywisty+page_scale_percent={{scale}}%-# Loading indicator messagesloading_error_indicator=Błądloading_error=Podczas wczytywania dokumentu PDF wystąpił błąd.invalid_file_error=Nieprawidłowy lub uszkodzony plik PDF.missing_file_error=Brak pliku PDF.+unexpected_response_error=Nieoczekiwana odpowiedź serwera.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -145,7 +146,7 @@ password_invalid=Nieprawidłowe hasło. Proszę spróbować ponownie.password_ok=OKpassword_cancel=Anuluj-printing_not_supported=Ostrzeżenie: Drukowanie nie jest w pełni wspierane przez przeglądarkę.+printing_not_supported=Ostrzeżenie: Drukowanie nie jest w pełni wspierane przez przeglądarkę.printing_not_ready=Ostrzeżenie: Dokument PDF nie jest całkowicie wczytany, więc nie można go wydrukować.web_fonts_disabled=Czcionki sieciowe są wyłączone: nie można użyć osadzonych czcionek PDF.-document_colors_disabled=Dokumenty PDF nie mogą używać własnych kolorów: Opcja „Pozwalaj stronom stosować inne kolory” w przeglądarce jest nieaktywna.+document_colors_disabled=Dokumenty PDF nie mogą używać własnych kolorów: Opcja „Pozwalaj stronom stosować inne kolory” w przeglądarce jest nieaktywna.diff --git a/data/ext/viewerPDF/web/locale/pt-BR/viewer.properties b/data/ext/viewerPDF/web/locale/pt-BR/viewer.propertiesindex ec40786f2..dbd826c5d 100644--- a/data/ext/viewerPDF/web/locale/pt-BR/viewer.properties+++ b/data/ext/viewerPDF/web/locale/pt-BR/viewer.properties@@ -67,8 +67,8 @@ document_properties.title=Propriedades do documento…document_properties_label=Propriedades do documento…document_properties_file_name=Nome do arquivo:document_properties_file_size=Tamanho do arquivo:-document_properties_kb={{size_kb}}\u202fKB ({{size_b}} bytes)-document_properties_mb={{size_mb}}\u202fMB ({{size_b}} bytes)+document_properties_kb={{size_kb}} KB ({{size_b}} bytes)+document_properties_mb={{size_mb}} MB ({{size_b}} bytes)document_properties_title=Título:document_properties_author=Autor:document_properties_subject=Assunto:@@ -140,12 +140,15 @@ page_scale_width=Largura da páginapage_scale_fit=Ajustar à janelapage_scale_auto=Zoom automáticopage_scale_actual=Tamanho real+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.# Loading indicator messagesloading_error_indicator=Erroloading_error=Ocorreu um erro ao carregar o PDF.invalid_file_error=Arquivo PDF corrompido ou inválido.missing_file_error=Arquivo PDF ausente.+unexpected_response_error=Resposta inesperada do servidor.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/pt-PT/viewer.properties b/data/ext/viewerPDF/web/locale/pt-PT/viewer.propertiesindex 1258cfb66..7a83edfac 100644--- a/data/ext/viewerPDF/web/locale/pt-PT/viewer.properties+++ b/data/ext/viewerPDF/web/locale/pt-PT/viewer.properties@@ -57,10 +57,10 @@ page_rotate_ccw.title=Rodar à esquerdapage_rotate_ccw.label=Rodar à esquerdapage_rotate_ccw_label=Rodar à esquerda-hand_tool_enable.title=Ativar ferramenta Mão-hand_tool_enable_label=Ativar ferramenta Mão-hand_tool_disable.title=Desativar ferramenta Mão-hand_tool_disable_label=Desativar ferramenta Mão+hand_tool_enable.title=Ativar ferramenta de mão+hand_tool_enable_label=Ativar ferramenta de mão+hand_tool_disable.title=Desativar ferramenta de mão+hand_tool_disable_label=Desativar ferramenta de mão# Document properties dialog boxdocument_properties.title=Propriedades do documento...@@ -140,12 +140,16 @@ page_scale_width=Ajustar à largurapage_scale_fit=Ajustar à páginapage_scale_auto=Tamanho automáticopage_scale_actual=Tamanho real+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Erroloading_error=Ocorreu um erro ao carregar o PDF.invalid_file_error=Ficheiro PDF inválido ou danificado.missing_file_error=Ficheiro PDF inexistente.+unexpected_response_error=Resposta inesperada do servidor.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -160,4 +164,4 @@ password_cancel=Cancelarprinting_not_supported=Aviso: a impressão não é totalmente suportada por este navegador.printing_not_ready=Aviso: o PDF ainda não está totalmente carregado.web_fonts_disabled=Os tipos de letra web estão desativados: não é possível utilizar os tipos de letra PDF incorporados.-document_colors_disabled=Os documentos PDF não permitem a utilização das suas próprias cores: \'Autorizar as páginas a escolher as suas próprias cores\' está desativado no navegador.+document_colors_disabled=Os documentos PDF não permitem a utilização das suas próprias cores: Autorizar as páginas a escolher as suas próprias cores está desativado no navegador.diff --git a/data/ext/viewerPDF/web/locale/rm/viewer.properties b/data/ext/viewerPDF/web/locale/rm/viewer.propertiesindex 924f51e2a..69a20d930 100644--- a/data/ext/viewerPDF/web/locale/rm/viewer.properties+++ b/data/ext/viewerPDF/web/locale/rm/viewer.properties@@ -130,12 +130,16 @@ page_scale_width=Ladezza da la paginapage_scale_fit=Entira paginapage_scale_auto=Zoom automaticpage_scale_actual=Grondezza actuala+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Errurloading_error=Ina errur è cumparida cun chargiar il PDF.invalid_file_error=Datoteca PDF nunvalida u donnegiada.missing_file_error=Datoteca PDF manconta.+unexpected_response_error=Resposta nunspetgada dal server.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/ro/viewer.properties b/data/ext/viewerPDF/web/locale/ro/viewer.propertiesindex 20d2d95f7..412ca731d 100644--- a/data/ext/viewerPDF/web/locale/ro/viewer.properties+++ b/data/ext/viewerPDF/web/locale/ro/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Lățime paginăpage_scale_fit=Potrivire la paginăpage_scale_auto=Dimensiune automatăpage_scale_actual=Dimensiune reală+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Eroareloading_error=A intervenit o eroare la încărcarea fișierului PDF.invalid_file_error=Fișier PDF invalid sau deteriorat.missing_file_error=Fișier PDF lipsă.+unexpected_response_error=Răspuns neașteptat de la server.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -154,7 +158,7 @@ missing_file_error=Fișier PDF lipsă.text_annotation_type.alt=[{{type}} Adnotare]password_label=Introduceți parola pentru a deschide acest fişier PDF.password_invalid=Parolă greșită. Vă rugăm încercați din nou.-password_ok=OK+password_ok=Okpassword_cancel=Renunțăprinting_not_supported=Atenție: Tipărirea nu este suportată în totalitate de acest navigator.diff --git a/data/ext/viewerPDF/web/locale/ru/viewer.properties b/data/ext/viewerPDF/web/locale/ru/viewer.propertiesindex b2de0fe69..349f2cbec 100644--- a/data/ext/viewerPDF/web/locale/ru/viewer.properties+++ b/data/ext/viewerPDF/web/locale/ru/viewer.properties@@ -94,10 +94,12 @@ page_scale_width = По ширине страницыpage_scale_fit = По размеру страницыpage_scale_auto = Автоматическиpage_scale_actual = Реальный размер+page_scale_percent = {{scale}}%loading_error_indicator = Ошибкаloading_error = При загрузке PDF произошла ошибка.invalid_file_error = Некорректный или повреждённый PDF-файл.missing_file_error = PDF-файл отсутствует.+unexpected_response_error = Неожиданный ответ сервера.text_annotation_type.alt = [Аннотация {{type}}]password_label = Введите пароль, чтобы открыть этот PDF-файл.password_invalid = Неверный пароль. Пожалуйста, попробуйте снова.diff --git a/data/ext/viewerPDF/web/locale/rw/viewer.properties b/data/ext/viewerPDF/web/locale/rw/viewer.propertiesindex 993c48483..ec4352dc4 100644--- a/data/ext/viewerPDF/web/locale/rw/viewer.properties+++ b/data/ext/viewerPDF/web/locale/rw/viewer.properties@@ -13,111 +13,60 @@# limitations under the License.# Main toolbar buttons (tooltips and alt text for images)-previous.title=Previous Page-previous_label=Previous-next.title=Next Page-next_label=Next# LOCALIZATION NOTE (page_label, page_of):# These strings are concatenated to form the "Page: X of Y" string.# Do not translate "{{pageCount}}", it will be substituted with a number# representing the total number of pages.-page_label=Page:-page_of=of {{pageCount}}-zoom_out.title=Zoom Out-zoom_out_label=Zoom Out-zoom_in.title=Zoom In-zoom_in_label=Zoom Inzoom.title=Ihindurangano-print.title=Print-print_label=Print-presentation_mode.title=Switch to Presentation Mode-presentation_mode_label=Presentation Modeopen_file.title=Gufungura Dosiyeopen_file_label=Gufungura-download.title=Download-download_label=Download-bookmark.title=Current view (copy or open in new window)-bookmark_label=Current View++# Secondary toolbar and context menu+++# Document properties dialog box+document_properties_title=Umutwe:# Tooltips and alt text for side panel toolbar buttons# (the _label strings are alt text for the buttons, the .title strings are# tooltips)-toggle_sidebar.title=Toggle Sidebar-toggle_sidebar_label=Toggle Sidebar-outline.title=Show Document Outline-outline_label=Document Outline-thumbs.title=Show Thumbnails-thumbs_label=Thumbnails-findbar.title=Find in Documentfindbar_label=Gushakisha# Thumbnails panel item (tooltip and alt text for images)# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page# number.-thumb_page_title=Page {{page}}# LOCALIZATION NOTE (thumb_page_canvas): "{{page}}" will be replaced by the page# number.-thumb_page_canvas=Thumbnail of Page {{page}}--# Context menu-first_page.label=Go to First Page-last_page.label=Go to Last Page-page_rotate_cw.label=Rotate Clockwise-page_rotate_ccw.label=Rotate Counterclockwise# Find panel button title and messagesfind_label="Gushaka:"find_previous.title=Gushaka aho uyu murongo ugaruka mbere y'aha-find_previous_label=Previousfind_next.title=Gushaka aho uyu murongo wongera kugaruka-find_next_label=Next-find_highlight=Highlight all-find_match_case_label=Match case-find_reached_top=Reached top of document, continued from bottom-find_reached_bottom=Reached end of document, continued from topfind_not_found=Umurongo ntubonetse# Error panel labels-error_more_info=More Information-error_less_info=Less Information-error_close=Gufunga# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be# replaced by the PDF.JS version and build ID.-error_version_info=PDF.js v{{version}} (build: {{build}})# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an# english string describing the error.-error_message=Message: {{message}}# LOCALIZATION NOTE (error_stack): "{{stack}}" will be replaced with a stack# trace.-error_stack=Stack: {{stack}}# LOCALIZATION NOTE (error_file): "{{file}}" will be replaced with a filename-error_file=File: {{file}}# LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line number-error_line=Line: {{line}}-rendering_error=An error occurred while rendering the page.# Predefined zoom values-page_scale_width=Page Width-page_scale_fit=Page Fit-page_scale_auto=Automatic Zoom-page_scale_actual=Actual Size+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.# Loading indicator messagesloading_error_indicator=Ikosa-loading_error=An error occurred while loading the PDF.-invalid_file_error=Invalid or corrupted PDF file.-missing_file_error=Missing PDF file.-# LOCALIZATION NOTE (text_annotation_type): This is used as a tooltip.+# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in# the PDF spec (32000-1:2008 Table 169 – Annotation types).# Some common types are e.g.: "Check", "Text", "Comment", "Note"-text_annotation_type=[{{type}} Annotation]-request_password=PDF is protected by a password:+password_ok=YEGO+password_cancel=Kureka-printing_not_supported=Warning: Printing is not fully supported by this browser.-printing_not_ready=Warning: The PDF is not fully loaded for printing.-web_fonts_disabled=Web fonts are disabled: unable to use embedded PDF fonts.-web_colors_disabled=Web colors are disabled.diff --git a/data/ext/viewerPDF/web/locale/sah/viewer.properties b/data/ext/viewerPDF/web/locale/sah/viewer.propertiesindex 49d1f49ba..1b844d68f 100644--- a/data/ext/viewerPDF/web/locale/sah/viewer.properties+++ b/data/ext/viewerPDF/web/locale/sah/viewer.properties@@ -42,10 +42,44 @@ bookmark.title=Билиҥҥи көстүүтэ (хатылаа эбэтэр саbookmark_label=Билиҥҥи көстүүтэ# Secondary toolbar and context menu+tools.title=Тэриллэр+tools_label=Тэриллэр+first_page.title=Бастакы сирэйгэ көс+first_page.label=Бастакы сирэйгэ көс+first_page_label=Бастакы сирэйгэ көс+last_page.title=Тиһэх сирэйгэ көс+last_page.label=Тиһэх сирэйгэ көс+last_page_label=Тиһэх сирэйгэ көс+page_rotate_cw.title=Чаһы хоту эргит+page_rotate_cw.label=Чаһы хоту эргит+page_rotate_cw_label=Чаһы хоту эргит+page_rotate_ccw.title=Чаһы утары эргит+page_rotate_ccw.label=Чаһы утары эргит+page_rotate_ccw_label=Чаһы утары эргит+hand_tool_enable.title=«Илии» диэн тэрили холбоо+hand_tool_enable_label=«Илии» диэн тэрили холбоо+hand_tool_disable.title=«Илии» диэн тэрили араар+hand_tool_disable_label=«Илии» диэн тэрили араар# Document properties dialog box+document_properties.title=Докумуон туруоруулара...+document_properties_label=Докумуон туруоруулара...\u0020+document_properties_file_name=Билэ аата:+document_properties_file_size=Билэ кээмэйэ:+document_properties_kb={{size_kb}} КБ ({{size_b}} баайт)+document_properties_mb={{size_mb}} МБ ({{size_b}} баайт)document_properties_title=Баһа:+document_properties_author=Ааптар:+document_properties_subject=Тиэмэ:+document_properties_keywords=Күлүүс тыл:+document_properties_creation_date=Оҥоһуллубут кэмэ:+document_properties_modification_date=Уларытыллыбыт кэмэ:+document_properties_date_string={{date}}, {{time}}+document_properties_producer=PDF оҥорооччу:+document_properties_version=PDF барыла:+document_properties_page_count=Сирэй ахсаана:+document_properties_close=Сап# Tooltips and alt text for side panel toolbar buttons# (the _label strings are alt text for the buttons, the .title strings are@@ -54,6 +88,8 @@ toggle_sidebar.title=Ойоҕос хапталы арый/сапtoggle_sidebar_label=Ойоҕос хапталы арый/сапoutline.title=Дөкүмүөн иһинээҕитин көрдөрoutline_label=Дөкүмүөн иһинээҕитэ+attachments.title=Кыбытыктары көрдөр+attachments_label=Кыбытыкthumbs.title=Ойуучааннары көрдөрthumbs_label=Ойуучааннарfindbar.title=Дөкүмүөнтэн бул@@ -82,6 +118,7 @@ find_not_found=Этии көстүбэтэ# Error panel labelserror_more_info=Сиһилииerror_less_info=Сиһилиитин кистээ+error_close=Сап# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be# replaced by the PDF.JS version and build ID.error_version_info=PDF.js v{{version}} (хомуйуута: {{build}})@@ -108,12 +145,16 @@ loading_error_indicator=Алҕасloading_error=PDF-билэни хачайдыырга алҕас таҕыста.invalid_file_error=Туох эрэ алҕастаах эбэтэр алдьаммыт PDF-билэ.missing_file_error=PDF-билэ суох.+unexpected_response_error=Сиэрбэр хоруйдаабат.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in# the PDF spec (32000-1:2008 Table 169 – Annotation types).# Some common types are e.g.: "Check", "Text", "Comment", "Note"text_annotation_type.alt=[{{type}} туһунан]+password_label=Бу PDF-билэни арыйарга көмүскэл тылы киллэриэхтээхин.+password_invalid=Киирии тыл алҕастаах. Бука диэн, хатылаан көр.+password_ok=СӨПpassword_cancel=Салҕаамаprinting_not_supported=Сэрэтии: Бу браузер бэчээттиири толору өйөөбөт.diff --git a/data/ext/viewerPDF/web/locale/si/viewer.properties b/data/ext/viewerPDF/web/locale/si/viewer.propertiesindex 01145ce22..060c12db8 100644--- a/data/ext/viewerPDF/web/locale/si/viewer.properties+++ b/data/ext/viewerPDF/web/locale/si/viewer.properties@@ -14,7 +14,9 @@# Main toolbar buttons (tooltips and alt text for images)previous.title=මීට පෙර පිටුව+previous_label=පෙරnext.title=මීළඟ පිටුව+next_label=මීළඟ# LOCALIZATION NOTE (page_label, page_of):# These strings are concatenated to form the "Page: X of Y" string.@@ -28,6 +30,8 @@ zoom_out_label=කුඩා කරන්නzoom_in.title=විශාල කරන්නzoom_in_label=විශාල කරන්නzoom.title=විශාලණය+presentation_mode.title=ඉදිරිපත්කිරීම් ප්රකාරය වෙත මාරුවන්න+presentation_mode_label=ඉදිරිපත්කිරීම් ප්රකාරයopen_file.title=ගොනුව විවෘත කරන්නopen_file_label=විවෘත කරන්නprint.title=මුද්රණය@@ -38,18 +42,58 @@ bookmark.title=දැනට ඇති දසුන (පිටපත් කරනbookmark_label=දැනට ඇති දසුන# Secondary toolbar and context menu+tools.title=මෙවලම්+tools_label=මෙවලම්+first_page.title=මුල් පිටුවට යන්න+first_page.label=මුල් පිටුවට යන්න+first_page_label=මුල් පිටුවට යන්න+last_page.title=අවසන් පිටුවට යන්න+last_page.label=අවසන් පිටුවට යන්න+last_page_label=අවසන් පිටුවට යන්න+page_rotate_cw.title=දක්ශිණාවර්තව භ්රමණය+page_rotate_cw.label=දක්ශිණාවර්තව භ්රමණය+page_rotate_cw_label=දක්ශිණාවර්තව භ්රමණය+page_rotate_ccw.title=වාමාවර්තව භ්රමණය+page_rotate_ccw.label=වාමාවර්තව භ්රමණය+page_rotate_ccw_label=වාමාවර්තව භ්රමණය+hand_tool_enable.title=හස්ත මෙවලම සක්රීය+hand_tool_enable_label=හස්ත මෙවලම සක්රීය+hand_tool_disable.title=හස්ත මෙවලම අක්රීය+hand_tool_disable_label=හස්ත මෙවලම අක්රීය# Document properties dialog box+document_properties.title=ලේඛන වත්කම්...+document_properties_label=ලේඛන වත්කම්...+document_properties_file_name=ගොනු නම:+document_properties_file_size=ගොනු ප්රමාණය:+document_properties_kb={{size_kb}} KB ({{size_b}} බයිට)+document_properties_mb={{size_mb}} MB ({{size_b}} බයිට)document_properties_title=සිරස්තලය:+document_properties_author=කතෲ+document_properties_subject=මාතෘකාව:+document_properties_keywords=යතුරු වදන්:+document_properties_creation_date=නිර්මිත දිනය:+document_properties_modification_date=වෙනස්කල දිනය:+document_properties_date_string={{date}}, {{time}}+document_properties_creator=නිර්මාපක:+document_properties_producer=PDF නිශ්පාදක:+document_properties_version=PDF නිකුතුව:+document_properties_page_count=පිටු ගණන:+document_properties_close=වසන්න# Tooltips and alt text for side panel toolbar buttons# (the _label strings are alt text for the buttons, the .title strings are# tooltips)+toggle_sidebar.title=පැති තීරුවට මාරුවන්න+toggle_sidebar_label=පැති තීරුවට මාරුවන්නoutline.title=ලේඛනයේ පිට මායිම පෙන්වන්නoutline_label=ලේඛනයේ පිට මායිම+attachments.title=ඇමිණුම් පෙන්වන්න+attachments_label=ඇමිණුම්thumbs.title=සිඟිති රූ පෙන්වන්නthumbs_label=සිඟිති රූ+findbar.title=ලේඛනය තුළ සොයන්නfindbar_label=සොයන්න# Thumbnails panel item (tooltip and alt text for images)@@ -61,15 +105,24 @@ thumb_page_title=පිටුව {{page}}thumb_page_canvas=පිටුවෙ සිඟිත රූව {{page}}# Find panel button title and messages+find_label=සොයන්න:find_previous.title=මේ වාක්ය ඛණ්ඩය මීට පෙර යෙදුණු ස්ථානය සොයන්න+find_previous_label=පෙර:find_next.title=මේ වාක්ය ඛණ්ඩය මීළඟට යෙදෙන ස්ථානය සොයන්න+find_next_label=මීළඟ+find_highlight=සියල්ල උද්දීපනය+find_match_case_label=අකුරු ගළපන්න+find_reached_top=පිටුවේ ඉහළ කෙළවරට ලගාවිය, පහළ සිට ඉදිරියට යමින්+find_reached_bottom=පිටුවේ පහළ කෙළවරට ලගාවිය, ඉහළ සිට ඉදිරියට යමින්find_not_found=ඔබ සෙව් වචන හමු නොවීය# Error panel labelserror_more_info=බොහෝ තොරතුරුerror_less_info=අවම තොරතුරු+error_close=වසන්න# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be# replaced by the PDF.JS version and build ID.+error_version_info=PDF.js v{{version}} (නිකුතුව: {{build}})# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an# english string describing the error.error_message=පණිවිඩය: {{message}}@@ -87,16 +140,28 @@ page_scale_width=පිටුවේ පළලpage_scale_fit=පිටුවට සුදුසු ලෙසpage_scale_auto=ස්වයංක්රීය විශාලණයpage_scale_actual=නියමිත ප්රමාණය+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=දෝෂයloading_error=PDF පූරණය විමේදි දෝෂයක් හට ගැනුණි.+invalid_file_error=දූශිත හෝ සාවද්ය PDF ගොනුව.+missing_file_error=නැතිවූ PDF ගොනුව.+unexpected_response_error=බලාපොරොත්තු නොවූ සේවාදායක ප්රතිචාරය.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in# the PDF spec (32000-1:2008 Table 169 – Annotation types).# Some common types are e.g.: "Check", "Text", "Comment", "Note"text_annotation_type.alt=[{{type}} විස්තරය]+password_label=මෙම PDF ගොනුව විවෘත කිරීමට මුරපදය ඇතුළත් කරන්න.+password_invalid=වැරදි මුරපදයක්. කරුණාකර නැවත උත්සහ කරන්න.password_ok=හරිpassword_cancel=එපා+printing_not_supported=අවවාදයයි: මෙම ගවේශකය මුද්රණය සඳහා සම්පූර්ණයෙන් සහය නොදක්වයි.+printing_not_ready=අවවාදයයි: මුද්රණය සඳහා PDF සම්පූර්ණයෙන් පූර්ණය වී නොමැත.+web_fonts_disabled=ජාල අකුරු අක්රීයයි: තිළැලි PDF අකුරු භාවිත කළ නොහැක.+document_colors_disabled=PDF ලේඛනයට ඔවුන්ගේම වර්ණ භාවිතයට ඉඩ නොලැබේ: 'පිටු වෙත ඔවුන්ගේම වර්ණ භාවිතයට ඉඩදෙන්න' ගවේශකය මත අක්රීය කර ඇත.diff --git a/data/ext/viewerPDF/web/locale/sk/viewer.properties b/data/ext/viewerPDF/web/locale/sk/viewer.propertiesindex 78cb61be0..5a9d1a8a6 100644--- a/data/ext/viewerPDF/web/locale/sk/viewer.properties+++ b/data/ext/viewerPDF/web/locale/sk/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Na šírku stranypage_scale_fit=Na veľkosť stranypage_scale_auto=Automatická veľkosťpage_scale_actual=Skutočná veľkosť+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Chybaloading_error=Počas načítavania dokumentu PDF sa vyskytla chyba.invalid_file_error=Neplatný alebo poškodený súbor PDF.missing_file_error=Chýbajúci súbor PDF.+unexpected_response_error=Neočakávaná odpoveď zo servera.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -160,4 +164,4 @@ password_cancel=Zrušiťprinting_not_supported=Upozornenie: tlač nie je v tomto prehliadači plne podporovaná.printing_not_ready=Upozornenie: súbor PDF nie je plne načítaný pre tlač.web_fonts_disabled=Webové písma sú vypnuté: nie je možné použiť písma vložené do súboru PDF.-document_colors_disabled=Dokumenty PDF nemajú povolené používať vlastné farby, pretože voľba \'Povoliť stránkam používať vlastné farby\' je v nastaveniach prehliadača vypnutá.+document_colors_disabled=Dokumenty PDF nemajú povolené používať vlastné farby, pretože voľba "Povoliť stránkam používať vlastné farby" je v nastaveniach prehliadača vypnutá.diff --git a/data/ext/viewerPDF/web/locale/sl/viewer.properties b/data/ext/viewerPDF/web/locale/sl/viewer.propertiesindex cda7d3313..bdc7fff84 100644--- a/data/ext/viewerPDF/web/locale/sl/viewer.properties+++ b/data/ext/viewerPDF/web/locale/sl/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Širina stranipage_scale_fit=Prilagodi stranpage_scale_auto=Samodejnopage_scale_actual=Dejanska velikost+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}} %# Loading indicator messagesloading_error_indicator=Napakaloading_error=Med nalaganjem datoteke PDF je prišlo do napake.invalid_file_error=Neveljavna ali pokvarjena datoteka PDF.missing_file_error=Ni datoteke PDF.+unexpected_response_error=Nepričakovan odgovor strežnika.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -160,4 +164,4 @@ password_cancel=Prekličiprinting_not_supported=Opozorilo: ta brskalnik ne podpira vseh možnosti tiskanja.printing_not_ready=Opozorilo: PDF ni v celoti naložen za tiskanje.web_fonts_disabled=Spletne pisave so onemogočene: vgradnih pisav za PDF ni mogoče uporabiti.-document_colors_disabled=Dokumenti PDF ne smejo uporabljati svojih lastnih barv: možnost \'Dovoli stranem uporabo lastnih barv\' je v brskalniku onemogočena.+document_colors_disabled=Dokumenti PDF ne smejo uporabljati svojih lastnih barv: možnost 'Dovoli stranem uporabo lastnih barv' je v brskalniku onemogočena.diff --git a/data/ext/viewerPDF/web/locale/son/viewer.properties b/data/ext/viewerPDF/web/locale/son/viewer.propertiesindex 54a6d2675..23f23bfb5 100644--- a/data/ext/viewerPDF/web/locale/son/viewer.properties+++ b/data/ext/viewerPDF/web/locale/son/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Mooo hayyanpage_scale_fit=Moo sawayanpage_scale_auto=Boŋše azzaati barmayyanpage_scale_actual=Adadu cimi+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Firkaloading_error=Firka bangay kaŋ PDF goo ma zumandi.invalid_file_error=PDF tuku laala wala laybante.missing_file_error=PDF tuku kumante.+unexpected_response_error=Manti feršikaw tuuruyan maatante.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/sq/viewer.properties b/data/ext/viewerPDF/web/locale/sq/viewer.propertiesindex 416d2c4ca..8d17d7777 100644--- a/data/ext/viewerPDF/web/locale/sq/viewer.properties+++ b/data/ext/viewerPDF/web/locale/sq/viewer.properties@@ -137,6 +137,9 @@ page_scale_width=Gjerësi Faqejepage_scale_fit=Sa Nxë Faqjapage_scale_auto=Zoom i Vetvetishëmpage_scale_actual=Madhësia Faktike+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messages# LOCALIZATION NOTE (error_line): "{{[percent}}" will be replaced with a percentage@@ -144,6 +147,7 @@ loading_error_indicator=Gabimloading_error=Ndodhi një gabim gjatë ngarkimit të PDF-së.invalid_file_error=Kartelë PDF e pavlefshme ose e dëmtuar.missing_file_error=Kartelë PDF që mungon.+unexpected_response_error=Përgjigje shërbyesi e papritur.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -158,4 +162,4 @@ password_cancel=Anulojeprinting_not_supported=Kujdes: Shtypja nuk mbulohet plotësisht nga ky shfletues.printing_not_ready=Kujdes: PDF-ja nuk është ngarkuar plotësisht që ta shtypni.web_fonts_disabled=Shkronjat Web janë të çaktivizuara: i pazoti të përdorë shkronja të trupëzuara në PDF.-document_colors_disabled=Dokumenteve PDF nuk u është lejuar të përdorin ngjyrat e veta: \'Lejoji faqet t'i zgjedhin vetë ngjyrat\', te shfletuesi, është e çaktivizuar.+document_colors_disabled=Dokumenteve PDF nuk u është lejuar të përdorin ngjyrat e veta: 'Lejoji faqet t'i zgjedhin vetë ngjyrat', te shfletuesi, është e çaktivizuar.diff --git a/data/ext/viewerPDF/web/locale/sr/viewer.properties b/data/ext/viewerPDF/web/locale/sr/viewer.propertiesindex 7618b75ec..0603d8875 100644--- a/data/ext/viewerPDF/web/locale/sr/viewer.properties+++ b/data/ext/viewerPDF/web/locale/sr/viewer.properties@@ -140,19 +140,23 @@ page_scale_width=Ширина страницеpage_scale_fit=Уклапање страницеpage_scale_auto=Аутоматско увеличавањеpage_scale_actual=Стварна величина+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Грешка-loading_error=Дошло је до грешке приликом учитавање PDF.+loading_error=Дошло је до грешке приликом учитавања PDF-а.invalid_file_error=PDF датотека је оштећена или је неисправна.missing_file_error=PDF датотека није пронађена.+unexpected_response_error=Неочекиван одговор од сервера.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in# the PDF spec (32000-1:2008 Table 169 – Annotation types).# Some common types are e.g.: "Check", "Text", "Comment", "Note"text_annotation_type.alt=[{{type}} коментар]-password_label=_Унесите лозинку да бисте отворили овај PDF докуменат.+password_label=Унесите лозинку да бисте отворили овај PDF докуменат.password_invalid=Неисправна лозинка. Покушајте поново.password_ok=У редуpassword_cancel=Откажи@@ -160,4 +164,4 @@ password_cancel=Откажиprinting_not_supported=Упозорење: Штампање није у потпуности подржано у овом прегледачу.printing_not_ready=Упозорење: PDF није у потпуности учитан за штампу.web_fonts_disabled=Веб фонтови су онемогућени: не могу користити уграђене PDF фонтове.-document_colors_disabled=PDF документи не могу да користе сопствене боје: \'Дозволи страницама да одаберу своје боје\' је деактивирано у прегледачу.+document_colors_disabled=PDF документи не могу да користе сопствене боје: “Дозволи страницама да изаберу своје боје” је деактивирано у прегледачу.diff --git a/data/ext/viewerPDF/web/locale/sv-SE/viewer.properties b/data/ext/viewerPDF/web/locale/sv-SE/viewer.propertiesindex a88edbd4f..4c9d0401c 100644--- a/data/ext/viewerPDF/web/locale/sv-SE/viewer.properties+++ b/data/ext/viewerPDF/web/locale/sv-SE/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Sidbreddpage_scale_fit=Anpassa sidapage_scale_auto=Automatisk zoompage_scale_actual=Verklig storlek+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Felloading_error=Ett fel uppstod vid laddning av PDF-filen.invalid_file_error=Ogiltig eller korrupt PDF-fil.missing_file_error=Saknad PDF-fil.+unexpected_response_error=Oväntat svar från servern.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/sw/viewer.properties b/data/ext/viewerPDF/web/locale/sw/viewer.propertiesindex 8f9f7dd84..88d0d3598 100644--- a/data/ext/viewerPDF/web/locale/sw/viewer.properties+++ b/data/ext/viewerPDF/web/locale/sw/viewer.properties@@ -102,6 +102,8 @@ page_scale_width=Upana wa Ukurasapage_scale_fit=Usawa wa Ukurasapage_scale_auto=Ukuzaji wa Kiotomatikipage_scale_actual=Ukubwa Halisi+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.# Loading indicator messagesloading_error_indicator=Hitilafudiff --git a/data/ext/viewerPDF/web/locale/ta/viewer.properties b/data/ext/viewerPDF/web/locale/ta/viewer.propertiesindex 8643a688d..787e278e1 100644--- a/data/ext/viewerPDF/web/locale/ta/viewer.properties+++ b/data/ext/viewerPDF/web/locale/ta/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=பக்க அகலம்page_scale_fit=பக்கப் பொருத்தம்page_scale_auto=தானியக்க பெரிதாக்கல்page_scale_actual=உண்மையான அளவு+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=பிழைloading_error=PDF ஐ ஏற்றும் போது ஒரு பிழை ஏற்பட்டது.invalid_file_error=செல்லுபடியாகாத அல்லது சிதைந்த PDF கோப்பு.missing_file_error=PDF கோப்பு காணவில்லை.+unexpected_response_error=சேவகன் பதில் எதிர்பாரதது.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/te/viewer.properties b/data/ext/viewerPDF/web/locale/te/viewer.propertiesindex f6bcdfa73..5b56cc4b5 100644--- a/data/ext/viewerPDF/web/locale/te/viewer.properties+++ b/data/ext/viewerPDF/web/locale/te/viewer.properties@@ -57,12 +57,28 @@ page_rotate_ccw.title=అపసవ్యదిశలో తిప్పుముpage_rotate_ccw.label=అపసవ్యదిశలో తిప్పుముpage_rotate_ccw_label=అపసవ్యదిశలో తిప్పుము+hand_tool_enable.title=చేతి సాధనం చేతనించు+hand_tool_enable_label=చేతి సాధనం చేతనించు+hand_tool_disable.title=చేతి సాధనం అచేతనించు+hand_tool_disable_label=చేతి సాధనం అచేతనించు# Document properties dialog box+document_properties.title=పత్రము లక్షణాలు...+document_properties_label=పత్రము లక్షణాలు...+document_properties_file_name=దస్త్రం పేరు:+document_properties_file_size=దస్త్రం పరిమాణం:+document_properties_kb={{size_kb}} KB ({{size_b}} bytes)+document_properties_mb={{size_mb}} MB ({{size_b}} bytes)document_properties_title=శీర్షిక:+document_properties_author=మూలకర్త:document_properties_subject=విషయం:document_properties_keywords=కీపదాలు:+document_properties_creation_date=సృష్టించిన తేదీ:+document_properties_modification_date=సవరించిన తేదీ:document_properties_date_string={{date}}, {{time}}+document_properties_creator=సృష్టికర్త:+document_properties_producer=PDF ఉత్పాదకి:+document_properties_version=PDF వర్షన్:document_properties_page_count=పేజీల సంఖ్య:document_properties_close=మూసివేయి@@ -73,6 +89,8 @@ toggle_sidebar.title=పక్కపట్టీ మార్చుtoggle_sidebar_label=పక్కపట్టీ మార్చుoutline.title=పత్రము అవుట్లైన్ చూపుoutline_label=పత్రము అవుట్లైన్+attachments.title=అనుబంధాలు చూపు+attachments_label=అనుబంధాలుthumbs.title=థంబ్నైల్స్ చూపుthumbs_label=థంబ్నైల్స్findbar.title=ఈ పత్రమునందు కనుగొనుము@@ -122,12 +140,15 @@ page_scale_width=పేజీ వెడల్పుpage_scale_fit=పేజీ అమర్పుpage_scale_auto=స్వయంచాలక జూమ్page_scale_actual=యథార్ధ పరిమాణం+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.# Loading indicator messagesloading_error_indicator=దోషంloading_error=PDF లోడవుచున్నప్పుడు వొక దోషం యెదురైంది.invalid_file_error=చెల్లని లేదా పాడైన PDF ఫైలు.missing_file_error=దొరకని PDF ఫైలు.+unexpected_response_error=అనుకోని సేవిక స్పందన.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/th/viewer.properties b/data/ext/viewerPDF/web/locale/th/viewer.propertiesindex eae74960b..9ccaa382a 100644--- a/data/ext/viewerPDF/web/locale/th/viewer.properties+++ b/data/ext/viewerPDF/web/locale/th/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=ความกว้างหน้าpage_scale_fit=พอดีหน้าpage_scale_auto=ย่อ-ขยายอัตโนมัติpage_scale_actual=ขนาดเท่าจริง+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=ข้อผิดพลาดloading_error=เกิดข้อผิดพลาดขณะกำลังโหลด PDFinvalid_file_error=แฟ้ม PDF ไม่ถูกต้องหรือไม่สมบูรณ์missing_file_error=แฟ้ม PDF หาย+unexpected_response_error=การตอบสนองเซิร์ฟเวอร์ที่ไม่คาดหวัง# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/tr/viewer.properties b/data/ext/viewerPDF/web/locale/tr/viewer.propertiesindex 6eefe2760..750501bcd 100644--- a/data/ext/viewerPDF/web/locale/tr/viewer.properties+++ b/data/ext/viewerPDF/web/locale/tr/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=Sayfa genişliğipage_scale_fit=Sayfayı sığdırpage_scale_auto=Otomatik yakınlaştırpage_scale_actual=Gerçek boyut+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent=%{{scale}}# Loading indicator messagesloading_error_indicator=Hataloading_error=PDF yüklenirken bir hata oluştu.invalid_file_error=Geçersiz veya bozulmuş PDF dosyası.missing_file_error=PDF dosyası eksik.+unexpected_response_error=Beklenmeyen sunucu yanıtı.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/uk/viewer.properties b/data/ext/viewerPDF/web/locale/uk/viewer.propertiesindex 9bb5f34a5..57e986704 100644--- a/data/ext/viewerPDF/web/locale/uk/viewer.properties+++ b/data/ext/viewerPDF/web/locale/uk/viewer.properties@@ -42,20 +42,20 @@ bookmark.title=Поточний вигляд (копіювати чи відкрbookmark_label=Поточний вигляд# Secondary toolbar and context menu-tools.title=Tools-tools_label=Tools-first_page.title=Йти на першу сторінку-first_page.label=Йти на першу сторінку-first_page_label=Йти на першу сторінку-last_page.title=Йти на останню сторінку-last_page.label=Йти на останню сторінку-last_page_label=Йти на останню сторінку-page_rotate_cw.title=Обернути за годинниковою стрілкою-page_rotate_cw.label=Обернути за годинниковою стрілкою-page_rotate_cw_label=Обернути за годинниковою стрілкою-page_rotate_ccw.title=Обернути проти годинникової стрілки-page_rotate_ccw.label=Обернути проти годинникової стрілки-page_rotate_ccw_label=Обернути проти годинникової стрілки+tools.title=Інструменти+tools_label=Інструменти+first_page.title=На першу сторінку+first_page.label=На першу сторінку+first_page_label=На першу сторінку+last_page.title=На останню сторінку+last_page.label=На останню сторінку+last_page_label=На останню сторінку+page_rotate_cw.title=Повернути за годинниковою стрілкою+page_rotate_cw.label=Повернути за годинниковою стрілкою+page_rotate_cw_label=Повернути за годинниковою стрілкою+page_rotate_ccw.title=Повернути проти годинникової стрілки+page_rotate_ccw.label=Повернути проти годинникової стрілки+page_rotate_ccw_label=Повернути проти годинникової стрілкиhand_tool_enable.title=Увімкнути інструмент «Рука»hand_tool_enable_label=Увімкнути інструмент «Рука»@@ -67,14 +67,14 @@ document_properties.title=Властивості документа…document_properties_label=Властивості документа…document_properties_file_name=Назва файла:document_properties_file_size=Розмір файла:-document_properties_kb={{size_kb}} KB ({{size_b}} bytes)-document_properties_mb={{size_mb}} MB ({{size_b}} bytes)+document_properties_kb={{size_kb}} КБ ({{size_b}} bytes)+document_properties_mb={{size_mb}} МБ ({{size_b}} bytes)document_properties_title=Заголовок:document_properties_author=Автор:document_properties_subject=Тема:document_properties_keywords=Ключові слова:document_properties_creation_date=Дата створення:-document_properties_modification_date=Дата модифікації:+document_properties_modification_date=Дата зміни:document_properties_date_string={{date}}, {{time}}document_properties_creator=Створено:document_properties_producer=Виробник PDF:@@ -85,12 +85,12 @@ document_properties_close=Закрити# Tooltips and alt text for side panel toolbar buttons# (the _label strings are alt text for the buttons, the .title strings are# tooltips)-toggle_sidebar.title=Перемкнути бічну панель+toggle_sidebar.title=Бічна панельtoggle_sidebar_label=Перемкнути бічну панельoutline.title=Показувати схему документаoutline_label=Схема документа-attachments.title=Show Attachments-attachments_label=Attachments+attachments.title=Показати прикріплення+attachments_label=Прикріпленняthumbs.title=Показувати ескізиthumbs_label=Ескізиfindbar.title=Шукати в документі@@ -133,19 +133,23 @@ error_stack=Стек: {{stack}}error_file=Файл: {{file}}# LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line numbererror_line=Рядок: {{line}}-rendering_error=Під час рендеру сторінки сталась помилка.+rendering_error=Під час виведення сторінки сталася помилка.# Predefined zoom valuespage_scale_width=За шириноюpage_scale_fit=Уміститиpage_scale_auto=Авто-масштабpage_scale_actual=Дійсний розмір+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=Помилка-loading_error=Під час завантаження PDF сталась помилка.+loading_error=Під час завантаження PDF сталася помилка.invalid_file_error=Недійсний або пошкоджений PDF-файл.missing_file_error=Відсутній PDF-файл.+unexpected_response_error=Неочікувана відповідь сервера.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined in@@ -158,6 +162,6 @@ password_ok=Гараздpassword_cancel=Скасуватиprinting_not_supported=Попередження: Цей браузер не повністю підтримує друк.-printing_not_ready=Попередження: The PDF це повністю завантажений для друку.+printing_not_ready=Попередження: PDF не повністю завантажений для друку.web_fonts_disabled=Веб-шрифти вимкнено: неможливо використати вбудовані у PDF шрифти.document_colors_disabled=PDF-документам не дозволено використовувати свої власні кольори: в браузері вимкнено «Дозволити сторінкам використовувати свої власні кольори».diff --git a/data/ext/viewerPDF/web/locale/wo/viewer.properties b/data/ext/viewerPDF/web/locale/wo/viewer.propertiesindex 94965ab96..3a9a4f992 100644--- a/data/ext/viewerPDF/web/locale/wo/viewer.properties+++ b/data/ext/viewerPDF/web/locale/wo/viewer.properties@@ -99,6 +99,8 @@ page_scale_width=Yaatuwaay bu mëtpage_scale_fit=Xët lëmmpage_scale_auto=Yambalaŋ ci saa sipage_scale_actual=Dayo bi am+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.# Loading indicator messagesloading_error_indicator=Njumtediff --git a/data/ext/viewerPDF/web/locale/xh/viewer.properties b/data/ext/viewerPDF/web/locale/xh/viewer.propertiesindex 89c9e8d23..36cd2cf75 100644--- a/data/ext/viewerPDF/web/locale/xh/viewer.properties+++ b/data/ext/viewerPDF/web/locale/xh/viewer.properties@@ -122,7 +122,7 @@ error_less_info=Inkcazelo Encinaneerror_close=Vala# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be# replaced by the PDF.JS version and build ID.-error_version_info=I-PDF.js v{{uhlelo}} (yakha: {{yakha}})+error_version_info=I-PDF.js v{{version}} (yakha: {{build}})# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an# english string describing the error.error_message=Umyalezo: {{message}}@@ -140,12 +140,16 @@ page_scale_width=Ububanzi bephephapage_scale_fit=Ukulinganiswa kwephephapage_scale_auto=Ukwandisa/Ukunciphisa Ngokwayopage_scale_actual=Ubungakanani bokwenene+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{umlinganiselo}}%# Loading indicator messagesloading_error_indicator=Imposisoloading_error=Imposiso yenzekile xa kulayishwa i-PDF.invalid_file_error=Ifayile ye-PDF engeyiyo okanye eyonakalisiweyo.missing_file_error=Ifayile ye-PDF edukileyo.+unexpected_response_error=Impendulo yeseva engalindelekanga.# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/zh-CN/viewer.properties b/data/ext/viewerPDF/web/locale/zh-CN/viewer.propertiesindex 878c5f210..6ec25f7ac 100644--- a/data/ext/viewerPDF/web/locale/zh-CN/viewer.properties+++ b/data/ext/viewerPDF/web/locale/zh-CN/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=适合页宽page_scale_fit=适合页面page_scale_auto=自动缩放page_scale_actual=实际大小+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=错误loading_error=载入PDF时发生错误。invalid_file_error=无效或损坏的PDF文件。missing_file_error=缺少PDF文件。+unexpected_response_error=意外的服务器响应。# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/locale/zh-TW/viewer.properties b/data/ext/viewerPDF/web/locale/zh-TW/viewer.propertiesindex cd0f8a0ca..f1849d48e 100644--- a/data/ext/viewerPDF/web/locale/zh-TW/viewer.properties+++ b/data/ext/viewerPDF/web/locale/zh-TW/viewer.properties@@ -140,12 +140,16 @@ page_scale_width=頁面寬度page_scale_fit=縮放至頁面大小page_scale_auto=自動縮放page_scale_actual=實際大小+# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a+# numerical scale value.+page_scale_percent={{scale}}%# Loading indicator messagesloading_error_indicator=錯誤loading_error=載入 PDF 時發生錯誤。invalid_file_error=無效或毀損的 PDF 檔案。missing_file_error=找不到 PDF 檔案。+unexpected_response_error=伺服器回應未預期的內容。# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.# "{{type}}" will be replaced with an annotation type from a list defined indiff --git a/data/ext/viewerPDF/web/viewer.css b/data/ext/viewerPDF/web/viewer.cssindex 191838689..3f9196993 100644--- a/data/ext/viewerPDF/web/viewer.css+++ b/data/ext/viewerPDF/web/viewer.css@@ -1,4 +1,4 @@-/* Copyright 2012 Mozilla Foundation+/* Copyright 2014 Mozilla Foundation** Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.@@ -13,6 +13,158 @@* limitations under the License.*/+.textLayer {+ position: absolute;+ left: 0;+ top: 0;+ right: 0;+ bottom: 0;+ overflow: hidden;+ opacity: 0.2;+}++.textLayer > div {+ color: transparent;+ position: absolute;+ white-space: pre;+ cursor: text;+ -webkit-transform-origin: 0% 0%;+ -moz-transform-origin: 0% 0%;+ -o-transform-origin: 0% 0%;+ -ms-transform-origin: 0% 0%;+ transform-origin: 0% 0%;+}++.textLayer .highlight {+ margin: -1px;+ padding: 1px;++ background-color: rgb(180, 0, 170);+ border-radius: 4px;+}++.textLayer .highlight.begin {+ border-radius: 4px 0px 0px 4px;+}++.textLayer .highlight.end {+ border-radius: 0px 4px 4px 0px;+}++.textLayer .highlight.middle {+ border-radius: 0px;+}++.textLayer .highlight.selected {+ background-color: rgb(0, 100, 0);+}++.textLayer ::selection { background: rgb(0,0,255); }+.textLayer ::-moz-selection { background: rgb(0,0,255); }++.pdfViewer .canvasWrapper {+ overflow: hidden;+}++.pdfViewer .page {+ direction: ltr;+ width: 816px;+ height: 1056px;+ margin: 1px auto -8px auto;+ position: relative;+ overflow: visible;+ border: 9px solid transparent;+ background-clip: content-box;+ border-image: url(images/shadow.png) 9 9 repeat;+ background-color: white;+}++.pdfViewer .page canvas {+ margin: 0;+ display: block;+}++.pdfViewer .page .loadingIcon {+ position: absolute;+ display: block;+ left: 0;+ top: 0;+ right: 0;+ bottom: 0;+ background: url('images/loading-icon.gif') center no-repeat;+}++.pdfViewer .page .annotLink > a:hover {+ opacity: 0.2;+ background: #ff0;+ box-shadow: 0px 2px 10px #ff0;+}++:-webkit-full-screen .pdfViewer .page {+ margin-bottom: 100%;+ border: 0;+}++:-moz-full-screen .pdfViewer .page {+ margin-bottom: 100%;+ border: 0;+}++:-ms-fullscreen .pdfViewer .page {+ margin-bottom: 100% !important;+ border: 0;+}++:fullscreen .pdfViewer .page {+ margin-bottom: 100%;+ border: 0;+}++.pdfViewer .page .annotText > img {+ position: absolute;+ cursor: pointer;+}++.pdfViewer .page .annotTextContentWrapper {+ position: absolute;+ width: 20em;+}++.pdfViewer .page .annotTextContent {+ z-index: 200;+ float: left;+ max-width: 20em;+ background-color: #FFFF99;+ box-shadow: 0px 2px 5px #333;+ border-radius: 2px;+ padding: 0.6em;+ cursor: pointer;+}++.pdfViewer .page .annotTextContent > h1 {+ font-size: 1em;+ border-bottom: 1px solid #000000;+ padding-bottom: 0.2em;+}++.pdfViewer .page .annotTextContent > p {+ padding-top: 0.2em;+}++.pdfViewer .page .annotLink > a {+ position: absolute;+ font-size: 1em;+ top: 0;+ left: 0;+ width: 100%;+ height: 100%;+}++.pdfViewer .page .annotLink > a /* -ms-a */ {+ background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAA\+ LAAAAAABAAEAAAIBRAA7") 0 0 repeat;+}+* {padding: 0;margin: 0;@@ -53,6 +205,7 @@ select {height: 100%;overflow: hidden;cursor: none;+ -webkit-user-select: none;}#viewerContainer:-moz-full-screen {@@ -63,6 +216,7 @@ select {height: 100%;overflow: hidden;cursor: none;+ -moz-user-select: none;}#viewerContainer:-ms-fullscreen {@@ -72,6 +226,7 @@ select {height: 100%;overflow: hidden !important;cursor: none;+ -ms-user-select: none;}#viewerContainer:-ms-fullscreen::-ms-backdrop {@@ -86,26 +241,9 @@ select {height: 100%;overflow: hidden;cursor: none;-}--:-webkit-full-screen .page {- margin-bottom: 100%;- border: 0;-}--:-moz-full-screen .page {- margin-bottom: 100%;- border: 0;-}--:-ms-fullscreen .page {- margin-bottom: 100% !important;- border: 0;-}--:fullscreen .page {- margin-bottom: 100%;- border: 0;+ -webkit-user-select: none;+ -moz-user-select: none;+ -ms-user-select: none;}:-webkit-full-screen a:not(.internalLink) {@@ -410,6 +548,9 @@ html[dir='rtl'] .findbar {background-repeat: no-repeat;background-position: right;}+html[dir='rtl'] #findInput[data-status="pending"] {+ background-position: left;+}.secondaryToolbar {padding: 6px;@@ -487,8 +628,8 @@ html[dir='ltr'] .doorHangerRight:before {color: #A6B7D0;}-.notFound {- background-color: rgb(255, 137, 153);+#findInput.notFound {+ background-color: rgb(255, 102, 102);}html[dir='ltr'] #toolbarViewerLeft {@@ -764,8 +905,6 @@ html[dir='rtl'] .dropdownToolbarButton {}.dropdownToolbarButton > select {- -webkit-appearance: none;- -moz-appearance: none; /* in the future this might matter, see bugzilla bug #649849 */min-width: 140px;font-size: 12px;color: hsl(0,0%,95%);@@ -1027,7 +1166,7 @@ html[dir='rtl'] .verticalToolbarSeparator {}.horizontalToolbarSeparator {- display: block;+ display: block;margin: 0 0 4px 0;height: 1px;width: 100%;@@ -1068,6 +1207,12 @@ html[dir='rtl'] .verticalToolbarSeparator {width: 40px;}+.toolbarField.pageNumber.visiblePageIsLoading {+ background-image: url(images/loading-small.png);+ background-repeat: no-repeat;+ background-position: 1px;+}+.toolbarField.pageNumber::-webkit-inner-spin-button,.toolbarField.pageNumber::-webkit-outer-spin-button {-webkit-appearance: none;@@ -1118,9 +1263,13 @@ html[dir='rtl'] .verticalToolbarSeparator {margin-bottom: 10px;}+#thumbnailView > a:last-of-type > .thumbnail:not([data-loaded]) {+ margin-bottom: 9px;+}+.thumbnail:not([data-loaded]) {border: 1px dashed rgba(255, 255, 255, 0.5);- margin-bottom: 10px;+ margin: -1px -1px 4px -1px;}.thumbnailImage {@@ -1129,6 +1278,8 @@ html[dir='rtl'] .verticalToolbarSeparator {box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);opacity: 0.8;z-index: 99;+ background-color: white;+ background-clip: content-box;}.thumbnailSelectionRing {@@ -1261,141 +1412,11 @@ html[dir='rtl'] .attachmentsItem > button {cursor: default;}-.canvasWrapper {- overflow: hidden;-}--canvas {- margin: 0;- display: block;-}--.page {- direction: ltr;- width: 816px;- height: 1056px;- margin: 1px auto -8px auto;- position: relative;- overflow: visible;- border: 9px solid transparent;- background-clip: content-box;- border-image: url(images/shadow.png) 9 9 repeat;- background-color: white;-}--.annotLink > a:hover {- opacity: 0.2;- background: #ff0;- box-shadow: 0px 2px 10px #ff0;-}--.loadingIcon {- position: absolute;- display: block;- left: 0;- top: 0;- right: 0;- bottom: 0;- background: url('images/loading-icon.gif') center no-repeat;-}--.textLayer {- position: absolute;- left: 0;- top: 0;- right: 0;- bottom: 0;- color: #000;- font-family: sans-serif;- overflow: hidden;-}--.textLayer > div {- color: transparent;- position: absolute;- white-space: pre;- cursor: text;-}--.textLayer .highlight {- margin: -1px;- padding: 1px;-- background-color: rgba(180, 0, 170, 0.2);- border-radius: 4px;-}--.textLayer .highlight.begin {- border-radius: 4px 0px 0px 4px;-}--.textLayer .highlight.end {- border-radius: 0px 4px 4px 0px;-}--.textLayer .highlight.middle {- border-radius: 0px;-}--.textLayer .highlight.selected {- background-color: rgba(0, 100, 0, 0.2);-}-/* TODO: file FF bug to support ::-moz-selection:window-inactiveso we can override the opaque grey background when the window is inactive;see https://bugzilla.mozilla.org/show_bug.cgi?id=706209 */-::selection { background:rgba(0,0,255,0.3); }-::-moz-selection { background:rgba(0,0,255,0.3); }--.annotationHighlight {- position: absolute;- border: 2px #FFFF99 solid;-}--.annotText > img {- position: absolute;- cursor: pointer;-}--.annotTextContentWrapper {- position: absolute;- width: 20em;-}--.annotTextContent {- z-index: 200;- float: left;- max-width: 20em;- background-color: #FFFF99;- box-shadow: 0px 2px 5px #333;- border-radius: 2px;- padding: 0.6em;- cursor: pointer;-}--.annotTextContent > h1 {- font-size: 1em;- border-bottom: 1px solid #000000;- padding-bottom: 0.2em;-}--.annotTextContent > p {- padding-top: 0.2em;-}--.annotLink > a {- position: absolute;- font-size: 1em;- top: 0;- left: 0;- width: 100%;- height: 100%;-}--.annotLink > a /* -ms-a */ {- background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAA\- LAAAAAABAAEAAAIBRAA7") 0 0 repeat;-}+::selection { background: rgba(0,0,255,0.3); }+::-moz-selection { background: rgba(0,0,255,0.3); }#errorWrapper {background: none repeat scroll 0 0 #FF5555;@@ -1489,7 +1510,7 @@ canvas {}.dialog .separator {- display: block;+ display: block;margin: 4px 0 4px 0;height: 1px;width: 100%;@@ -1578,11 +1599,9 @@ html[dir='rtl'] #documentPropertiesOverlay .row > * {.debuggerShowText {background: none repeat scroll 0 0 yellow;color: blue;- opacity: 0.3;}.debuggerHideText:hover {background: none repeat scroll 0 0 yellow;- opacity: 0.3;}#PDFBug .stats {font-family: courier;@@ -1668,11 +1687,17 @@ html[dir='rtl'] #documentPropertiesOverlay .row > * {left: 186px;}+ .toolbarField.pageNumber.visiblePageIsLoading,+ #findInput[data-status="pending"] {+ background-image: url(images/[email protected]);+ background-size: 16px 17px;+ }+.dropdownToolbarButton {background: url(images/[email protected]) no-repeat;background-size: 7px 16px;}-+html[dir='ltr'] .toolbarButton#sidebarToggle::before {content: url(images/[email protected]);}@@ -1817,6 +1842,8 @@ html[dir='rtl'] #documentPropertiesOverlay .row > * {display: none;border: none;box-shadow: none;+ background-clip: content-box;+ background-color: white;}.page[data-loaded] {@@ -1838,6 +1865,7 @@ html[dir='rtl'] #documentPropertiesOverlay .row > * {position: relative;top: 0;left: 0;+ display: block;}}@@ -1962,23 +1990,3 @@ html[dir='rtl'] #documentPropertiesOverlay .row > * {display: none;}}--/* Custom scrollbars for chrome */-::-webkit-scrollbar-track-{- background-color: transparent;-}--::-webkit-scrollbar-{- width: 8px;- height: 8px;- background-color: #F5F5F5;-}--::-webkit-scrollbar-thumb-{- background-color: #bbb;- /* border-radius: 6px;*/-}-diff --git a/data/ext/viewerPDF/web/viewer.html b/data/ext/viewerPDF/web/viewer.htmlindex 6b9c619e3..1e7dd87a7 100644--- a/data/ext/viewerPDF/web/viewer.html+++ b/data/ext/viewerPDF/web/viewer.html@@ -43,8 +43,8 @@ http://sourceforge.net/adobe/cmap/wiki/License/</head>- <body tabindex="1">- <div id="outerContainer" class="loadingInProgress">+ <body tabindex="1" class="loadingInProgress">+ <div id="outerContainer"><div id="sidebarContainer"><div id="toolbarSidebar">@@ -96,17 +96,17 @@ http://sourceforge.net/adobe/cmap/wiki/License/<span data-l10n-id="presentation_mode_label">Presentation Mode</span></button>- <!--button id="secondaryOpenFile" class="secondaryToolbarButton openFile visibleLargeView" title="Open File" tabindex="52" data-l10n-id="open_file">+ <button id="secondaryOpenFile" class="secondaryToolbarButton openFile visibleLargeView" title="Open File" tabindex="52" data-l10n-id="open_file"><span data-l10n-id="open_file_label">Open</span>- </button-->+ </button><button id="secondaryPrint" class="secondaryToolbarButton print visibleMediumView" title="Print" tabindex="53" data-l10n-id="print"><span data-l10n-id="print_label">Print</span></button>- <!--button id="secondaryDownload" class="secondaryToolbarButton download visibleMediumView" title="Download" tabindex="54" data-l10n-id="download">+ <button id="secondaryDownload" class="secondaryToolbarButton download visibleMediumView" title="Download" tabindex="54" data-l10n-id="download"><span data-l10n-id="download_label">Download</span>- </button-->+ </button><a href="#" id="secondaryViewBookmark" class="secondaryToolbarButton bookmark visibleSmallView" title="Current view (copy or open in new window)" tabindex="55" data-l10n-id="bookmark"><span data-l10n-id="bookmark_label">Current View</span>@@ -135,7 +135,7 @@ http://sourceforge.net/adobe/cmap/wiki/License/<button id="toggleHandTool" class="secondaryToolbarButton handTool" title="Enable hand tool" tabindex="60" data-l10n-id="hand_tool_enable"><span data-l10n-id="hand_tool_enable_label">Enable hand tool</span></button>-+<div class="horizontalToolbarSeparator"></div><button id="documentProperties" class="secondaryToolbarButton documentProperties" title="Document Properties…" tabindex="61" data-l10n-id="document_properties">@@ -190,10 +190,10 @@ http://sourceforge.net/adobe/cmap/wiki/License/</a><div class="verticalToolbarSeparator hiddenSmallView"></div>-+<button id="secondaryToolbarToggle" class="toolbarButton" title="Tools" tabindex="36" data-l10n-id="tools"><span data-l10n-id="tools_label">Tools</span>- </button>+ </button></div><div class="outerCenter"><div class="innerCenter" id="toolbarViewerMiddle">@@ -213,14 +213,14 @@ http://sourceforge.net/adobe/cmap/wiki/License/<option id="pageFitOption" title="" value="page-fit" data-l10n-id="page_scale_fit">Fit Page</option><option id="pageWidthOption" title="" value="page-width" data-l10n-id="page_scale_width">Full Width</option><option id="customScaleOption" title="" value="custom"></option>- <option title="" value="0.5">50%</option>- <option title="" value="0.75">75%</option>- <option title="" value="1">100%</option>- <option title="" value="1.25">125%</option>- <option title="" value="1.5">150%</option>- <option title="" value="2">200%</option>- <option title="" value="3">300%</option>- <option title="" value="4">400%</option>+ <option title="" value="0.5" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 50 }'>50%</option>+ <option title="" value="0.75" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 75 }'>75%</option>+ <option title="" value="1" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 100 }'>100%</option>+ <option title="" value="1.25" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 125 }'>125%</option>+ <option title="" value="1.5" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 150 }'>150%</option>+ <option title="" value="2" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 200 }'>200%</option>+ <option title="" value="3" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 300 }'>300%</option>+ <option title="" value="4" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 400 }'>400%</option></select></span></div>@@ -247,7 +247,7 @@ http://sourceforge.net/adobe/cmap/wiki/License/</menu><div id="viewerContainer" tabindex="0">- <div id="viewer"></div>+ <div id="viewer" class="pdfViewer"></div></div><div id="errorWrapper" hidden='true'>@@ -335,6 +335,14 @@ http://sourceforge.net/adobe/cmap/wiki/License/</div> <!-- outerContainer --><div id="printContainer"></div><div id="mozPrintCallback-shim" hidden>+ <style>+@media print {+ #printContainer div {+ page-break-after: always;+ page-break-inside: avoid;+ }+}+ </style><style scoped>#mozPrintCallback-shim {position: fixed;diff --git a/data/ext/viewerPDF/web/viewer.js b/data/ext/viewerPDF/web/viewer.jsindex 61ee687f2..51f66f14b 100644--- a/data/ext/viewerPDF/web/viewer.js+++ b/data/ext/viewerPDF/web/viewer.js@@ -16,43 +16,26 @@*//* globals PDFJS, PDFBug, FirefoxCom, Stats, Cache, ProgressBar,DownloadManager, getFileName, scrollIntoView, getPDFFileNameFromURL,- PDFHistory, Preferences, SidebarView, ViewHistory, PageView,- ThumbnailView, URL, noContextMenuHandler, SecondaryToolbar,+ PDFHistory, Preferences, SidebarView, ViewHistory, Stats,+ PDFThumbnailViewer, URL, noContextMenuHandler, SecondaryToolbar,PasswordPrompt, PresentationMode, HandTool, Promise,- DocumentProperties, DocumentOutlineView, DocumentAttachmentsView,- OverlayManager, PDFFindController, PDFFindBar */+ DocumentProperties, PDFOutlineView, PDFAttachmentView,+ OverlayManager, PDFFindController, PDFFindBar, getVisibleElements,+ watchScroll, PDFViewer, PDFRenderingQueue, PresentationModeState,+ RenderingStates, DEFAULT_SCALE, UNKNOWN_SCALE,+ IGNORE_CURRENT_POSITION_ON_ZOOM: true */'use strict';var DEFAULT_URL = 'compressed.tracemonkey-pldi-09.pdf';-var DEFAULT_SCALE = 'auto';var DEFAULT_SCALE_DELTA = 1.1;-var UNKNOWN_SCALE = 0;-var DEFAULT_CACHE_SIZE = 10;-var CSS_UNITS = 96.0 / 72.0;-var SCROLLBAR_PADDING = 40;-var VERTICAL_PADDING = 5;-var MAX_AUTO_SCALE = 1.25;var MIN_SCALE = 0.25;var MAX_SCALE = 10.0;var VIEW_HISTORY_MEMORY = 20;var SCALE_SELECT_CONTAINER_PADDING = 8;var SCALE_SELECT_PADDING = 22;-var THUMBNAIL_SCROLL_MARGIN = -19;-var CLEANUP_TIMEOUT = 30000;-var IGNORE_CURRENT_POSITION_ON_ZOOM = false;-var RenderingStates = {- INITIAL: 0,- RUNNING: 1,- PAUSED: 2,- FINISHED: 3-};-var FindStates = {- FIND_FOUND: 0,- FIND_NOTFOUND: 1,- FIND_WRAPPED: 2,- FIND_PENDING: 3-};+var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';+var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;PDFJS.imageResourcesPath = './images/';PDFJS.workerSrc = '../build/pdf.worker.js';@@ -62,6 +45,13 @@ PDFJS.imageResourcesPath = './images/';var mozL10n = document.mozL10n || document.webL10n;+var CSS_UNITS = 96.0 / 72.0;+var DEFAULT_SCALE = 'auto';+var UNKNOWN_SCALE = 0;+var MAX_AUTO_SCALE = 1.25;+var SCROLLBAR_PADDING = 40;+var VERTICAL_PADDING = 5;+// optimised CSS custom property getter/settervar CustomStyle = (function CustomStyleClosure() {@@ -184,6 +174,135 @@ function scrollIntoView(element, spot) {parent.scrollTop = offsetY;}+/**+ * Helper function to start monitoring the scroll event and converting them into+ * PDF.js friendly one: with scroll debounce and scroll direction.+ */+function watchScroll(viewAreaElement, callback) {+ var debounceScroll = function debounceScroll(evt) {+ if (rAF) {+ return;+ }+ // schedule an invocation of scroll for next animation frame.+ rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {+ rAF = null;++ var currentY = viewAreaElement.scrollTop;+ var lastY = state.lastY;+ if (currentY !== lastY) {+ state.down = currentY > lastY;+ }+ state.lastY = currentY;+ callback(state);+ });+ };++ var state = {+ down: true,+ lastY: viewAreaElement.scrollTop,+ _eventHandler: debounceScroll+ };++ var rAF = null;+ viewAreaElement.addEventListener('scroll', debounceScroll, true);+ return state;+}++/**+ * Use binary search to find the index of the first item in a given array which+ * passes a given condition. The items are expected to be sorted in the sense+ * that if the condition is true for one item in the array, then it is also true+ * for all following items.+ *+ * @returns {Number} Index of the first array element to pass the test,+ * or |items.length| if no such element exists.+ */+function binarySearchFirstItem(items, condition) {+ var minIndex = 0;+ var maxIndex = items.length - 1;++ if (items.length === 0 || !condition(items[maxIndex])) {+ return items.length;+ }+ if (condition(items[minIndex])) {+ return minIndex;+ }++ while (minIndex < maxIndex) {+ var currentIndex = (minIndex + maxIndex) >> 1;+ var currentItem = items[currentIndex];+ if (condition(currentItem)) {+ maxIndex = currentIndex;+ } else {+ minIndex = currentIndex + 1;+ }+ }+ return minIndex; /* === maxIndex */+}++/**+ * Generic helper to find out what elements are visible within a scroll pane.+ */+function getVisibleElements(scrollEl, views, sortByVisibility) {+ var top = scrollEl.scrollTop, bottom = top + scrollEl.clientHeight;+ var left = scrollEl.scrollLeft, right = left + scrollEl.clientWidth;++ function isElementBottomBelowViewTop(view) {+ var element = view.div;+ var elementBottom =+ element.offsetTop + element.clientTop + element.clientHeight;+ return elementBottom > top;+ }++ var visible = [], view, element;+ var currentHeight, viewHeight, hiddenHeight, percentHeight;+ var currentWidth, viewWidth;+ var firstVisibleElementInd = (views.length === 0) ? 0 :+ binarySearchFirstItem(views, isElementBottomBelowViewTop);++ for (var i = firstVisibleElementInd, ii = views.length; i < ii; i++) {+ view = views[i];+ element = view.div;+ currentHeight = element.offsetTop + element.clientTop;+ viewHeight = element.clientHeight;++ if (currentHeight > bottom) {+ break;+ }++ currentWidth = element.offsetLeft + element.clientLeft;+ viewWidth = element.clientWidth;+ if (currentWidth + viewWidth < left || currentWidth > right) {+ continue;+ }+ hiddenHeight = Math.max(0, top - currentHeight) ++ Math.max(0, currentHeight + viewHeight - bottom);+ percentHeight = ((viewHeight - hiddenHeight) * 100 / viewHeight) | 0;++ visible.push({+ id: view.id,+ x: currentWidth,+ y: currentHeight,+ view: view,+ percent: percentHeight+ });+ }++ var first = visible[0];+ var last = visible[visible.length - 1];++ if (sortByVisibility) {+ visible.sort(function(a, b) {+ var pc = a.percent - b.percent;+ if (Math.abs(pc) > 0.001) {+ return -pc;+ }+ return a.id - b.id; // ensure stability+ });+ }+ return {first: first, last: last, views: visible};+}+/*** Event handler to suppress context menu.*/@@ -228,6 +347,7 @@ var ProgressBar = (function ProgressBarClosure() {}function ProgressBar(id, opts) {+ this.visible = true;// Fetch the sub-elements for later.this.div = document.querySelector(id + ' .progress');@@ -281,35 +401,27 @@ var ProgressBar = (function ProgressBarClosure() {},hide: function ProgressBar_hide() {+ if (!this.visible) {+ return;+ }+ this.visible = false;this.bar.classList.add('hidden');- this.bar.removeAttribute('style');+ document.body.classList.remove('loadingInProgress');+ },++ show: function ProgressBar_show() {+ if (this.visible) {+ return;+ }+ this.visible = true;+ document.body.classList.add('loadingInProgress');+ this.bar.classList.remove('hidden');}};return ProgressBar;})();-var Cache = function cacheCache(size) {- var data = [];- this.push = function cachePush(view) {- var i = data.indexOf(view);- if (i >= 0) {- data.splice(i, 1);- }- data.push(view);- if (data.length > size) {- data.shift().destroy();- }- };- this.resize = function (newSize) {- size = newSize;- while (data.length > size) {- data.shift().destroy();- }- };-};--var DEFAULT_PREFERENCES = {@@ -318,7 +430,9 @@ var DEFAULT_PREFERENCES = {sidebarViewOnLoad: 0,enableHandToolOnLoad: false,enableWebGL: false,+ pdfBugEnabled: false,disableRange: false,+ disableStream: false,disableAutoFetch: false,disableFontFace: false,disableTextLayer: false,@@ -697,9 +811,6 @@ var DownloadManager = (function DownloadManagerClosure() {-var cache = new Cache(DEFAULT_CACHE_SIZE);-var currentPageNumber = 1;-/*** View History - This is a utility for saving various view parameters for@@ -940,6 +1051,15 @@ var PDFFindBar = (function PDFFindBarClosure() {})();+var FindStates = {+ FIND_FOUND: 0,+ FIND_NOTFOUND: 1,+ FIND_WRAPPED: 2,+ FIND_PENDING: 3+};++var FIND_SCROLL_OFFSET_TOP = -50;+var FIND_SCROLL_OFFSET_LEFT = -400;/*** Provides "search" or "find" functionality for the PDF.@@ -961,11 +1081,12 @@ var PDFFindController = (function PDFFindControllerClosure() {pageIdx: null,matchIdx: null};+ this.pagesToSearch = null;this.resumePageIdx = null;this.state = null;this.dirtyMatch = false;this.findTimeout = null;- this.pdfPageSource = options.pdfPageSource || null;+ this.pdfViewer = options.pdfViewer || null;this.integratedFind = options.integratedFind || false;this.charactersToNormalize = {'\u2018': '\'', // Left single quotation mark@@ -978,7 +1099,8 @@ var PDFFindController = (function PDFFindControllerClosure() {'\u201F': '"', // Double high-reversed-9 quotation mark'\u00BC': '1/4', // Vulgar fraction one quarter'\u00BD': '1/2', // Vulgar fraction one half- '\u00BE': '3/4' // Vulgar fraction three quarters+ '\u00BE': '3/4', // Vulgar fraction three quarters+ '\u00A0': ' ' // No-break space};this.findBar = options.findBar || null;@@ -1061,7 +1183,7 @@ var PDFFindController = (function PDFFindControllerClosure() {this.pageContents = [];var extractTextPromisesResolves = [];- var numPages = this.pdfPageSource.pdfDocument.numPages;+ var numPages = this.pdfViewer.pagesCount;for (var i = 0; i < numPages; i++) {this.extractTextPromises.push(new Promise(function (resolve) {extractTextPromisesResolves.push(resolve);@@ -1070,7 +1192,7 @@ var PDFFindController = (function PDFFindControllerClosure() {var self = this;function extractPageText(pageIndex) {- self.pdfPageSource.pages[pageIndex].getTextContent().then(+ self.pdfViewer.getPageTextContent(pageIndex).then(function textContentResolved(textContent) {var textItems = textContent.items;var str = [];@@ -1083,7 +1205,7 @@ var PDFFindController = (function PDFFindControllerClosure() {self.pageContents.push(str.join(''));extractTextPromisesResolves[pageIndex](pageIndex);- if ((pageIndex + 1) < self.pdfPageSource.pages.length) {+ if ((pageIndex + 1) < self.pdfViewer.pagesCount) {extractPageText(pageIndex + 1);}}@@ -1113,15 +1235,14 @@ var PDFFindController = (function PDFFindControllerClosure() {},updatePage: function PDFFindController_updatePage(index) {- var page = this.pdfPageSource.pages[index];-if (this.selected.pageIdx === index) {// If the page is selected, scroll the page into view, which triggers// rendering the page, which adds the textLayer. Once the textLayer is// build, it will scroll onto the selected match.- page.scrollIntoView();+ this.pdfViewer.scrollPageIntoView(index + 1);}+ var page = this.pdfViewer.getPageView(index);if (page.textLayer) {page.textLayer.updateMatches();}@@ -1129,8 +1250,8 @@ var PDFFindController = (function PDFFindControllerClosure() {nextMatch: function PDFFindController_nextMatch() {var previous = this.state.findPrevious;- var currentPageIndex = this.pdfPageSource.page - 1;- var numPages = this.pdfPageSource.pages.length;+ var currentPageIndex = this.pdfViewer.currentPageNumber - 1;+ var numPages = this.pdfViewer.pagesCount;this.active = true;@@ -1172,6 +1293,8 @@ var PDFFindController = (function PDFFindControllerClosure() {}var offset = this.offset;+ // Keep track of how many pages we should maximally iterate through.+ this.pagesToSearch = numPages;// If there's already a matchIdx that means we are iterating through a// page's matches.if (offset.matchIdx !== null) {@@ -1210,10 +1333,10 @@ var PDFFindController = (function PDFFindControllerClosure() {this.advanceOffsetPage(previous);if (offset.wrapped) {offset.matchIdx = null;- if (!this.hadMatch) {- // No point in wrapping, there were no matches.+ if (this.pagesToSearch < 0) {+ // No point in wrapping again, there were no matches.this.updateMatch(false);- // while matches were not found, searching for a page+ // while matches were not found, searching for a page// with matches should nevertheless halt.return true;}@@ -1223,6 +1346,26 @@ var PDFFindController = (function PDFFindControllerClosure() {}},+ /**+ * The method is called back from the text layer when match presentation+ * is updated.+ * @param {number} pageIndex - page index.+ * @param {number} index - match index.+ * @param {Array} elements - text layer div elements array.+ * @param {number} beginIdx - start index of the div array for the match.+ * @param {number} endIdx - end index of the div array for the match.+ */+ updateMatchPosition: function PDFFindController_updateMatchPosition(+ pageIndex, index, elements, beginIdx, endIdx) {+ if (this.selected.matchIdx === index &&+ this.selected.pageIdx === pageIndex) {+ scrollIntoView(elements[beginIdx], {+ top: FIND_SCROLL_OFFSET_TOP,+ left: FIND_SCROLL_OFFSET_LEFT+ });+ }+ },+nextPageMatch: function PDFFindController_nextPageMatch() {if (this.resumePageIdx !== null) {console.error('There can only be one pending page.');@@ -1244,11 +1387,12 @@ var PDFFindController = (function PDFFindControllerClosure() {var numPages = this.extractTextPromises.length;offset.pageIdx = (previous ? offset.pageIdx - 1 : offset.pageIdx + 1);offset.matchIdx = null;-++ this.pagesToSearch--;+if (offset.pageIdx >= numPages || offset.pageIdx < 0) {offset.pageIdx = (previous ? numPages - 1 : 0);offset.wrapped = true;- return;}},@@ -1256,7 +1400,7 @@ var PDFFindController = (function PDFFindControllerClosure() {var state = FindStates.FIND_NOTFOUND;var wrapped = this.offset.wrapped;this.offset.wrapped = false;-+if (found) {var previousPage = this.selected.pageIdx;this.selected.pageIdx = this.offset.pageIdx;@@ -1267,10 +1411,10 @@ var PDFFindController = (function PDFFindControllerClosure() {this.updatePage(previousPage);}}-+this.updateUIState(state, this.state.findPrevious);if (this.selected.pageIdx !== -1) {- this.updatePage(this.selected.pageIdx, true);+ this.updatePage(this.selected.pageIdx);}},@@ -1291,17 +1435,15 @@ var PDFFindController = (function PDFFindControllerClosure() {})();-var PDFHistory = {initialized: false,initialDestination: null,- initialize: function pdfHistoryInitialize(fingerprint) {- if (PDFJS.disableHistory || PDFView.isViewerEmbedded) {- // The browsing history is only enabled when the viewer is standalone,- // i.e. not when it is embedded in a web page.- return;- }+ /**+ * @param {string} fingerprint+ * @param {IPDFLinkService} linkService+ */+ initialize: function pdfHistoryInitialize(fingerprint, linkService) {this.initialized = true;this.reInitialized = false;this.allowHashChange = true;@@ -1316,6 +1458,7 @@ var PDFHistory = {this.nextHashParam = '';this.fingerprint = fingerprint;+ this.linkService = linkService;this.currentUid = this.uid = 0;this.current = {};@@ -1326,7 +1469,7 @@ var PDFHistory = {if (state.target.dest) {this.initialDestination = state.target.dest;} else {- PDFView.initialBookmark = state.target.hash;+ linkService.setHash(state.target.hash);}this.currentUid = state.uid;this.uid = state.uid + 1;@@ -1464,7 +1607,7 @@ var PDFHistory = {params.hash = (this.current.hash && this.current.dest &&this.current.dest === params.dest) ?this.current.hash :- PDFView.getDestinationHash(params.dest).split('#')[1];+ this.linkService.getDestinationHash(params.dest).split('#')[1];}if (params.page) {params.page |= 0;@@ -1473,7 +1616,7 @@ var PDFHistory = {var target = window.history.state.target;if (!target) {// Invoked when the user specifies an initial bookmark,- // thus setting PDFView.initialBookmark, when the document is loaded.+ // thus setting initialBookmark, when the document is loaded.this._pushToHistory(params, false);this.previousHash = window.location.hash.substring(1);}@@ -1598,9 +1741,9 @@ var PDFHistory = {this.historyUnlocked = false;if (state.target.dest) {- PDFView.navigateTo(state.target.dest);+ this.linkService.navigateTo(state.target.dest);} else {- PDFView.setHash(state.target.hash);+ this.linkService.setHash(state.target.hash);}this.currentUid = state.uid;if (state.uid > this.uid) {@@ -1708,7 +1851,7 @@ var SecondaryToolbar = {},downloadClick: function secondaryToolbarDownloadClick(evt) {- PDFView.download();+ PDFViewerApplication.download();this.close();},@@ -1717,23 +1860,23 @@ var SecondaryToolbar = {},firstPageClick: function secondaryToolbarFirstPageClick(evt) {- PDFView.page = 1;+ PDFViewerApplication.page = 1;this.close();},lastPageClick: function secondaryToolbarLastPageClick(evt) {- if (PDFView.pdfDocument) {- PDFView.page = PDFView.pdfDocument.numPages;+ if (PDFViewerApplication.pdfDocument) {+ PDFViewerApplication.page = PDFViewerApplication.pagesCount;}this.close();},pageRotateCwClick: function secondaryToolbarPageRotateCwClick(evt) {- PDFView.rotatePages(90);+ PDFViewerApplication.rotatePages(90);},pageRotateCcwClick: function secondaryToolbarPageRotateCcwClick(evt) {- PDFView.rotatePages(-90);+ PDFViewerApplication.rotatePages(-90);},documentPropertiesClick: function secondaryToolbarDocumentPropsClick(evt) {@@ -1833,7 +1976,7 @@ var PresentationMode = {},/**- * Initialize a timeout that is used to reset PDFView.currentPosition when the+ * Initialize a timeout that is used to specify switchInProgress when the* browser transitions to fullscreen mode. Since resize events are triggered* multiple times during the switch to fullscreen mode, this is necessary in* order to prevent the page from being scrolled partially, or completely,@@ -1846,9 +1989,8 @@ var PresentationMode = {}this.switchInProgress = setTimeout(function switchInProgressTimeout() {delete this.switchInProgress;+ this._notifyStateChange();}.bind(this), DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS);-- PDFView.currentPosition = null;},_resetSwitchInProgress: function presentationMode_resetSwitchInProgress() {@@ -1859,18 +2001,19 @@ var PresentationMode = {},request: function presentationModeRequest() {- if (!PDFView.supportsFullscreen || this.isFullscreen ||+ if (!PDFViewerApplication.supportsFullscreen || this.isFullscreen ||!this.viewer.hasChildNodes()) {return false;}this._setSwitchInProgress();+ this._notifyStateChange();if (this.container.requestFullscreen) {this.container.requestFullscreen();} else if (this.container.mozRequestFullScreen) {this.container.mozRequestFullScreen();- } else if (this.container.webkitRequestFullScreen) {- this.container.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);+ } else if (this.container.webkitRequestFullscreen) {+ this.container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);} else if (this.container.msRequestFullscreen) {this.container.msRequestFullscreen();} else {@@ -1878,23 +2021,33 @@ var PresentationMode = {}this.args = {- page: PDFView.page,- previousScale: PDFView.currentScaleValue+ page: PDFViewerApplication.page,+ previousScale: PDFViewerApplication.currentScaleValue};return true;},+ _notifyStateChange: function presentationModeNotifyStateChange() {+ var event = document.createEvent('CustomEvent');+ event.initCustomEvent('presentationmodechanged', true, true, {+ active: PresentationMode.active,+ switchInProgress: !!PresentationMode.switchInProgress+ });+ window.dispatchEvent(event);+ },+enter: function presentationModeEnter() {this.active = true;this._resetSwitchInProgress();+ this._notifyStateChange();// Ensure that the correct page is scrolled into view when entering// Presentation Mode, by waiting until fullscreen mode in enabled.// Note: This is only necessary in non-Mozilla browsers.setTimeout(function enterPresentationModeTimeout() {- PDFView.page = this.args.page;- PDFView.setScale('page-fit', true);+ PDFViewerApplication.page = this.args.page;+ PDFViewerApplication.setScale('page-fit', true);}.bind(this), 0);window.addEventListener('mousemove', this.mouseMove, false);@@ -1905,18 +2058,25 @@ var PresentationMode = {HandTool.enterPresentationMode();this.contextMenuOpen = false;this.container.setAttribute('contextmenu', 'viewerContextMenu');++ // Text selection is disabled in Presentation Mode, thus it's not possible+ // for the user to deselect text that is selected (e.g. with "Select all")+ // when entering Presentation Mode, hence we remove any active selection.+ window.getSelection().removeAllRanges();},exit: function presentationModeExit() {- var page = PDFView.page;+ var page = PDFViewerApplication.page;// Ensure that the correct page is scrolled into view when exiting// Presentation Mode, by waiting until fullscreen mode is disabled.// Note: This is only necessary in non-Mozilla browsers.setTimeout(function exitPresentationModeTimeout() {this.active = false;- PDFView.setScale(this.args.previousScale);- PDFView.page = page;+ this._notifyStateChange();++ PDFViewerApplication.setScale(this.args.previousScale, true);+ PDFViewerApplication.page = page;this.args = null;}.bind(this), 0);@@ -1925,7 +2085,7 @@ var PresentationMode = {window.removeEventListener('contextmenu', this.contextMenu, false);this.hideControls();- PDFView.clearMouseScrollState();+ PDFViewerApplication.clearMouseScrollState();HandTool.exitPresentationMode();this.container.removeAttribute('contextmenu');this.contextMenuOpen = false;@@ -1987,7 +2147,7 @@ var PresentationMode = {if (!isInternalLink) {// Unless an internal link was clicked, advance one page.evt.preventDefault();- PDFView.page += (evt.shiftKey ? -1 : 1);+ PDFViewerApplication.page += (evt.shiftKey ? -1 : 1);}}},@@ -2151,6 +2311,11 @@ var GrabToPan = (function GrabToPanClosure() {event.preventDefault();event.stopPropagation();this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING);++ var focusedElement = document.activeElement;+ if (focusedElement && !focusedElement.contains(event.target)) {+ focusedElement.blur();+ }},/**@@ -2495,6 +2660,8 @@ var DocumentProperties = {producerField: null,versionField: null,pageCountField: null,+ url: null,+ pdfDocument: null,initialize: function documentPropertiesInitialize(options) {this.overlayName = options.overlayName;@@ -2532,7 +2699,7 @@ var DocumentProperties = {return;}// Get the file size (if it hasn't already been set).- PDFView.pdfDocument.getDownloadInfo().then(function(data) {+ this.pdfDocument.getDownloadInfo().then(function(data) {if (data.length === this.rawFileSize) {return;}@@ -2541,10 +2708,10 @@ var DocumentProperties = {}.bind(this));// Get the document properties.- PDFView.pdfDocument.getMetadata().then(function(data) {+ this.pdfDocument.getMetadata().then(function(data) {var fields = [{ field: this.fileNameField,- content: getPDFFileNameFromURL(PDFView.url) },+ content: getPDFFileNameFromURL(this.url) },{ field: this.fileSizeField, content: this.parseFileSize() },{ field: this.titleField, content: data.info.Title },{ field: this.authorField, content: data.info.Author },@@ -2557,7 +2724,7 @@ var DocumentProperties = {{ field: this.creatorField, content: data.info.Creator },{ field: this.producerField, content: data.info.Producer },{ field: this.versionField, content: data.info.PDFFormatVersion },- { field: this.pageCountField, content: PDFView.pdfDocument.numPages }+ { field: this.pageCountField, content: this.pdfDocument.numPages }];// Show the properties in the dialog.@@ -2610,7 +2777,7 @@ var DocumentProperties = {parseDate: function documentPropertiesParseDate(inputDate) {// This is implemented according to the PDF specification (see- // http://www.gnupdf.org/Date for an overview), but note that+ // http://www.gnupdf.org/Date for an overview), but note that// Adobe Reader doesn't handle changing the date to universal time// and doesn't use the user's time zone (they're effectively ignoring// the HH' and mm' parts of the date string).@@ -2644,7 +2811,7 @@ var DocumentProperties = {minutes += offsetMinutes;} else if (utRel === '+') {hours -= offsetHours;- minutes += offsetMinutes;+ minutes -= offsetMinutes;}// Return the new date format from the user's locale.@@ -2658,2045 +2825,2223 @@ var DocumentProperties = {};-var PDFView = {- pages: [],- thumbnails: [],- currentScale: UNKNOWN_SCALE,- currentScaleValue: null,- initialBookmark: document.location.hash.substring(1),- container: null,- thumbnailContainer: null,- initialized: false,- fellback: false,- pdfDocument: null,- sidebarOpen: false,- printing: false,- pageViewScroll: null,- thumbnailViewScroll: null,- pageRotation: 0,- mouseScrollTimeStamp: 0,- mouseScrollDelta: 0,- lastScroll: 0,- previousPageNumber: 1,- isViewerEmbedded: (window.parent !== window),- idleTimeout: null,- currentPosition: null,- url: '',-- // called once when the document is loaded- initialize: function pdfViewInitialize() {- var self = this;- var container = this.container = document.getElementById('viewerContainer');- this.pageViewScroll = {};- this.watchScroll(container, this.pageViewScroll, updateViewarea);-- var thumbnailContainer = this.thumbnailContainer =- document.getElementById('thumbnailView');- this.thumbnailViewScroll = {};- this.watchScroll(thumbnailContainer, this.thumbnailViewScroll,- this.renderHighestPriority.bind(this));+var PresentationModeState = {+ UNKNOWN: 0,+ NORMAL: 1,+ CHANGING: 2,+ FULLSCREEN: 3,+};- Preferences.initialize();+var IGNORE_CURRENT_POSITION_ON_ZOOM = false;+var DEFAULT_CACHE_SIZE = 10;- this.findController = new PDFFindController({- pdfPageSource: this,- integratedFind: this.supportsIntegratedFind- });- this.findBar = new PDFFindBar({- bar: document.getElementById('findbar'),- toggleButton: document.getElementById('viewFind'),- findField: document.getElementById('findInput'),- highlightAllCheckbox: document.getElementById('findHighlightAll'),- caseSensitiveCheckbox: document.getElementById('findMatchCase'),- findMsg: document.getElementById('findMsg'),- findStatusIcon: document.getElementById('findStatusIcon'),- findPreviousButton: document.getElementById('findPrevious'),- findNextButton: document.getElementById('findNext'),- findController: this.findController- });+var CLEANUP_TIMEOUT = 30000;- this.findController.setFindBar(this.findBar);+var RenderingStates = {+ INITIAL: 0,+ RUNNING: 1,+ PAUSED: 2,+ FINISHED: 3+};- HandTool.initialize({- container: container,- toggleHandTool: document.getElementById('toggleHandTool')- });+/**+ * Controls rendering of the views for pages and thumbnails.+ * @class+ */+var PDFRenderingQueue = (function PDFRenderingQueueClosure() {+ /**+ * @constructs+ */+ function PDFRenderingQueue() {+ this.pdfViewer = null;+ this.pdfThumbnailViewer = null;+ this.onIdle = null;- SecondaryToolbar.initialize({- toolbar: document.getElementById('secondaryToolbar'),- presentationMode: PresentationMode,- toggleButton: document.getElementById('secondaryToolbarToggle'),- presentationModeButton:- document.getElementById('secondaryPresentationMode'),- openFile: document.getElementById('secondaryOpenFile'),- print: document.getElementById('secondaryPrint'),- download: document.getElementById('secondaryDownload'),- viewBookmark: document.getElementById('secondaryViewBookmark'),- firstPage: document.getElementById('firstPage'),- lastPage: document.getElementById('lastPage'),- pageRotateCw: document.getElementById('pageRotateCw'),- pageRotateCcw: document.getElementById('pageRotateCcw'),- documentProperties: DocumentProperties,- documentPropertiesButton: document.getElementById('documentProperties')- });+ this.highestPriorityPage = null;+ this.idleTimeout = null;+ this.printing = false;+ this.isThumbnailViewEnabled = false;+ }- PresentationMode.initialize({- container: container,- secondaryToolbar: SecondaryToolbar,- firstPage: document.getElementById('contextFirstPage'),- lastPage: document.getElementById('contextLastPage'),- pageRotateCw: document.getElementById('contextPageRotateCw'),- pageRotateCcw: document.getElementById('contextPageRotateCcw')- });+ PDFRenderingQueue.prototype = /** @lends PDFRenderingQueue.prototype */ {+ /**+ * @param {PDFViewer} pdfViewer+ */+ setViewer: function PDFRenderingQueue_setViewer(pdfViewer) {+ this.pdfViewer = pdfViewer;+ },- PasswordPrompt.initialize({- overlayName: 'passwordOverlay',- passwordField: document.getElementById('password'),- passwordText: document.getElementById('passwordText'),- passwordSubmit: document.getElementById('passwordSubmit'),- passwordCancel: document.getElementById('passwordCancel')- });+ /**+ * @param {PDFThumbnailViewer} pdfThumbnailViewer+ */+ setThumbnailViewer:+ function PDFRenderingQueue_setThumbnailViewer(pdfThumbnailViewer) {+ this.pdfThumbnailViewer = pdfThumbnailViewer;+ },- DocumentProperties.initialize({- overlayName: 'documentPropertiesOverlay',- closeButton: document.getElementById('documentPropertiesClose'),- fileNameField: document.getElementById('fileNameField'),- fileSizeField: document.getElementById('fileSizeField'),- titleField: document.getElementById('titleField'),- authorField: document.getElementById('authorField'),- subjectField: document.getElementById('subjectField'),- keywordsField: document.getElementById('keywordsField'),- creationDateField: document.getElementById('creationDateField'),- modificationDateField: document.getElementById('modificationDateField'),- creatorField: document.getElementById('creatorField'),- producerField: document.getElementById('producerField'),- versionField: document.getElementById('versionField'),- pageCountField: document.getElementById('pageCountField')- });+ /**+ * @param {IRenderableView} view+ * @returns {boolean}+ */+ isHighestPriority: function PDFRenderingQueue_isHighestPriority(view) {+ return this.highestPriorityPage === view.renderingId;+ },- container.addEventListener('scroll', function() {- self.lastScroll = Date.now();- }, false);+ renderHighestPriority: function+ PDFRenderingQueue_renderHighestPriority(currentlyVisiblePages) {+ if (this.idleTimeout) {+ clearTimeout(this.idleTimeout);+ this.idleTimeout = null;+ }- var initializedPromise = Promise.all([- Preferences.get('enableWebGL').then(function resolved(value) {- PDFJS.disableWebGL = !value;- }),- Preferences.get('sidebarViewOnLoad').then(function resolved(value) {- self.preferenceSidebarViewOnLoad = value;- }),- Preferences.get('disableTextLayer').then(function resolved(value) {- if (PDFJS.disableTextLayer === true) {+ // Pages have a higher priority than thumbnails, so check them first.+ if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {+ return;+ }+ // No pages needed rendering so check thumbnails.+ if (this.pdfThumbnailViewer && this.isThumbnailViewEnabled) {+ if (this.pdfThumbnailViewer.forceRendering()) {return;}- PDFJS.disableTextLayer = value;- }),- Preferences.get('disableRange').then(function resolved(value) {- if (PDFJS.disableRange === true) {- return;- }- PDFJS.disableRange = value;- }),- Preferences.get('disableAutoFetch').then(function resolved(value) {- PDFJS.disableAutoFetch = value;- }),- Preferences.get('disableFontFace').then(function resolved(value) {- if (PDFJS.disableFontFace === true) {- return;- }- PDFJS.disableFontFace = value;- }),- Preferences.get('useOnlyCssZoom').then(function resolved(value) {- PDFJS.useOnlyCssZoom = value;- })- // TODO move more preferences and other async stuff here- ]).catch(function (reason) { });+ }- return initializedPromise.then(function () {- PDFView.initialized = true;- });- },+ if (this.printing) {+ // If printing is currently ongoing do not reschedule cleanup.+ return;+ }- getPage: function pdfViewGetPage(n) {- return this.pdfDocument.getPage(n);- },+ if (this.onIdle) {+ this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);+ }+ },- // Helper function to keep track whether a div was scrolled up or down and- // then call a callback.- watchScroll: function pdfViewWatchScroll(viewAreaElement, state, callback) {- state.down = true;- state.lastY = viewAreaElement.scrollTop;- state.rAF = null;- viewAreaElement.addEventListener('scroll', function debounceScroll(evt) {- if (state.rAF) {- return;+ getHighestPriority: function+ PDFRenderingQueue_getHighestPriority(visible, views, scrolledDown) {+ // The state has changed figure out which page has the highest priority to+ // render next (if any).+ // Priority:+ // 1 visible pages+ // 2 if last scrolled down page after the visible pages+ // 2 if last scrolled up page before the visible pages+ var visibleViews = visible.views;++ var numVisible = visibleViews.length;+ if (numVisible === 0) {+ return false;}- // schedule an invocation of webViewerScrolled for next animation frame.- state.rAF = window.requestAnimationFrame(function webViewerScrolled() {- state.rAF = null;- if (!PDFView.pdfDocument) {- return;- }- var currentY = viewAreaElement.scrollTop;- var lastY = state.lastY;- if (currentY > lastY) {- state.down = true;- } else if (currentY < lastY) {- state.down = false;+ for (var i = 0; i < numVisible; ++i) {+ var view = visibleViews[i].view;+ if (!this.isViewFinished(view)) {+ return view;}- // else do nothing and use previous value- state.lastY = currentY;- callback();- });- }, true);- },-- _setScaleUpdatePages: function pdfView_setScaleUpdatePages(- newScale, newValue, resetAutoSettings, noScroll) {- this.currentScaleValue = newValue;- if (newScale === this.currentScale) {- return;- }- for (var i = 0, ii = this.pages.length; i < ii; i++) {- this.pages[i].update(newScale);- }- this.currentScale = newScale;+ }- if (!noScroll) {- var page = this.page, dest;- if (this.currentPosition && !IGNORE_CURRENT_POSITION_ON_ZOOM) {- page = this.currentPosition.page;- dest = [null, { name: 'XYZ' }, this.currentPosition.left,- this.currentPosition.top, null];+ // All the visible views have rendered, try to render next/previous pages.+ if (scrolledDown) {+ var nextPageIndex = visible.last.id;+ // ID's start at 1 so no need to add 1.+ if (views[nextPageIndex] &&+ !this.isViewFinished(views[nextPageIndex])) {+ return views[nextPageIndex];+ }+ } else {+ var previousPageIndex = visible.first.id - 2;+ if (views[previousPageIndex] &&+ !this.isViewFinished(views[previousPageIndex])) {+ return views[previousPageIndex];+ }}- this.pages[page - 1].scrollIntoView(dest);- }- var event = document.createEvent('UIEvents');- event.initUIEvent('scalechange', false, false, window, 0);- event.scale = newScale;- event.resetAutoSettings = resetAutoSettings;- window.dispatchEvent(event);- },+ // Everything that needs to be rendered has been.+ return null;+ },- setScale: function pdfViewSetScale(value, resetAutoSettings, noScroll) {- if (value === 'custom') {- return;- }- var scale = parseFloat(value);+ /**+ * @param {IRenderableView} view+ * @returns {boolean}+ */+ isViewFinished: function PDFRenderingQueue_isViewFinished(view) {+ return view.renderingState === RenderingStates.FINISHED;+ },- if (scale > 0) {- this._setScaleUpdatePages(scale, value, true, noScroll);- } else {- var currentPage = this.pages[this.page - 1];- if (!currentPage) {- return;- }- var hPadding = PresentationMode.active ? 0 : SCROLLBAR_PADDING;- var vPadding = PresentationMode.active ? 0 : VERTICAL_PADDING;- var pageWidthScale = (this.container.clientWidth - hPadding) /- currentPage.width * currentPage.scale;- var pageHeightScale = (this.container.clientHeight - vPadding) /- currentPage.height * currentPage.scale;- switch (value) {- case 'page-actual':- scale = 1;- break;- case 'page-width':- scale = pageWidthScale;- break;- case 'page-height':- scale = pageHeightScale;+ /**+ * Render a page or thumbnail view. This calls the appropriate function+ * based on the views state. If the view is already rendered it will return+ * false.+ * @param {IRenderableView} view+ */+ renderView: function PDFRenderingQueue_renderView(view) {+ var state = view.renderingState;+ switch (state) {+ case RenderingStates.FINISHED:+ return false;+ case RenderingStates.PAUSED:+ this.highestPriorityPage = view.renderingId;+ view.resume();break;- case 'page-fit':- scale = Math.min(pageWidthScale, pageHeightScale);+ case RenderingStates.RUNNING:+ this.highestPriorityPage = view.renderingId;break;- case 'auto':- scale = Math.min(MAX_AUTO_SCALE, pageWidthScale);+ case RenderingStates.INITIAL:+ this.highestPriorityPage = view.renderingId;+ var continueRendering = function () {+ this.renderHighestPriority();+ }.bind(this);+ view.draw().then(continueRendering, continueRendering);break;- default:- console.error('pdfViewSetScale: \'' + value +- '\' is an unknown zoom value.');- return;}- this._setScaleUpdatePages(scale, value, resetAutoSettings, noScroll);-- selectScaleOption(value);- }- },+ return true;+ },+ };- zoomIn: function pdfViewZoomIn(ticks) {- var newScale = this.currentScale;- do {- newScale = (newScale * DEFAULT_SCALE_DELTA).toFixed(2);- newScale = Math.ceil(newScale * 10) / 10;- newScale = Math.min(MAX_SCALE, newScale);- } while (--ticks && newScale < MAX_SCALE);- this.setScale(newScale, true);- },+ return PDFRenderingQueue;+})();- zoomOut: function pdfViewZoomOut(ticks) {- var newScale = this.currentScale;- do {- newScale = (newScale / DEFAULT_SCALE_DELTA).toFixed(2);- newScale = Math.floor(newScale * 10) / 10;- newScale = Math.max(MIN_SCALE, newScale);- } while (--ticks && newScale > MIN_SCALE);- this.setScale(newScale, true);- },- set page(val) {- var pages = this.pages;- var event = document.createEvent('UIEvents');- event.initUIEvent('pagechange', false, false, window, 0);+var TEXT_LAYER_RENDER_DELAY = 200; // ms- if (!(0 < val && val <= pages.length)) {- this.previousPageNumber = val;- event.pageNumber = this.page;- window.dispatchEvent(event);- return;- }+/**+ * @typedef {Object} PDFPageViewOptions+ * @property {HTMLDivElement} container - The viewer element.+ * @property {number} id - The page unique ID (normally its number).+ * @property {number} scale - The page scale display.+ * @property {PageViewport} defaultViewport - The page viewport.+ * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.+ * @property {IPDFTextLayerFactory} textLayerFactory+ * @property {IPDFAnnotationsLayerFactory} annotationsLayerFactory+ */- pages[val - 1].updateStats();- this.previousPageNumber = currentPageNumber;- currentPageNumber = val;- event.pageNumber = val;- window.dispatchEvent(event);+/**+ * @class+ * @implements {IRenderableView}+ */+var PDFPageView = (function PDFPageViewClosure() {+ /**+ * @constructs PDFPageView+ * @param {PDFPageViewOptions} options+ */+ function PDFPageView(options) {+ var container = options.container;+ var id = options.id;+ var scale = options.scale;+ var defaultViewport = options.defaultViewport;+ var renderingQueue = options.renderingQueue;+ var textLayerFactory = options.textLayerFactory;+ var annotationsLayerFactory = options.annotationsLayerFactory;++ this.id = id;+ this.renderingId = 'page' + id;++ this.rotation = 0;+ this.scale = scale || 1.0;+ this.viewport = defaultViewport;+ this.pdfPageRotate = defaultViewport.rotation;+ this.hasRestrictedScaling = false;++ this.renderingQueue = renderingQueue;+ this.textLayerFactory = textLayerFactory;+ this.annotationsLayerFactory = annotationsLayerFactory;- // checking if the this.page was called from the updateViewarea function:- // avoiding the creation of two "set page" method (internal and public)- if (updateViewarea.inProgress) {- return;- }- // Avoid scrolling the first page during loading- if (this.loading && val === 1) {- return;- }- pages[val - 1].scrollIntoView();- },+ this.renderingState = RenderingStates.INITIAL;+ this.resume = null;- get page() {- return currentPageNumber;- },+ this.onBeforeDraw = null;+ this.onAfterDraw = null;- get supportsPrinting() {- var canvas = document.createElement('canvas');- var value = 'mozPrintCallback' in canvas;- // shadow- Object.defineProperty(this, 'supportsPrinting', { value: value,- enumerable: true,- configurable: true,- writable: false });- return value;- },+ this.textLayer = null;- get supportsFullscreen() {- var doc = document.documentElement;- var support = doc.requestFullscreen || doc.mozRequestFullScreen ||- doc.webkitRequestFullScreen || doc.msRequestFullscreen;+ this.zoomLayer = null;- if (document.fullscreenEnabled === false ||- document.mozFullScreenEnabled === false ||- document.webkitFullscreenEnabled === false ||- document.msFullscreenEnabled === false) {- support = false;- }+ this.annotationLayer = null;- Object.defineProperty(this, 'supportsFullscreen', { value: support,- enumerable: true,- configurable: true,- writable: false });- return support;- },+ var div = document.createElement('div');+ div.id = 'pageContainer' + this.id;+ div.className = 'page';+ div.style.width = Math.floor(this.viewport.width) + 'px';+ div.style.height = Math.floor(this.viewport.height) + 'px';+ this.div = div;- get supportsIntegratedFind() {- var support = false;- Object.defineProperty(this, 'supportsIntegratedFind', { value: support,- enumerable: true,- configurable: true,- writable: false });- return support;- },+ container.appendChild(div);+ }- get supportsDocumentFonts() {- var support = true;- Object.defineProperty(this, 'supportsDocumentFonts', { value: support,- enumerable: true,- configurable: true,- writable: false });- return support;- },+ PDFPageView.prototype = {+ setPdfPage: function PDFPageView_setPdfPage(pdfPage) {+ this.pdfPage = pdfPage;+ this.pdfPageRotate = pdfPage.rotate;+ var totalRotation = (this.rotation + this.pdfPageRotate) % 360;+ this.viewport = pdfPage.getViewport(this.scale * CSS_UNITS,+ totalRotation);+ this.stats = pdfPage.stats;+ this.reset();+ },- get supportsDocumentColors() {- var support = true;- Object.defineProperty(this, 'supportsDocumentColors', { value: support,- enumerable: true,- configurable: true,- writable: false });- return support;- },+ destroy: function PDFPageView_destroy() {+ this.zoomLayer = null;+ this.reset();+ if (this.pdfPage) {+ this.pdfPage.destroy();+ }+ },- get loadingBar() {- var bar = new ProgressBar('#loadingBar', {});- Object.defineProperty(this, 'loadingBar', { value: bar,- enumerable: true,- configurable: true,- writable: false });- return bar;- },+ reset: function PDFPageView_reset(keepAnnotations) {+ if (this.renderTask) {+ this.renderTask.cancel();+ }+ this.resume = null;+ this.renderingState = RenderingStates.INITIAL;- get isHorizontalScrollbarEnabled() {- return (PresentationMode.active ? false :- (this.container.scrollWidth > this.container.clientWidth));- },+ var div = this.div;+ div.style.width = Math.floor(this.viewport.width) + 'px';+ div.style.height = Math.floor(this.viewport.height) + 'px';+ var childNodes = div.childNodes;+ var currentZoomLayer = this.zoomLayer || null;+ var currentAnnotationNode = (keepAnnotations && this.annotationLayer &&+ this.annotationLayer.div) || null;+ for (var i = childNodes.length - 1; i >= 0; i--) {+ var node = childNodes[i];+ if (currentZoomLayer === node || currentAnnotationNode === node) {+ continue;+ }+ div.removeChild(node);+ }+ div.removeAttribute('data-loaded');- setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) {- this.url = url;- try {- this.setTitle(decodeURIComponent(getFileName(url)) || url);- } catch (e) {- // decodeURIComponent may throw URIError,- // fall back to using the unprocessed url in that case- this.setTitle(url);- }- },+ if (keepAnnotations) {+ if (this.annotationLayer) {+ // Hide annotationLayer until all elements are resized+ // so they are not displayed on the already-resized page+ this.annotationLayer.hide();+ }+ } else {+ this.annotationLayer = null;+ }- setTitle: function pdfViewSetTitle(title) {- document.title = title;- },+ if (this.canvas) {+ // Zeroing the width and height causes Firefox to release graphics+ // resources immediately, which can greatly reduce memory consumption.+ this.canvas.width = 0;+ this.canvas.height = 0;+ delete this.canvas;+ }- close: function pdfViewClose() {- var errorWrapper = document.getElementById('errorWrapper');- errorWrapper.setAttribute('hidden', 'true');+ this.loadingIconDiv = document.createElement('div');+ this.loadingIconDiv.className = 'loadingIcon';+ div.appendChild(this.loadingIconDiv);+ },- if (!this.pdfDocument) {- return;- }+ update: function PDFPageView_update(scale, rotation) {+ this.scale = scale || this.scale;- this.pdfDocument.destroy();- this.pdfDocument = null;+ if (typeof rotation !== 'undefined') {+ this.rotation = rotation;+ }- var thumbsView = document.getElementById('thumbnailView');- while (thumbsView.hasChildNodes()) {- thumbsView.removeChild(thumbsView.lastChild);- }+ var totalRotation = (this.rotation + this.pdfPageRotate) % 360;+ this.viewport = this.viewport.clone({+ scale: this.scale * CSS_UNITS,+ rotation: totalRotation+ });- var container = document.getElementById('viewer');- while (container.hasChildNodes()) {- container.removeChild(container.lastChild);- }+ var isScalingRestricted = false;+ if (this.canvas && PDFJS.maxCanvasPixels > 0) {+ var ctx = this.canvas.getContext('2d');+ var outputScale = getOutputScale(ctx);+ var pixelsInViewport = this.viewport.width * this.viewport.height;+ var maxScale = Math.sqrt(PDFJS.maxCanvasPixels / pixelsInViewport);+ if (((Math.floor(this.viewport.width) * outputScale.sx) | 0) *+ ((Math.floor(this.viewport.height) * outputScale.sy) | 0) >+ PDFJS.maxCanvasPixels) {+ isScalingRestricted = true;+ }+ }- if (typeof PDFBug !== 'undefined') {- PDFBug.cleanup();- }- },+ if (this.canvas &&+ (PDFJS.useOnlyCssZoom ||+ (this.hasRestrictedScaling && isScalingRestricted))) {+ this.cssTransform(this.canvas, true);+ return;+ } else if (this.canvas && !this.zoomLayer) {+ this.zoomLayer = this.canvas.parentNode;+ this.zoomLayer.style.position = 'absolute';+ }+ if (this.zoomLayer) {+ this.cssTransform(this.zoomLayer.firstChild);+ }+ this.reset(true);+ },- // TODO(mack): This function signature should really be pdfViewOpen(url, args)- open: function pdfViewOpen(url, scale, password,- pdfDataRangeTransport, args) {- if (this.pdfDocument) {- // Reload the preferences if a document was previously opened.- Preferences.reload();- }- this.close();+ /**+ * Called when moved in the parent's container.+ */+ updatePosition: function PDFPageView_updatePosition() {+ if (this.textLayer) {+ this.textLayer.render(TEXT_LAYER_RENDER_DELAY);+ }+ },- var parameters = {password: password};- if (typeof url === 'string') { // URL- this.setTitleUsingUrl(url);- parameters.url = url;- } else if (url && 'byteLength' in url) { // ArrayBuffer- parameters.data = url;- }- if (args) {- for (var prop in args) {- parameters[prop] = args[prop];+ cssTransform: function PDFPageView_transform(canvas, redrawAnnotations) {+ // Scale canvas, canvas wrapper, and page container.+ var width = this.viewport.width;+ var height = this.viewport.height;+ var div = this.div;+ canvas.style.width = canvas.parentNode.style.width = div.style.width =+ Math.floor(width) + 'px';+ canvas.style.height = canvas.parentNode.style.height = div.style.height =+ Math.floor(height) + 'px';+ // The canvas may have been originally rotated, rotate relative to that.+ var relativeRotation = this.viewport.rotation - canvas._viewport.rotation;+ var absRotation = Math.abs(relativeRotation);+ var scaleX = 1, scaleY = 1;+ if (absRotation === 90 || absRotation === 270) {+ // Scale x and y because of the rotation.+ scaleX = height / width;+ scaleY = width / height;+ }+ var cssTransform = 'rotate(' + relativeRotation + 'deg) ' ++ 'scale(' + scaleX + ',' + scaleY + ')';+ CustomStyle.setProp('transform', canvas, cssTransform);++ if (this.textLayer) {+ // Rotating the text layer is more complicated since the divs inside the+ // the text layer are rotated.+ // TODO: This could probably be simplified by drawing the text layer in+ // one orientation then rotating overall.+ var textLayerViewport = this.textLayer.viewport;+ var textRelativeRotation = this.viewport.rotation -+ textLayerViewport.rotation;+ var textAbsRotation = Math.abs(textRelativeRotation);+ var scale = width / textLayerViewport.width;+ if (textAbsRotation === 90 || textAbsRotation === 270) {+ scale = width / textLayerViewport.height;+ }+ var textLayerDiv = this.textLayer.textLayerDiv;+ var transX, transY;+ switch (textAbsRotation) {+ case 0:+ transX = transY = 0;+ break;+ case 90:+ transX = 0;+ transY = '-' + textLayerDiv.style.height;+ break;+ case 180:+ transX = '-' + textLayerDiv.style.width;+ transY = '-' + textLayerDiv.style.height;+ break;+ case 270:+ transX = '-' + textLayerDiv.style.width;+ transY = 0;+ break;+ default:+ console.error('Bad rotation value.');+ break;+ }+ CustomStyle.setProp('transform', textLayerDiv,+ 'rotate(' + textAbsRotation + 'deg) ' ++ 'scale(' + scale + ', ' + scale + ') ' ++ 'translate(' + transX + ', ' + transY + ')');+ CustomStyle.setProp('transformOrigin', textLayerDiv, '0% 0%');}- }- var self = this;- self.loading = true;- self.downloadComplete = false;+ if (redrawAnnotations && this.annotationLayer) {+ this.annotationLayer.setupAnnotations(this.viewport);+ }+ },- var passwordNeeded = function passwordNeeded(updatePassword, reason) {- PasswordPrompt.updatePassword = updatePassword;- PasswordPrompt.reason = reason;- PasswordPrompt.open();- };+ get width() {+ return this.viewport.width;+ },- function getDocumentProgress(progressData) {- self.progress(progressData.loaded / progressData.total);- }+ get height() {+ return this.viewport.height;+ },- PDFJS.getDocument(parameters, pdfDataRangeTransport, passwordNeeded,- getDocumentProgress).then(- function getDocumentCallback(pdfDocument) {- self.load(pdfDocument, scale);- self.loading = false;- },- function getDocumentError(message, exception) {- var loadingErrorMessage = mozL10n.get('loading_error', null,- 'An error occurred while loading the PDF.');+ getPagePoint: function PDFPageView_getPagePoint(x, y) {+ return this.viewport.convertToPdfPoint(x, y);+ },- if (exception && exception.name === 'InvalidPDFException') {- // change error message also for other builds- loadingErrorMessage = mozL10n.get('invalid_file_error', null,- 'Invalid or corrupted PDF file.');- }+ draw: function PDFPageView_draw() {+ if (this.renderingState !== RenderingStates.INITIAL) {+ console.error('Must be in new state before drawing');+ }- if (exception && exception.name === 'MissingPDFException') {- // special message for missing PDF's- loadingErrorMessage = mozL10n.get('missing_file_error', null,- 'Missing PDF file.');+ this.renderingState = RenderingStates.RUNNING;- }+ var pdfPage = this.pdfPage;+ var viewport = this.viewport;+ var div = this.div;+ // Wrap the canvas so if it has a css transform for highdpi the overflow+ // will be hidden in FF.+ var canvasWrapper = document.createElement('div');+ canvasWrapper.style.width = div.style.width;+ canvasWrapper.style.height = div.style.height;+ canvasWrapper.classList.add('canvasWrapper');- var moreInfo = {- message: message- };- self.error(loadingErrorMessage, moreInfo);- self.loading = false;+ var canvas = document.createElement('canvas');+ canvas.id = 'page' + this.id;+ canvasWrapper.appendChild(canvas);+ if (this.annotationLayer) {+ // annotationLayer needs to stay on top+ div.insertBefore(canvasWrapper, this.annotationLayer.div);+ } else {+ div.appendChild(canvasWrapper);}- );+ this.canvas = canvas;- if (args && args.length) {- DocumentProperties.setFileSize(args.length);- }- },+ var ctx = canvas.getContext('2d');+ var outputScale = getOutputScale(ctx);- download: function pdfViewDownload() {- function downloadByUrl() {- downloadManager.downloadUrl(url, filename);- }+ if (PDFJS.useOnlyCssZoom) {+ var actualSizeViewport = viewport.clone({ scale: CSS_UNITS });+ // Use a scale that will make the canvas be the original intended size+ // of the page.+ outputScale.sx *= actualSizeViewport.width / viewport.width;+ outputScale.sy *= actualSizeViewport.height / viewport.height;+ outputScale.scaled = true;+ }- var url = this.url.split('#')[0];- var filename = getPDFFileNameFromURL(url);- var downloadManager = new DownloadManager();- downloadManager.onerror = function (err) {- // This error won't really be helpful because it's likely the- // fallback won't work either (or is already open).- PDFView.error('PDF failed to download.');- };+ if (PDFJS.maxCanvasPixels > 0) {+ var pixelsInViewport = viewport.width * viewport.height;+ var maxScale = Math.sqrt(PDFJS.maxCanvasPixels / pixelsInViewport);+ if (outputScale.sx > maxScale || outputScale.sy > maxScale) {+ outputScale.sx = maxScale;+ outputScale.sy = maxScale;+ outputScale.scaled = true;+ this.hasRestrictedScaling = true;+ } else {+ this.hasRestrictedScaling = false;+ }+ }- if (!this.pdfDocument) { // the PDF is not ready yet- downloadByUrl();- return;- }+ canvas.width = (Math.floor(viewport.width) * outputScale.sx) | 0;+ canvas.height = (Math.floor(viewport.height) * outputScale.sy) | 0;+ canvas.style.width = Math.floor(viewport.width) + 'px';+ canvas.style.height = Math.floor(viewport.height) + 'px';+ // Add the viewport so it's known what it was originally drawn with.+ canvas._viewport = viewport;++ var textLayerDiv = null;+ var textLayer = null;+ if (this.textLayerFactory) {+ textLayerDiv = document.createElement('div');+ textLayerDiv.className = 'textLayer';+ textLayerDiv.style.width = canvas.style.width;+ textLayerDiv.style.height = canvas.style.height;+ if (this.annotationLayer) {+ // annotationLayer needs to stay on top+ div.insertBefore(textLayerDiv, this.annotationLayer.div);+ } else {+ div.appendChild(textLayerDiv);+ }- if (!this.downloadComplete) { // the PDF is still downloading- downloadByUrl();- return;- }+ textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv,+ this.id - 1,+ this.viewport);+ }+ this.textLayer = textLayer;- this.pdfDocument.getData().then(- function getDataSuccess(data) {- var blob = PDFJS.createBlob(data, 'application/pdf');- downloadManager.download(blob, url, filename);- },- downloadByUrl // Error occurred try downloading with just the url.- ).then(null, downloadByUrl);- },+ // TODO(mack): use data attributes to store these+ ctx._scaleX = outputScale.sx;+ ctx._scaleY = outputScale.sy;+ if (outputScale.scaled) {+ ctx.scale(outputScale.sx, outputScale.sy);+ }- fallback: function pdfViewFallback(featureId) {- return;- },+ var resolveRenderPromise, rejectRenderPromise;+ var promise = new Promise(function (resolve, reject) {+ resolveRenderPromise = resolve;+ rejectRenderPromise = reject;+ });- navigateTo: function pdfViewNavigateTo(dest) {- var destString = '';- var self = this;+ // Rendering area- var goToDestination = function(destRef) {- self.pendingRefStr = null;- // dest array looks like that: <page-ref> </XYZ|FitXXX> <args..>- var pageNumber = destRef instanceof Object ?- self.pagesRefMap[destRef.num + ' ' + destRef.gen + ' R'] :- (destRef + 1);- if (pageNumber) {- if (pageNumber > self.pages.length) {- pageNumber = self.pages.length;+ var self = this;+ function pageViewDrawCallback(error) {+ // The renderTask may have been replaced by a new one, so only remove+ // the reference to the renderTask if it matches the one that is+ // triggering this callback.+ if (renderTask === self.renderTask) {+ self.renderTask = null;}- var currentPage = self.pages[pageNumber - 1];- currentPage.scrollIntoView(dest);- // Update the browsing history.- PDFHistory.push({ dest: dest, hash: destString, page: pageNumber });- } else {- self.pdfDocument.getPageIndex(destRef).then(function (pageIndex) {- var pageNum = pageIndex + 1;- self.pagesRefMap[destRef.num + ' ' + destRef.gen + ' R'] = pageNum;- goToDestination(destRef);- });- }- };+ if (error === 'cancelled') {+ rejectRenderPromise(error);+ return;+ }- this.destinationsPromise.then(function() {- if (typeof dest === 'string') {- destString = dest;- dest = self.destinations[dest];- }- if (!(dest instanceof Array)) {- return; // invalid destination- }- goToDestination(dest[0]);- });- },+ self.renderingState = RenderingStates.FINISHED;- getDestinationHash: function pdfViewGetDestinationHash(dest) {- if (typeof dest === 'string') {- return PDFView.getAnchorUrl('#' + escape(dest));- }- if (dest instanceof Array) {- var destRef = dest[0]; // see navigateTo method for dest format- var pageNumber = destRef instanceof Object ?- this.pagesRefMap[destRef.num + ' ' + destRef.gen + ' R'] :- (destRef + 1);- if (pageNumber) {- var pdfOpenParams = PDFView.getAnchorUrl('#page=' + pageNumber);- var destKind = dest[1];- if (typeof destKind === 'object' && 'name' in destKind &&- destKind.name === 'XYZ') {- var scale = (dest[4] || this.currentScaleValue);- var scaleNumber = parseFloat(scale);- if (scaleNumber) {- scale = scaleNumber * 100;- }- pdfOpenParams += '&zoom=' + scale;- if (dest[2] || dest[3]) {- pdfOpenParams += ',' + (dest[2] || 0) + ',' + (dest[3] || 0);- }+ if (self.loadingIconDiv) {+ div.removeChild(self.loadingIconDiv);+ delete self.loadingIconDiv;}- return pdfOpenParams;- }- }- return '';- },- /**- * Prefix the full url on anchor links to make sure that links are resolved- * relative to the current URL instead of the one defined in <base href>.- * @param {String} anchor The anchor hash, including the #.- */- getAnchorUrl: function getAnchorUrl(anchor) {- return anchor;- },+ if (self.zoomLayer) {+ div.removeChild(self.zoomLayer);+ self.zoomLayer = null;+ }- /**- * Show the error box.- * @param {String} message A message that is human readable.- * @param {Object} moreInfo (optional) Further information about the error- * that is more technical. Should have a 'message'- * and optionally a 'stack' property.- */- error: function pdfViewError(message, moreInfo) {- var moreInfoText = mozL10n.get('error_version_info',- {version: PDFJS.version || '?', build: PDFJS.build || '?'},- 'PDF.js v{{version}} (build: {{build}})') + '\n';- if (moreInfo) {- moreInfoText +=- mozL10n.get('error_message', {message: moreInfo.message},- 'Message: {{message}}');- if (moreInfo.stack) {- moreInfoText += '\n' +- mozL10n.get('error_stack', {stack: moreInfo.stack},- 'Stack: {{stack}}');- } else {- if (moreInfo.filename) {- moreInfoText += '\n' +- mozL10n.get('error_file', {file: moreInfo.filename},- 'File: {{file}}');+ self.error = error;+ self.stats = pdfPage.stats;+ if (self.onAfterDraw) {+ self.onAfterDraw();}- if (moreInfo.lineNumber) {- moreInfoText += '\n' +- mozL10n.get('error_line', {line: moreInfo.lineNumber},- 'Line: {{line}}');+ var event = document.createEvent('CustomEvent');+ event.initCustomEvent('pagerendered', true, true, {+ pageNumber: self.id+ });+ div.dispatchEvent(event);+ // This custom event is deprecated, and will be removed in the future,+ // please use the |pagerendered| event instead.+ var deprecatedEvent = document.createEvent('CustomEvent');+ deprecatedEvent.initCustomEvent('pagerender', true, true, {+ pageNumber: pdfPage.pageNumber+ });+ div.dispatchEvent(deprecatedEvent);++ if (!error) {+ resolveRenderPromise(undefined);+ } else {+ rejectRenderPromise(error);}}- }- var errorWrapper = document.getElementById('errorWrapper');- errorWrapper.removeAttribute('hidden');+ var renderContinueCallback = null;+ if (this.renderingQueue) {+ renderContinueCallback = function renderContinueCallback(cont) {+ if (!self.renderingQueue.isHighestPriority(self)) {+ self.renderingState = RenderingStates.PAUSED;+ self.resume = function resumeCallback() {+ self.renderingState = RenderingStates.RUNNING;+ cont();+ };+ return;+ }+ cont();+ };+ }- var errorMessage = document.getElementById('errorMessage');- errorMessage.textContent = message;+ var renderContext = {+ canvasContext: ctx,+ viewport: this.viewport,+ // intent: 'default', // === 'display'+ continueCallback: renderContinueCallback+ };+ var renderTask = this.renderTask = this.pdfPage.render(renderContext);++ this.renderTask.promise.then(+ function pdfPageRenderCallback() {+ pageViewDrawCallback(null);+ if (textLayer) {+ self.pdfPage.getTextContent().then(+ function textContentResolved(textContent) {+ textLayer.setTextContent(textContent);+ textLayer.render(TEXT_LAYER_RENDER_DELAY);+ }+ );+ }+ },+ function pdfPageRenderError(error) {+ pageViewDrawCallback(error);+ }+ );- var closeButton = document.getElementById('errorClose');- closeButton.onclick = function() {- errorWrapper.setAttribute('hidden', 'true');- };+ if (this.annotationsLayerFactory) {+ if (!this.annotationLayer) {+ this.annotationLayer = this.annotationsLayerFactory.+ createAnnotationsLayerBuilder(div, this.pdfPage);+ }+ this.annotationLayer.setupAnnotations(this.viewport);+ }+ div.setAttribute('data-loaded', true);- var errorMoreInfo = document.getElementById('errorMoreInfo');- var moreInfoButton = document.getElementById('errorShowMore');- var lessInfoButton = document.getElementById('errorShowLess');- moreInfoButton.onclick = function() {- errorMoreInfo.removeAttribute('hidden');- moreInfoButton.setAttribute('hidden', 'true');- lessInfoButton.removeAttribute('hidden');- errorMoreInfo.style.height = errorMoreInfo.scrollHeight + 'px';- };- lessInfoButton.onclick = function() {- errorMoreInfo.setAttribute('hidden', 'true');- moreInfoButton.removeAttribute('hidden');- lessInfoButton.setAttribute('hidden', 'true');- };- moreInfoButton.oncontextmenu = noContextMenuHandler;- lessInfoButton.oncontextmenu = noContextMenuHandler;- closeButton.oncontextmenu = noContextMenuHandler;- moreInfoButton.removeAttribute('hidden');- lessInfoButton.setAttribute('hidden', 'true');- errorMoreInfo.value = moreInfoText;- },+ if (self.onBeforeDraw) {+ self.onBeforeDraw();+ }+ return promise;+ },- progress: function pdfViewProgress(level) {- var percent = Math.round(level * 100);- // When we transition from full request to range requests, it's possible- // that we discard some of the loaded data. This can cause the loading- // bar to move backwards. So prevent this by only updating the bar if it- // increases.- if (percent > PDFView.loadingBar.percent || isNaN(percent)) {- PDFView.loadingBar.percent = percent;- }- },+ beforePrint: function PDFPageView_beforePrint() {+ var pdfPage = this.pdfPage;- load: function pdfViewLoad(pdfDocument, scale) {- var self = this;- var isOnePageRenderedResolved = false;- var resolveOnePageRendered = null;- var onePageRendered = new Promise(function (resolve) {- resolveOnePageRendered = resolve;- });- function bindOnAfterDraw(pageView, thumbnailView) {- // when page is painted, using the image as thumbnail base- pageView.onAfterDraw = function pdfViewLoadOnAfterDraw() {- if (!isOnePageRenderedResolved) {- isOnePageRenderedResolved = true;- resolveOnePageRendered();- }- thumbnailView.setImage(pageView.canvas);+ var viewport = pdfPage.getViewport(1);+ // Use the same hack we use for high dpi displays for printing to get+ // better output until bug 811002 is fixed in FF.+ var PRINT_OUTPUT_SCALE = 2;+ var canvas = document.createElement('canvas');+ canvas.width = Math.floor(viewport.width) * PRINT_OUTPUT_SCALE;+ canvas.height = Math.floor(viewport.height) * PRINT_OUTPUT_SCALE;+ canvas.style.width = (PRINT_OUTPUT_SCALE * viewport.width) + 'pt';+ canvas.style.height = (PRINT_OUTPUT_SCALE * viewport.height) + 'pt';+ var cssScale = 'scale(' + (1 / PRINT_OUTPUT_SCALE) + ', ' ++ (1 / PRINT_OUTPUT_SCALE) + ')';+ CustomStyle.setProp('transform' , canvas, cssScale);+ CustomStyle.setProp('transformOrigin' , canvas, '0% 0%');++ var printContainer = document.getElementById('printContainer');+ var canvasWrapper = document.createElement('div');+ canvasWrapper.style.width = viewport.width + 'pt';+ canvasWrapper.style.height = viewport.height + 'pt';+ canvasWrapper.appendChild(canvas);+ printContainer.appendChild(canvasWrapper);++ canvas.mozPrintCallback = function(obj) {+ var ctx = obj.context;++ ctx.save();+ ctx.fillStyle = 'rgb(255, 255, 255)';+ ctx.fillRect(0, 0, canvas.width, canvas.height);+ ctx.restore();+ ctx.scale(PRINT_OUTPUT_SCALE, PRINT_OUTPUT_SCALE);++ var renderContext = {+ canvasContext: ctx,+ viewport: viewport,+ intent: 'print'+ };++ pdfPage.render(renderContext).promise.then(function() {+ // Tell the printEngine that rendering this canvas/page has finished.+ obj.done();+ }, function(error) {+ console.error(error);+ // Tell the printEngine that rendering this canvas/page has failed.+ // This will make the print proces stop.+ if ('abort' in obj) {+ obj.abort();+ } else {+ obj.done();+ }+ });};- }+ },+ };- PDFView.findController.reset();+ return PDFPageView;+})();- this.pdfDocument = pdfDocument;- DocumentProperties.resolveDataAvailable();+var MAX_TEXT_DIVS_TO_RENDER = 100000;- var downloadedPromise = pdfDocument.getDownloadInfo().then(function() {- self.downloadComplete = true;- PDFView.loadingBar.hide();- var outerContainer = document.getElementById('outerContainer');- outerContainer.classList.remove('loadingInProgress');- });+var NonWhitespaceRegexp = /\S/;- var pagesCount = pdfDocument.numPages;+function isAllWhitespace(str) {+ return !NonWhitespaceRegexp.test(str);+}- var id = pdfDocument.fingerprint;- document.getElementById('numPages').textContent =- mozL10n.get('page_of', {pageCount: pagesCount}, 'of {{pageCount}}');- document.getElementById('pageNumber').max = pagesCount;+/**+ * @typedef {Object} TextLayerBuilderOptions+ * @property {HTMLDivElement} textLayerDiv - The text layer container.+ * @property {number} pageIndex - The page index.+ * @property {PageViewport} viewport - The viewport of the text layer.+ * @property {PDFFindController} findController+ */- PDFView.documentFingerprint = id;- var store = PDFView.store = new ViewHistory(id);+/**+ * TextLayerBuilder provides text-selection functionality for the PDF.+ * It does this by creating overlay divs over the PDF text. These divs+ * contain text that matches the PDF text they are overlaying. This object+ * also provides a way to highlight text that is being searched for.+ * @class+ */+var TextLayerBuilder = (function TextLayerBuilderClosure() {+ function TextLayerBuilder(options) {+ this.textLayerDiv = options.textLayerDiv;+ this.renderingDone = false;+ this.divContentDone = false;+ this.pageIdx = options.pageIndex;+ this.pageNumber = this.pageIdx + 1;+ this.matches = [];+ this.viewport = options.viewport;+ this.textDivs = [];+ this.findController = options.findController || null;+ }- this.pageRotation = 0;+ TextLayerBuilder.prototype = {+ _finishRendering: function TextLayerBuilder_finishRendering() {+ this.renderingDone = true;- var pages = this.pages = [];- var pagesRefMap = this.pagesRefMap = {};- var thumbnails = this.thumbnails = [];+ var event = document.createEvent('CustomEvent');+ event.initCustomEvent('textlayerrendered', true, true, {+ pageNumber: this.pageNumber+ });+ this.textLayerDiv.dispatchEvent(event);+ },- var resolvePagesPromise;- var pagesPromise = new Promise(function (resolve) {- resolvePagesPromise = resolve;- });- this.pagesPromise = pagesPromise;+ renderLayer: function TextLayerBuilder_renderLayer() {+ var textLayerFrag = document.createDocumentFragment();+ var textDivs = this.textDivs;+ var textDivsLength = textDivs.length;+ var canvas = document.createElement('canvas');+ var ctx = canvas.getContext('2d');- var firstPagePromise = pdfDocument.getPage(1);- var container = document.getElementById('viewer');- var thumbsView = document.getElementById('thumbnailView');+ // No point in rendering many divs as it would make the browser+ // unusable even after the divs are rendered.+ if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) {+ this._finishRendering();+ return;+ }- // Fetch a single page so we can get a viewport that will be the default- // viewport for all pages- firstPagePromise.then(function(pdfPage) {- var viewport = pdfPage.getViewport((scale || 1.0) * CSS_UNITS);- for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {- var viewportClone = viewport.clone();- var pageView = new PageView(container, pageNum, scale,- self.navigateTo.bind(self),- viewportClone);- var thumbnailView = new ThumbnailView(thumbsView, pageNum,- viewportClone);- bindOnAfterDraw(pageView, thumbnailView);- pages.push(pageView);- thumbnails.push(thumbnailView);- }-- // Fetch all the pages since the viewport is needed before printing- // starts to create the correct size canvas. Wait until one page is- // rendered so we don't tie up too many resources early on.- onePageRendered.then(function () {- if (!PDFJS.disableAutoFetch) {- var getPagesLeft = pagesCount;- for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {- pdfDocument.getPage(pageNum).then(function (pageNum, pdfPage) {- var pageView = pages[pageNum - 1];- if (!pageView.pdfPage) {- pageView.setPdfPage(pdfPage);- }- var refStr = pdfPage.ref.num + ' ' + pdfPage.ref.gen + ' R';- pagesRefMap[refStr] = pageNum;- getPagesLeft--;- if (!getPagesLeft) {- resolvePagesPromise();- }- }.bind(null, pageNum));- }- } else {- // XXX: Printing is semi-broken with auto fetch disabled.- resolvePagesPromise();+ var lastFontSize;+ var lastFontFamily;+ for (var i = 0; i < textDivsLength; i++) {+ var textDiv = textDivs[i];+ if (textDiv.dataset.isWhitespace !== undefined) {+ continue;}- });- downloadedPromise.then(function () {- var event = document.createEvent('CustomEvent');- event.initCustomEvent('documentload', true, true, {});- window.dispatchEvent(event);- });+ var fontSize = textDiv.style.fontSize;+ var fontFamily = textDiv.style.fontFamily;- PDFView.loadingBar.setWidth(container);+ // Only build font string and set to context if different from last.+ if (fontSize !== lastFontSize || fontFamily !== lastFontFamily) {+ ctx.font = fontSize + ' ' + fontFamily;+ lastFontSize = fontSize;+ lastFontFamily = fontFamily;+ }- PDFView.findController.resolveFirstPage();+ var width = ctx.measureText(textDiv.textContent).width;+ if (width > 0) {+ textLayerFrag.appendChild(textDiv);+ var transform;+ if (textDiv.dataset.canvasWidth !== undefined) {+ // Dataset values come of type string.+ var textScale = textDiv.dataset.canvasWidth / width;+ transform = 'scaleX(' + textScale + ')';+ } else {+ transform = '';+ }+ var rotation = textDiv.dataset.angle;+ if (rotation) {+ transform = 'rotate(' + rotation + 'deg) ' + transform;+ }+ if (transform) {+ CustomStyle.setProp('transform' , textDiv, transform);+ }+ }+ }- // Initialize the browsing history.- PDFHistory.initialize(self.documentFingerprint);- });+ this.textLayerDiv.appendChild(textLayerFrag);+ this._finishRendering();+ this.updateMatches();+ },- // Fetch the necessary preference values.- var showPreviousViewOnLoad;- var showPreviousViewOnLoadPromise =- Preferences.get('showPreviousViewOnLoad').then(function (prefValue) {- showPreviousViewOnLoad = prefValue;- });- var defaultZoomValue;- var defaultZoomValuePromise =- Preferences.get('defaultZoomValue').then(function (prefValue) {- defaultZoomValue = prefValue;- });+ /**+ * Renders the text layer.+ * @param {number} timeout (optional) if specified, the rendering waits+ * for specified amount of ms.+ */+ render: function TextLayerBuilder_render(timeout) {+ if (!this.divContentDone || this.renderingDone) {+ return;+ }- var storePromise = store.initializedPromise;- Promise.all([firstPagePromise, storePromise, showPreviousViewOnLoadPromise,- defaultZoomValuePromise]).then(function resolved() {- var storedHash = null;- if (showPreviousViewOnLoad && store.get('exists', false)) {- var pageNum = store.get('page', '1');- var zoom = defaultZoomValue || store.get('zoom', PDFView.currentScale);- var left = store.get('scrollLeft', '0');- var top = store.get('scrollTop', '0');+ if (this.renderTimer) {+ clearTimeout(this.renderTimer);+ this.renderTimer = null;+ }- storedHash = 'page=' + pageNum + '&zoom=' + zoom + ',' +- left + ',' + top;- } else if (defaultZoomValue) {- storedHash = 'page=1&zoom=' + defaultZoomValue;+ if (!timeout) { // Render right away+ this.renderLayer();+ } else { // Schedule+ var self = this;+ this.renderTimer = setTimeout(function() {+ self.renderLayer();+ self.renderTimer = null;+ }, timeout);}- self.setInitialView(storedHash, scale);+ },- // Make all navigation keys work on document load,- // unless the viewer is embedded in a web page.- if (!self.isViewerEmbedded) {- self.container.focus();+ appendText: function TextLayerBuilder_appendText(geom, styles) {+ var style = styles[geom.fontName];+ var textDiv = document.createElement('div');+ this.textDivs.push(textDiv);+ if (isAllWhitespace(geom.str)) {+ textDiv.dataset.isWhitespace = true;+ return;+ }+ var tx = PDFJS.Util.transform(this.viewport.transform, geom.transform);+ var angle = Math.atan2(tx[1], tx[0]);+ if (style.vertical) {+ angle += Math.PI / 2;+ }+ var fontHeight = Math.sqrt((tx[2] * tx[2]) + (tx[3] * tx[3]));+ var fontAscent = fontHeight;+ if (style.ascent) {+ fontAscent = style.ascent * fontAscent;+ } else if (style.descent) {+ fontAscent = (1 + style.descent) * fontAscent;}- }, function rejected(reason) {- console.error(reason);- firstPagePromise.then(function () {- self.setInitialView(null, scale);- });- });+ var left;+ var top;+ if (angle === 0) {+ left = tx[4];+ top = tx[5] - fontAscent;+ } else {+ left = tx[4] + (fontAscent * Math.sin(angle));+ top = tx[5] - (fontAscent * Math.cos(angle));+ }+ textDiv.style.left = left + 'px';+ textDiv.style.top = top + 'px';+ textDiv.style.fontSize = fontHeight + 'px';+ textDiv.style.fontFamily = style.fontFamily;- pagesPromise.then(function() {- if (PDFView.supportsPrinting) {- pdfDocument.getJavaScript().then(function(javaScript) {- if (javaScript.length) {- console.warn('Warning: JavaScript is not supported');- PDFView.fallback(PDFJS.UNSUPPORTED_FEATURES.javaScript);- }- // Hack to support auto printing.- var regex = /\bprint\s*\(/g;- for (var i = 0, ii = javaScript.length; i < ii; i++) {- var js = javaScript[i];- if (js && regex.test(js)) {- setTimeout(function() {- window.print();- });- return;- }- }- });+ textDiv.textContent = geom.str;+ // |fontName| is only used by the Font Inspector. This test will succeed+ // when e.g. the Font Inspector is off but the Stepper is on, but it's+ // not worth the effort to do a more accurate test.+ if (PDFJS.pdfBug) {+ textDiv.dataset.fontName = geom.fontName;}- });+ // Storing into dataset will convert number into string.+ if (angle !== 0) {+ textDiv.dataset.angle = angle * (180 / Math.PI);+ }+ // We don't bother scaling single-char text divs, because it has very+ // little effect on text highlighting. This makes scrolling on docs with+ // lots of such divs a lot faster.+ if (textDiv.textContent.length > 1) {+ if (style.vertical) {+ textDiv.dataset.canvasWidth = geom.height * this.viewport.scale;+ } else {+ textDiv.dataset.canvasWidth = geom.width * this.viewport.scale;+ }+ }+ },- var destinationsPromise =- this.destinationsPromise = pdfDocument.getDestinations();- destinationsPromise.then(function(destinations) {- self.destinations = destinations;- });+ setTextContent: function TextLayerBuilder_setTextContent(textContent) {+ this.textContent = textContent;- // outline depends on destinations and pagesRefMap- var promises = [pagesPromise, destinationsPromise,- PDFView.animationStartedPromise];- Promise.all(promises).then(function() {- pdfDocument.getOutline().then(function(outline) {- self.outline = new DocumentOutlineView(outline);- document.getElementById('viewOutline').disabled = !outline;+ var textItems = textContent.items;+ for (var i = 0, len = textItems.length; i < len; i++) {+ this.appendText(textItems[i], textContent.styles);+ }+ this.divContentDone = true;+ },- if (outline &&- self.preferenceSidebarViewOnLoad === SidebarView.OUTLINE) {- self.switchSidebarView('outline', true);+ convertMatches: function TextLayerBuilder_convertMatches(matches) {+ var i = 0;+ var iIndex = 0;+ var bidiTexts = this.textContent.items;+ var end = bidiTexts.length - 1;+ var queryLen = (this.findController === null ?+ 0 : this.findController.state.query.length);+ var ret = [];++ for (var m = 0, len = matches.length; m < len; m++) {+ // Calculate the start position.+ var matchIdx = matches[m];++ // Loop over the divIdxs.+ while (i !== end && matchIdx >= (iIndex + bidiTexts[i].str.length)) {+ iIndex += bidiTexts[i].str.length;+ i++;}- });- pdfDocument.getAttachments().then(function(attachments) {- self.attachments = new DocumentAttachmentsView(attachments);- document.getElementById('viewAttachments').disabled = !attachments;- if (attachments &&- self.preferenceSidebarViewOnLoad === SidebarView.ATTACHMENTS) {- self.switchSidebarView('attachments', true);+ if (i === bidiTexts.length) {+ console.error('Could not find a matching mapping');}- });- });- if (self.preferenceSidebarViewOnLoad === SidebarView.THUMBS) {- Promise.all([firstPagePromise, onePageRendered]).then(function () {- self.switchSidebarView('thumbs', true);- });- }+ var match = {+ begin: {+ divIdx: i,+ offset: matchIdx - iIndex+ }+ };- pdfDocument.getMetadata().then(function(data) {- var info = data.info, metadata = data.metadata;- self.documentInfo = info;- self.metadata = metadata;+ // Calculate the end position.+ matchIdx += queryLen;- // Provides some basic debug information- console.log('PDF ' + pdfDocument.fingerprint + ' [' +- info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() +- ' / ' + (info.Creator || '-').trim() + ']' +- ' (PDF.js: ' + (PDFJS.version || '-') +- (!PDFJS.disableWebGL ? ' [WebGL]' : '') + ')');+ // Somewhat the same array as above, but use > instead of >= to get+ // the end position right.+ while (i !== end && matchIdx > (iIndex + bidiTexts[i].str.length)) {+ iIndex += bidiTexts[i].str.length;+ i++;+ }- var pdfTitle;- if (metadata && metadata.has('dc:title')) {- pdfTitle = metadata.get('dc:title');+ match.end = {+ divIdx: i,+ offset: matchIdx - iIndex+ };+ ret.push(match);}- if (!pdfTitle && info && info['Title']) {- pdfTitle = info['Title'];- }+ return ret;+ },- if (pdfTitle) {- self.setTitle(pdfTitle + ' - ' + document.title);+ renderMatches: function TextLayerBuilder_renderMatches(matches) {+ // Early exit if there is nothing to render.+ if (matches.length === 0) {+ return;}- if (info.IsAcroFormPresent) {- console.warn('Warning: AcroForm/XFA is not supported');- PDFView.fallback(PDFJS.UNSUPPORTED_FEATURES.forms);+ var bidiTexts = this.textContent.items;+ var textDivs = this.textDivs;+ var prevEnd = null;+ var pageIdx = this.pageIdx;+ var isSelectedPage = (this.findController === null ?+ false : (pageIdx === this.findController.selected.pageIdx));+ var selectedMatchIdx = (this.findController === null ?+ -1 : this.findController.selected.matchIdx);+ var highlightAll = (this.findController === null ?+ false : this.findController.state.highlightAll);+ var infinity = {+ divIdx: -1,+ offset: undefined+ };++ function beginText(begin, className) {+ var divIdx = begin.divIdx;+ textDivs[divIdx].textContent = '';+ appendTextToDiv(divIdx, 0, begin.offset, className);}- });- },+ function appendTextToDiv(divIdx, fromOffset, toOffset, className) {+ var div = textDivs[divIdx];+ var content = bidiTexts[divIdx].str.substring(fromOffset, toOffset);+ var node = document.createTextNode(content);+ if (className) {+ var span = document.createElement('span');+ span.className = className;+ span.appendChild(node);+ div.appendChild(span);+ return;+ }+ div.appendChild(node);+ }- setInitialView: function pdfViewSetInitialView(storedHash, scale) {- // Reset the current scale, as otherwise the page's scale might not get- // updated if the zoom level stayed the same.- this.currentScale = 0;- this.currentScaleValue = null;- // When opening a new file (when one is already loaded in the viewer):- // Reset 'currentPageNumber', since otherwise the page's scale will be wrong- // if 'currentPageNumber' is larger than the number of pages in the file.- document.getElementById('pageNumber').value = currentPageNumber = 1;- // Reset the current position when loading a new file,- // to prevent displaying the wrong position in the document.- this.currentPosition = null;+ var i0 = selectedMatchIdx, i1 = i0 + 1;+ if (highlightAll) {+ i0 = 0;+ i1 = matches.length;+ } else if (!isSelectedPage) {+ // Not highlighting all and this isn't the selected page, so do nothing.+ return;+ }- if (PDFHistory.initialDestination) {- this.navigateTo(PDFHistory.initialDestination);- PDFHistory.initialDestination = null;- } else if (this.initialBookmark) {- this.setHash(this.initialBookmark);- PDFHistory.push({ hash: this.initialBookmark }, !!this.initialBookmark);- this.initialBookmark = null;- } else if (storedHash) {- this.setHash(storedHash);- } else if (scale) {- this.setScale(scale, true);- this.page = 1;- }+ for (var i = i0; i < i1; i++) {+ var match = matches[i];+ var begin = match.begin;+ var end = match.end;+ var isSelected = (isSelectedPage && i === selectedMatchIdx);+ var highlightSuffix = (isSelected ? ' selected' : '');- if (PDFView.currentScale === UNKNOWN_SCALE) {- // Scale was not initialized: invalid bookmark or scale was not specified.- // Setting the default one.- this.setScale(DEFAULT_SCALE, true);- }- },+ if (this.findController) {+ this.findController.updateMatchPosition(pageIdx, i, textDivs,+ begin.divIdx, end.divIdx);+ }- renderHighestPriority:- function pdfViewRenderHighestPriority(currentlyVisiblePages) {- if (PDFView.idleTimeout) {- clearTimeout(PDFView.idleTimeout);- PDFView.idleTimeout = null;- }+ // Match inside new div.+ if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {+ // If there was a previous div, then add the text at the end.+ if (prevEnd !== null) {+ appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);+ }+ // Clear the divs and set the content until the starting point.+ beginText(begin);+ } else {+ appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);+ }- // Pages have a higher priority than thumbnails, so check them first.- var visiblePages = currentlyVisiblePages || this.getVisiblePages();- var pageView = this.getHighestPriority(visiblePages, this.pages,- this.pageViewScroll.down);- if (pageView) {- this.renderView(pageView, 'page');- return;- }- // No pages needed rendering so check thumbnails.- if (this.sidebarOpen) {- var visibleThumbs = this.getVisibleThumbs();- var thumbView = this.getHighestPriority(visibleThumbs,- this.thumbnails,- this.thumbnailViewScroll.down);- if (thumbView) {- this.renderView(thumbView, 'thumbnail');- return;+ if (begin.divIdx === end.divIdx) {+ appendTextToDiv(begin.divIdx, begin.offset, end.offset,+ 'highlight' + highlightSuffix);+ } else {+ appendTextToDiv(begin.divIdx, begin.offset, infinity.offset,+ 'highlight begin' + highlightSuffix);+ for (var n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {+ textDivs[n0].className = 'highlight middle' + highlightSuffix;+ }+ beginText(end, 'highlight end' + highlightSuffix);+ }+ prevEnd = end;}- }-- if (this.printing) {- // If printing is currently ongoing do not reschedule cleanup.- return;- }- PDFView.idleTimeout = setTimeout(function () {- PDFView.cleanup();- }, CLEANUP_TIMEOUT);- },+ if (prevEnd) {+ appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);+ }+ },- cleanup: function pdfViewCleanup() {- for (var i = 0, ii = this.pages.length; i < ii; i++) {- if (this.pages[i] &&- this.pages[i].renderingState !== RenderingStates.FINISHED) {- this.pages[i].reset();+ updateMatches: function TextLayerBuilder_updateMatches() {+ // Only show matches when all rendering is done.+ if (!this.renderingDone) {+ return;}- }- this.pdfDocument.cleanup();- ThumbnailView.tempImageCache = null;- },+ // Clear all matches.+ var matches = this.matches;+ var textDivs = this.textDivs;+ var bidiTexts = this.textContent.items;+ var clearedUntilDivIdx = -1;- getHighestPriority: function pdfViewGetHighestPriority(visible, views,- scrolledDown) {- // The state has changed figure out which page has the highest priority to- // render next (if any).- // Priority:- // 1 visible pages- // 2 if last scrolled down page after the visible pages- // 2 if last scrolled up page before the visible pages- var visibleViews = visible.views;-- var numVisible = visibleViews.length;- if (numVisible === 0) {- return false;- }- for (var i = 0; i < numVisible; ++i) {- var view = visibleViews[i].view;- if (!this.isViewFinished(view)) {- return view;+ // Clear all current matches.+ for (var i = 0, len = matches.length; i < len; i++) {+ var match = matches[i];+ var begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);+ for (var n = begin, end = match.end.divIdx; n <= end; n++) {+ var div = textDivs[n];+ div.textContent = bidiTexts[n].str;+ div.className = '';+ }+ clearedUntilDivIdx = match.end.divIdx + 1;}- }- // All the visible views have rendered, try to render next/previous pages.- if (scrolledDown) {- var nextPageIndex = visible.last.id;- // ID's start at 1 so no need to add 1.- if (views[nextPageIndex] && !this.isViewFinished(views[nextPageIndex])) {- return views[nextPageIndex];- }- } else {- var previousPageIndex = visible.first.id - 2;- if (views[previousPageIndex] &&- !this.isViewFinished(views[previousPageIndex])) {- return views[previousPageIndex];+ if (this.findController === null || !this.findController.active) {+ return;}++ // Convert the matches on the page controller into the match format+ // used for the textLayer.+ this.matches = this.convertMatches(this.findController === null ?+ [] : (this.findController.pageMatches[this.pageIdx] || []));+ this.renderMatches(this.matches);}- // Everything that needs to be rendered has been.- return false;- },+ };+ return TextLayerBuilder;+})();- isViewFinished: function pdfViewIsViewFinished(view) {- return view.renderingState === RenderingStates.FINISHED;- },+/**+ * @constructor+ * @implements IPDFTextLayerFactory+ */+function DefaultTextLayerFactory() {}+DefaultTextLayerFactory.prototype = {+ /**+ * @param {HTMLDivElement} textLayerDiv+ * @param {number} pageIndex+ * @param {PageViewport} viewport+ * @returns {TextLayerBuilder}+ */+ createTextLayerBuilder: function (textLayerDiv, pageIndex, viewport) {+ return new TextLayerBuilder({+ textLayerDiv: textLayerDiv,+ pageIndex: pageIndex,+ viewport: viewport+ });+ }+};- // Render a page or thumbnail view. This calls the appropriate function based- // on the views state. If the view is already rendered it will return false.- renderView: function pdfViewRender(view, type) {- var state = view.renderingState;- switch (state) {- case RenderingStates.FINISHED:- return false;- case RenderingStates.PAUSED:- PDFView.highestPriorityPage = type + view.id;- view.resume();- break;- case RenderingStates.RUNNING:- PDFView.highestPriorityPage = type + view.id;- break;- case RenderingStates.INITIAL:- PDFView.highestPriorityPage = type + view.id;- view.draw(this.renderHighestPriority.bind(this));- break;- }- return true;- },- setHash: function pdfViewSetHash(hash) {- var validFitZoomValues = ['Fit','FitB','FitH','FitBH',- 'FitV','FitBV','FitR'];+/**+ * @typedef {Object} AnnotationsLayerBuilderOptions+ * @property {HTMLDivElement} pageDiv+ * @property {PDFPage} pdfPage+ * @property {IPDFLinkService} linkService+ */- if (!hash) {- return;- }+/**+ * @class+ */+var AnnotationsLayerBuilder = (function AnnotationsLayerBuilderClosure() {+ /**+ * @param {AnnotationsLayerBuilderOptions} options+ * @constructs AnnotationsLayerBuilder+ */+ function AnnotationsLayerBuilder(options) {+ this.pageDiv = options.pageDiv;+ this.pdfPage = options.pdfPage;+ this.linkService = options.linkService;- if (hash.indexOf('=') >= 0) {- var params = PDFView.parseQueryString(hash);- // borrowing syntax from "Parameters for Opening PDF Files"- if ('nameddest' in params) {- PDFHistory.updateNextHashParam(params.nameddest);- PDFView.navigateTo(params.nameddest);- return;- }- var pageNumber, dest;- if ('page' in params) {- pageNumber = (params.page | 0) || 1;- }- if ('zoom' in params) {- var zoomArgs = params.zoom.split(','); // scale,left,top- // building destination array+ this.div = null;+ }+ AnnotationsLayerBuilder.prototype =+ /** @lends AnnotationsLayerBuilder.prototype */ {- // If the zoom value, it has to get divided by 100. If it is a string,- // it should stay as it is.- var zoomArg = zoomArgs[0];- var zoomArgNumber = parseFloat(zoomArg);- var destName = 'XYZ';- if (zoomArgNumber) {- zoomArg = zoomArgNumber / 100;- } else if (validFitZoomValues.indexOf(zoomArg) >= 0) {- destName = zoomArg;- }- dest = [null, { name: destName },- zoomArgs.length > 1 ? (zoomArgs[1] | 0) : null,- zoomArgs.length > 2 ? (zoomArgs[2] | 0) : null,- zoomArg];- }- if (dest) {- var currentPage = this.pages[(pageNumber || this.page) - 1];- currentPage.scrollIntoView(dest);- } else if (pageNumber) {- this.page = pageNumber; // simple page- }- if ('pagemode' in params) {- if (params.pagemode === 'thumbs' || params.pagemode === 'bookmarks' ||- params.pagemode === 'attachments') {- this.switchSidebarView((params.pagemode === 'bookmarks' ?- 'outline' : params.pagemode), true);- } else if (params.pagemode === 'none' && this.sidebarOpen) {- document.getElementById('sidebarToggle').click();+ /**+ * @param {PageViewport} viewport+ */+ setupAnnotations:+ function AnnotationsLayerBuilder_setupAnnotations(viewport) {+ function bindLink(link, dest) {+ link.href = linkService.getDestinationHash(dest);+ link.onclick = function annotationsLayerBuilderLinksOnclick() {+ if (dest) {+ linkService.navigateTo(dest);+ }+ return false;+ };+ if (dest) {+ link.className = 'internalLink';}}- } else if (/^\d+$/.test(hash)) { // page number- this.page = hash;- } else { // named destination- PDFHistory.updateNextHashParam(unescape(hash));- PDFView.navigateTo(unescape(hash));- }- },- switchSidebarView: function pdfViewSwitchSidebarView(view, openSidebar) {- if (openSidebar && !this.sidebarOpen) {- document.getElementById('sidebarToggle').click();- }- var thumbsView = document.getElementById('thumbnailView');- var outlineView = document.getElementById('outlineView');- var attachmentsView = document.getElementById('attachmentsView');+ function bindNamedAction(link, action) {+ link.href = linkService.getAnchorUrl('');+ link.onclick = function annotationsLayerBuilderNamedActionOnClick() {+ linkService.executeNamedAction(action);+ return false;+ };+ link.className = 'internalLink';+ }- var thumbsButton = document.getElementById('viewThumbnail');- var outlineButton = document.getElementById('viewOutline');- var attachmentsButton = document.getElementById('viewAttachments');+ var linkService = this.linkService;+ var pdfPage = this.pdfPage;+ var self = this;- switch (view) {- case 'thumbs':- var wasAnotherViewVisible = thumbsView.classList.contains('hidden');+ pdfPage.getAnnotations().then(function (annotationsData) {+ viewport = viewport.clone({ dontFlip: true });+ var transform = viewport.transform;+ var transformStr = 'matrix(' + transform.join(',') + ')';+ var data, element, i, ii;++ if (self.div) {+ // If an annotationLayer already exists, refresh its children's+ // transformation matrices+ for (i = 0, ii = annotationsData.length; i < ii; i++) {+ data = annotationsData[i];+ element = self.div.querySelector(+ '[data-annotation-id="' + data.id + '"]');+ if (element) {+ CustomStyle.setProp('transform', element, transformStr);+ }+ }+ // See PDFPageView.reset()+ self.div.removeAttribute('hidden');+ } else {+ for (i = 0, ii = annotationsData.length; i < ii; i++) {+ data = annotationsData[i];+ if (!data || !data.hasHtml) {+ continue;+ }- thumbsButton.classList.add('toggled');- outlineButton.classList.remove('toggled');- attachmentsButton.classList.remove('toggled');- thumbsView.classList.remove('hidden');- outlineView.classList.add('hidden');- attachmentsView.classList.add('hidden');+ element = PDFJS.AnnotationUtils.getHtmlElement(data,+ pdfPage.commonObjs);+ element.setAttribute('data-annotation-id', data.id);+ if (typeof mozL10n !== 'undefined') {+ mozL10n.translate(element);+ }- PDFView.renderHighestPriority();+ var rect = data.rect;+ var view = pdfPage.view;+ rect = PDFJS.Util.normalizeRect([+ rect[0],+ view[3] - rect[1] + view[1],+ rect[2],+ view[3] - rect[3] + view[1]+ ]);+ element.style.left = rect[0] + 'px';+ element.style.top = rect[1] + 'px';+ element.style.position = 'absolute';- if (wasAnotherViewVisible) {- // Ensure that the thumbnail of the current page is visible- // when switching from another view.- scrollIntoView(document.getElementById('thumbnailContainer' +- this.page));- }- break;+ CustomStyle.setProp('transform', element, transformStr);+ var transformOriginStr = -rect[0] + 'px ' + -rect[1] + 'px';+ CustomStyle.setProp('transformOrigin', element, transformOriginStr);++ if (data.subtype === 'Link' && !data.url) {+ var link = element.getElementsByTagName('a')[0];+ if (link) {+ if (data.action) {+ bindNamedAction(link, data.action);+ } else {+ bindLink(link, ('dest' in data) ? data.dest : null);+ }+ }+ }- case 'outline':- thumbsButton.classList.remove('toggled');- outlineButton.classList.add('toggled');- attachmentsButton.classList.remove('toggled');- thumbsView.classList.add('hidden');- outlineView.classList.remove('hidden');- attachmentsView.classList.add('hidden');+ if (!self.div) {+ var annotationLayerDiv = document.createElement('div');+ annotationLayerDiv.className = 'annotationLayer';+ self.pageDiv.appendChild(annotationLayerDiv);+ self.div = annotationLayerDiv;+ }- if (outlineButton.getAttribute('disabled')) {- return;+ self.div.appendChild(element);+ }}- break;-- case 'attachments':- thumbsButton.classList.remove('toggled');- outlineButton.classList.remove('toggled');- attachmentsButton.classList.add('toggled');- thumbsView.classList.add('hidden');- outlineView.classList.add('hidden');- attachmentsView.classList.remove('hidden');+ });+ },- if (attachmentsButton.getAttribute('disabled')) {- return;- }- break;+ hide: function () {+ if (!this.div) {+ return;+ }+ this.div.setAttribute('hidden', 'true');}- },+ };+ return AnnotationsLayerBuilder;+})();- getVisiblePages: function pdfViewGetVisiblePages() {- if (!PresentationMode.active) {- return this.getVisibleElements(this.container, this.pages, true);- } else {- // The algorithm in getVisibleElements doesn't work in all browsers and- // configurations when presentation mode is active.- var visible = [];- var currentPage = this.pages[this.page - 1];- visible.push({ id: currentPage.id, view: currentPage });- return { first: currentPage, last: currentPage, views: visible };- }- },+/**+ * @constructor+ * @implements IPDFAnnotationsLayerFactory+ */+function DefaultAnnotationsLayerFactory() {}+DefaultAnnotationsLayerFactory.prototype = {+ /**+ * @param {HTMLDivElement} pageDiv+ * @param {PDFPage} pdfPage+ * @returns {AnnotationsLayerBuilder}+ */+ createAnnotationsLayerBuilder: function (pageDiv, pdfPage) {+ return new AnnotationsLayerBuilder({+ pageDiv: pageDiv,+ pdfPage: pdfPage+ });+ }+};- getVisibleThumbs: function pdfViewGetVisibleThumbs() {- return this.getVisibleElements(this.thumbnailContainer, this.thumbnails);- },- // Generic helper to find out what elements are visible within a scroll pane.- getVisibleElements: function pdfViewGetVisibleElements(- scrollEl, views, sortByVisibility) {- var top = scrollEl.scrollTop, bottom = top + scrollEl.clientHeight;- var left = scrollEl.scrollLeft, right = left + scrollEl.clientWidth;-- var visible = [], view;- var currentHeight, viewHeight, hiddenHeight, percentHeight;- var currentWidth, viewWidth;- for (var i = 0, ii = views.length; i < ii; ++i) {- view = views[i];- currentHeight = view.el.offsetTop + view.el.clientTop;- viewHeight = view.el.clientHeight;- if ((currentHeight + viewHeight) < top) {- continue;- }- if (currentHeight > bottom) {- break;+/**+ * @typedef {Object} PDFViewerOptions+ * @property {HTMLDivElement} container - The container for the viewer element.+ * @property {HTMLDivElement} viewer - (optional) The viewer element.+ * @property {IPDFLinkService} linkService - The navigation/linking service.+ * @property {PDFRenderingQueue} renderingQueue - (optional) The rendering+ * queue object.+ */++/**+ * Simple viewer control to display PDF content/pages.+ * @class+ * @implements {IRenderableView}+ */+var PDFViewer = (function pdfViewer() {+ function PDFPageViewBuffer(size) {+ var data = [];+ this.push = function cachePush(view) {+ var i = data.indexOf(view);+ if (i >= 0) {+ data.splice(i, 1);+ }+ data.push(view);+ if (data.length > size) {+ data.shift().destroy();}- currentWidth = view.el.offsetLeft + view.el.clientLeft;- viewWidth = view.el.clientWidth;- if ((currentWidth + viewWidth) < left || currentWidth > right) {- continue;+ };+ this.resize = function (newSize) {+ size = newSize;+ while (data.length > size) {+ data.shift().destroy();}- hiddenHeight = Math.max(0, top - currentHeight) +- Math.max(0, currentHeight + viewHeight - bottom);- percentHeight = ((viewHeight - hiddenHeight) * 100 / viewHeight) | 0;+ };+ }- visible.push({ id: view.id, x: currentWidth, y: currentHeight,- view: view, percent: percentHeight });+ /**+ * @constructs PDFViewer+ * @param {PDFViewerOptions} options+ */+ function PDFViewer(options) {+ this.container = options.container;+ this.viewer = options.viewer || options.container.firstElementChild;+ this.linkService = options.linkService || new SimpleLinkService(this);++ this.defaultRenderingQueue = !options.renderingQueue;+ if (this.defaultRenderingQueue) {+ // Custom rendering queue is not specified, using default one+ this.renderingQueue = new PDFRenderingQueue();+ this.renderingQueue.setViewer(this);+ } else {+ this.renderingQueue = options.renderingQueue;}- var first = visible[0];- var last = visible[visible.length - 1];+ this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this));+ this.updateInProgress = false;+ this.presentationModeState = PresentationModeState.UNKNOWN;+ this._resetView();+ }- if (sortByVisibility) {- visible.sort(function(a, b) {- var pc = a.percent - b.percent;- if (Math.abs(pc) > 0.001) {- return -pc;- }- return a.id - b.id; // ensure stability- });- }- return {first: first, last: last, views: visible};- },+ PDFViewer.prototype = /** @lends PDFViewer.prototype */{+ get pagesCount() {+ return this.pages.length;+ },- // Helper function to parse query string (e.g. ?param1=value&parm2=...).- parseQueryString: function pdfViewParseQueryString(query) {- var parts = query.split('&');- var params = {};- for (var i = 0, ii = parts.length; i < ii; ++i) {- var param = parts[i].split('=');- var key = param[0];- var value = param.length > 1 ? param[1] : null;- params[decodeURIComponent(key)] = decodeURIComponent(value);- }- return params;- },+ getPageView: function (index) {+ return this.pages[index];+ },- beforePrint: function pdfViewSetupBeforePrint() {- if (!this.supportsPrinting) {- var printMessage = mozL10n.get('printing_not_supported', null,- 'Warning: Printing is not fully supported by this browser.');- this.error(printMessage);- return;- }+ get currentPageNumber() {+ return this._currentPageNumber;+ },- var alertNotReady = false;- var i, ii;- if (!this.pages.length) {- alertNotReady = true;- } else {- for (i = 0, ii = this.pages.length; i < ii; ++i) {- if (!this.pages[i].pdfPage) {- alertNotReady = true;- break;- }+ set currentPageNumber(val) {+ if (!this.pdfDocument) {+ this._currentPageNumber = val;+ return;}- }- if (alertNotReady) {- var notReadyMessage = mozL10n.get('printing_not_ready', null,- 'Warning: The PDF is not fully loaded for printing.');- window.alert(notReadyMessage);- return;- }-- this.printing = true;- this.renderHighestPriority();-- var body = document.querySelector('body');- body.setAttribute('data-mozPrintCallback', true);- for (i = 0, ii = this.pages.length; i < ii; ++i) {- this.pages[i].beforePrint();- }- },+ var event = document.createEvent('UIEvents');+ event.initUIEvent('pagechange', true, true, window, 0);+ event.updateInProgress = this.updateInProgress;- afterPrint: function pdfViewSetupAfterPrint() {- var div = document.getElementById('printContainer');- while (div.hasChildNodes()) {- div.removeChild(div.lastChild);- }+ if (!(0 < val && val <= this.pagesCount)) {+ event.pageNumber = this._currentPageNumber;+ event.previousPageNumber = val;+ this.container.dispatchEvent(event);+ return;+ }- this.printing = false;- this.renderHighestPriority();- },+ event.previousPageNumber = this._currentPageNumber;+ this._currentPageNumber = val;+ event.pageNumber = val;+ this.container.dispatchEvent(event);+ },- rotatePages: function pdfViewRotatePages(delta) {- var currentPage = this.pages[this.page - 1];- var i, l;- this.pageRotation = (this.pageRotation + 360 + delta) % 360;+ /**+ * @returns {number}+ */+ get currentScale() {+ return this._currentScale;+ },- for (i = 0, l = this.pages.length; i < l; i++) {- var page = this.pages[i];- page.update(page.scale, this.pageRotation);- }+ /**+ * @param {number} val - Scale of the pages in percents.+ */+ set currentScale(val) {+ if (isNaN(val)) {+ throw new Error('Invalid numeric scale');+ }+ if (!this.pdfDocument) {+ this._currentScale = val;+ this._currentScaleValue = val.toString();+ return;+ }+ this._setScale(val, false);+ },- for (i = 0, l = this.thumbnails.length; i < l; i++) {- var thumb = this.thumbnails[i];- thumb.update(this.pageRotation);- }+ /**+ * @returns {string}+ */+ get currentScaleValue() {+ return this._currentScaleValue;+ },- this.setScale(this.currentScaleValue, true, true);+ /**+ * @param val - The scale of the pages (in percent or predefined value).+ */+ set currentScaleValue(val) {+ if (!this.pdfDocument) {+ this._currentScale = isNaN(val) ? UNKNOWN_SCALE : val;+ this._currentScaleValue = val;+ return;+ }+ this._setScale(val, false);+ },- this.renderHighestPriority();+ /**+ * @returns {number}+ */+ get pagesRotation() {+ return this._pagesRotation;+ },- if (currentPage) {- currentPage.scrollIntoView();- }- },+ /**+ * @param {number} rotation - The rotation of the pages (0, 90, 180, 270).+ */+ set pagesRotation(rotation) {+ this._pagesRotation = rotation;- /**- * This function flips the page in presentation mode if the user scrolls up- * or down with large enough motion and prevents page flipping too often.- *- * @this {PDFView}- * @param {number} mouseScrollDelta The delta value from the mouse event.- */- mouseScroll: function pdfViewMouseScroll(mouseScrollDelta) {- var MOUSE_SCROLL_COOLDOWN_TIME = 50;+ for (var i = 0, l = this.pages.length; i < l; i++) {+ var page = this.pages[i];+ page.update(page.scale, rotation);+ }- var currentTime = (new Date()).getTime();- var storedTime = this.mouseScrollTimeStamp;+ this._setScale(this._currentScaleValue, true);+ },- // In case one page has already been flipped there is a cooldown time- // which has to expire before next page can be scrolled on to.- if (currentTime > storedTime &&- currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) {- return;- }+ /**+ * @param pdfDocument {PDFDocument}+ */+ setDocument: function (pdfDocument) {+ if (this.pdfDocument) {+ this._resetView();+ }- // In case the user decides to scroll to the opposite direction than before- // clear the accumulated delta.- if ((this.mouseScrollDelta > 0 && mouseScrollDelta < 0) ||- (this.mouseScrollDelta < 0 && mouseScrollDelta > 0)) {- this.clearMouseScrollState();- }+ this.pdfDocument = pdfDocument;+ if (!pdfDocument) {+ return;+ }- this.mouseScrollDelta += mouseScrollDelta;+ var pagesCount = pdfDocument.numPages;+ var pagesRefMap = this.pagesRefMap = {};+ var self = this;- var PAGE_FLIP_THRESHOLD = 120;- if (Math.abs(this.mouseScrollDelta) >= PAGE_FLIP_THRESHOLD) {+ var resolvePagesPromise;+ var pagesPromise = new Promise(function (resolve) {+ resolvePagesPromise = resolve;+ });+ this.pagesPromise = pagesPromise;+ pagesPromise.then(function () {+ var event = document.createEvent('CustomEvent');+ event.initCustomEvent('pagesloaded', true, true, {+ pagesCount: pagesCount+ });+ self.container.dispatchEvent(event);+ });- var PageFlipDirection = {- UP: -1,- DOWN: 1+ var isOnePageRenderedResolved = false;+ var resolveOnePageRendered = null;+ var onePageRendered = new Promise(function (resolve) {+ resolveOnePageRendered = resolve;+ });+ this.onePageRendered = onePageRendered;++ var bindOnAfterAndBeforeDraw = function (pageView) {+ pageView.onBeforeDraw = function pdfViewLoadOnBeforeDraw() {+ // Add the page to the buffer at the start of drawing. That way it can+ // be evicted from the buffer and destroyed even if we pause its+ // rendering.+ self._buffer.push(this);+ };+ // when page is painted, using the image as thumbnail base+ pageView.onAfterDraw = function pdfViewLoadOnAfterDraw() {+ if (!isOnePageRenderedResolved) {+ isOnePageRenderedResolved = true;+ resolveOnePageRendered();+ }+ };};- // In presentation mode scroll one page at a time.- var pageFlipDirection = (this.mouseScrollDelta > 0) ?- PageFlipDirection.UP :- PageFlipDirection.DOWN;- this.clearMouseScrollState();- var currentPage = this.page;-- // In case we are already on the first or the last page there is no need- // to do anything.- if ((currentPage === 1 && pageFlipDirection === PageFlipDirection.UP) ||- (currentPage === this.pages.length &&- pageFlipDirection === PageFlipDirection.DOWN)) {- return;- }+ var firstPagePromise = pdfDocument.getPage(1);+ this.firstPagePromise = firstPagePromise;++ // Fetch a single page so we can get a viewport that will be the default+ // viewport for all pages+ return firstPagePromise.then(function(pdfPage) {+ var scale = this._currentScale || 1.0;+ var viewport = pdfPage.getViewport(scale * CSS_UNITS);+ for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {+ var textLayerFactory = null;+ if (!PDFJS.disableTextLayer) {+ textLayerFactory = this;+ }+ var pageView = new PDFPageView({+ container: this.viewer,+ id: pageNum,+ scale: scale,+ defaultViewport: viewport.clone(),+ renderingQueue: this.renderingQueue,+ textLayerFactory: textLayerFactory,+ annotationsLayerFactory: this+ });+ bindOnAfterAndBeforeDraw(pageView);+ this.pages.push(pageView);+ }- this.page += pageFlipDirection;- this.mouseScrollTimeStamp = currentTime;- }- },+ // Fetch all the pages since the viewport is needed before printing+ // starts to create the correct size canvas. Wait until one page is+ // rendered so we don't tie up too many resources early on.+ onePageRendered.then(function () {+ if (!PDFJS.disableAutoFetch) {+ var getPagesLeft = pagesCount;+ for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {+ pdfDocument.getPage(pageNum).then(function (pageNum, pdfPage) {+ var pageView = self.pages[pageNum - 1];+ if (!pageView.pdfPage) {+ pageView.setPdfPage(pdfPage);+ }+ var refStr = pdfPage.ref.num + ' ' + pdfPage.ref.gen + ' R';+ pagesRefMap[refStr] = pageNum;+ getPagesLeft--;+ if (!getPagesLeft) {+ resolvePagesPromise();+ }+ }.bind(null, pageNum));+ }+ } else {+ // XXX: Printing is semi-broken with auto fetch disabled.+ resolvePagesPromise();+ }+ });- /**- * This function clears the member attributes used with mouse scrolling in- * presentation mode.- *- * @this {PDFView}- */- clearMouseScrollState: function pdfViewClearMouseScrollState() {- this.mouseScrollTimeStamp = 0;- this.mouseScrollDelta = 0;- }-};+ var event = document.createEvent('CustomEvent');+ event.initCustomEvent('pagesinit', true, true, null);+ self.container.dispatchEvent(event);+ if (this.defaultRenderingQueue) {+ this.update();+ }-var PageView = function pageView(container, id, scale,- navigateTo, defaultViewport) {- this.id = id;+ if (this.findController) {+ this.findController.resolveFirstPage();+ }+ }.bind(this));+ },- this.rotation = 0;- this.scale = scale || 1.0;- this.viewport = defaultViewport;- this.pdfPageRotate = defaultViewport.rotation;- this.hasRestrictedScaling = false;+ _resetView: function () {+ this.pages = [];+ this._currentPageNumber = 1;+ this._currentScale = UNKNOWN_SCALE;+ this._currentScaleValue = null;+ this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);+ this.location = null;+ this._pagesRotation = 0;+ this._pagesRequests = [];- this.renderingState = RenderingStates.INITIAL;- this.resume = null;+ var container = this.viewer;+ while (container.hasChildNodes()) {+ container.removeChild(container.lastChild);+ }+ },- this.textLayer = null;+ _scrollUpdate: function () {+ if (this.pagesCount === 0) {+ return;+ }+ this.update();+ for (var i = 0, ii = this.pages.length; i < ii; i++) {+ this.pages[i].updatePosition();+ }+ },- this.zoomLayer = null;+ _setScaleDispatchEvent: function pdfViewer_setScaleDispatchEvent(+ newScale, newValue, preset) {+ var event = document.createEvent('UIEvents');+ event.initUIEvent('scalechange', true, true, window, 0);+ event.scale = newScale;+ if (preset) {+ event.presetValue = newValue;+ }+ this.container.dispatchEvent(event);+ },- this.annotationLayer = null;+ _setScaleUpdatePages: function pdfViewer_setScaleUpdatePages(+ newScale, newValue, noScroll, preset) {+ this._currentScaleValue = newValue;+ if (newScale === this._currentScale) {+ if (preset) {+ this._setScaleDispatchEvent(newScale, newValue, true);+ }+ return;+ }- var anchor = document.createElement('a');- anchor.name = '' + this.id;+ for (var i = 0, ii = this.pages.length; i < ii; i++) {+ this.pages[i].update(newScale);+ }+ this._currentScale = newScale;- var div = this.el = document.createElement('div');- div.id = 'pageContainer' + this.id;- div.className = 'page';- div.style.width = Math.floor(this.viewport.width) + 'px';- div.style.height = Math.floor(this.viewport.height) + 'px';+ if (!noScroll) {+ var page = this._currentPageNumber, dest;+ var inPresentationMode =+ this.presentationModeState === PresentationModeState.CHANGING ||+ this.presentationModeState === PresentationModeState.FULLSCREEN;+ if (this.location && !inPresentationMode &&+ !IGNORE_CURRENT_POSITION_ON_ZOOM) {+ page = this.location.pageNumber;+ dest = [null, { name: 'XYZ' }, this.location.left,+ this.location.top, null];+ }+ this.scrollPageIntoView(page, dest);+ }- container.appendChild(anchor);- container.appendChild(div);+ this._setScaleDispatchEvent(newScale, newValue, preset);+ },- this.setPdfPage = function pageViewSetPdfPage(pdfPage) {- this.pdfPage = pdfPage;- this.pdfPageRotate = pdfPage.rotate;- var totalRotation = (this.rotation + this.pdfPageRotate) % 360;- this.viewport = pdfPage.getViewport(this.scale * CSS_UNITS, totalRotation);- this.stats = pdfPage.stats;- this.reset();- };+ _setScale: function pdfViewer_setScale(value, noScroll) {+ if (value === 'custom') {+ return;+ }+ var scale = parseFloat(value);- this.destroy = function pageViewDestroy() {- this.zoomLayer = null;- this.reset();- if (this.pdfPage) {- this.pdfPage.destroy();- }- };+ if (scale > 0) {+ this._setScaleUpdatePages(scale, value, noScroll, false);+ } else {+ var currentPage = this.pages[this._currentPageNumber - 1];+ if (!currentPage) {+ return;+ }+ var inPresentationMode =+ this.presentationModeState === PresentationModeState.FULLSCREEN;+ var hPadding = inPresentationMode ? 0 : SCROLLBAR_PADDING;+ var vPadding = inPresentationMode ? 0 : VERTICAL_PADDING;+ var pageWidthScale = (this.container.clientWidth - hPadding) /+ currentPage.width * currentPage.scale;+ var pageHeightScale = (this.container.clientHeight - vPadding) /+ currentPage.height * currentPage.scale;+ switch (value) {+ case 'page-actual':+ scale = 1;+ break;+ case 'page-width':+ scale = pageWidthScale;+ break;+ case 'page-height':+ scale = pageHeightScale;+ break;+ case 'page-fit':+ scale = Math.min(pageWidthScale, pageHeightScale);+ break;+ case 'auto':+ var isLandscape = (currentPage.width > currentPage.height);+ // For pages in landscape mode, fit the page height to the viewer+ // *unless* the page would thus become too wide to fit horizontally.+ var horizontalScale = isLandscape ?+ Math.min(pageHeightScale, pageWidthScale) : pageWidthScale;+ scale = Math.min(MAX_AUTO_SCALE, horizontalScale);+ break;+ default:+ console.error('pdfViewSetScale: \'' + value ++ '\' is an unknown zoom value.');+ return;+ }+ this._setScaleUpdatePages(scale, value, noScroll, true);+ }+ },- this.reset = function pageViewReset(keepAnnotations) {- if (this.renderTask) {- this.renderTask.cancel();- }- this.resume = null;- this.renderingState = RenderingStates.INITIAL;+ /**+ * Scrolls page into view.+ * @param {number} pageNumber+ * @param {Array} dest - (optional) original PDF destination array:+ * <page-ref> </XYZ|FitXXX> <args..>+ */+ scrollPageIntoView: function PDFViewer_scrollPageIntoView(pageNumber,+ dest) {+ var pageView = this.pages[pageNumber - 1];++ if (this.presentationModeState ===+ PresentationModeState.FULLSCREEN) {+ if (this.linkService.page !== pageView.id) {+ // Avoid breaking getVisiblePages in presentation mode.+ this.linkService.page = pageView.id;+ return;+ }+ dest = null;+ // Fixes the case when PDF has different page sizes.+ this._setScale(this.currentScaleValue, true);+ }+ if (!dest) {+ scrollIntoView(pageView.div);+ return;+ }- div.style.width = Math.floor(this.viewport.width) + 'px';- div.style.height = Math.floor(this.viewport.height) + 'px';+ var x = 0, y = 0;+ var width = 0, height = 0, widthScale, heightScale;+ var changeOrientation = (pageView.rotation % 180 === 0 ? false : true);+ var pageWidth = (changeOrientation ? pageView.height : pageView.width) /+ pageView.scale / CSS_UNITS;+ var pageHeight = (changeOrientation ? pageView.width : pageView.height) /+ pageView.scale / CSS_UNITS;+ var scale = 0;+ switch (dest[1].name) {+ case 'XYZ':+ x = dest[2];+ y = dest[3];+ scale = dest[4];+ // If x and/or y coordinates are not supplied, default to+ // _top_ left of the page (not the obvious bottom left,+ // since aligning the bottom of the intended page with the+ // top of the window is rarely helpful).+ x = x !== null ? x : 0;+ y = y !== null ? y : pageHeight;+ break;+ case 'Fit':+ case 'FitB':+ scale = 'page-fit';+ break;+ case 'FitH':+ case 'FitBH':+ y = dest[2];+ scale = 'page-width';+ break;+ case 'FitV':+ case 'FitBV':+ x = dest[2];+ width = pageWidth;+ height = pageHeight;+ scale = 'page-height';+ break;+ case 'FitR':+ x = dest[2];+ y = dest[3];+ width = dest[4] - x;+ height = dest[5] - y;+ var viewerContainer = this.container;+ widthScale = (viewerContainer.clientWidth - SCROLLBAR_PADDING) /+ width / CSS_UNITS;+ heightScale = (viewerContainer.clientHeight - SCROLLBAR_PADDING) /+ height / CSS_UNITS;+ scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));+ break;+ default:+ return;+ }- var childNodes = div.childNodes;- for (var i = div.childNodes.length - 1; i >= 0; i--) {- var node = childNodes[i];- if ((this.zoomLayer && this.zoomLayer === node) ||- (keepAnnotations && this.annotationLayer === node)) {- continue;+ if (scale && scale !== this.currentScale) {+ this.currentScaleValue = scale;+ } else if (this.currentScale === UNKNOWN_SCALE) {+ this.currentScaleValue = DEFAULT_SCALE;}- div.removeChild(node);- }- div.removeAttribute('data-loaded');- if (keepAnnotations) {- if (this.annotationLayer) {- // Hide annotationLayer until all elements are resized- // so they are not displayed on the already-resized page- this.annotationLayer.setAttribute('hidden', 'true');+ if (scale === 'page-fit' && !dest[4]) {+ scrollIntoView(pageView.div);+ return;}- } else {- this.annotationLayer = null;- }- if (this.canvas) {- // Zeroing the width and height causes Firefox to release graphics- // resources immediately, which can greatly reduce memory consumption.- this.canvas.width = 0;- this.canvas.height = 0;- delete this.canvas;- }+ var boundingRect = [+ pageView.viewport.convertToViewportPoint(x, y),+ pageView.viewport.convertToViewportPoint(x + width, y + height)+ ];+ var left = Math.min(boundingRect[0][0], boundingRect[1][0]);+ var top = Math.min(boundingRect[0][1], boundingRect[1][1]);- this.loadingIconDiv = document.createElement('div');- this.loadingIconDiv.className = 'loadingIcon';- div.appendChild(this.loadingIconDiv);- };+ scrollIntoView(pageView.div, { left: left, top: top });+ },- this.update = function pageViewUpdate(scale, rotation) {- this.scale = scale || this.scale;+ _updateLocation: function (firstPage) {+ var currentScale = this._currentScale;+ var currentScaleValue = this._currentScaleValue;+ var normalizedScaleValue =+ parseFloat(currentScaleValue) === currentScale ?+ Math.round(currentScale * 10000) / 100 : currentScaleValue;++ var pageNumber = firstPage.id;+ var pdfOpenParams = '#page=' + pageNumber;+ pdfOpenParams += '&zoom=' + normalizedScaleValue;+ var currentPageView = this.pages[pageNumber - 1];+ var container = this.container;+ var topLeft = currentPageView.getPagePoint(+ (container.scrollLeft - firstPage.x),+ (container.scrollTop - firstPage.y));+ var intLeft = Math.round(topLeft[0]);+ var intTop = Math.round(topLeft[1]);+ pdfOpenParams += ',' + intLeft + ',' + intTop;++ this.location = {+ pageNumber: pageNumber,+ scale: normalizedScaleValue,+ top: intTop,+ left: intLeft,+ pdfOpenParams: pdfOpenParams+ };+ },- if (typeof rotation !== 'undefined') {- this.rotation = rotation;- }+ update: function () {+ var visible = this._getVisiblePages();+ var visiblePages = visible.views;+ if (visiblePages.length === 0) {+ return;+ }- var totalRotation = (this.rotation + this.pdfPageRotate) % 360;- this.viewport = this.viewport.clone({- scale: this.scale * CSS_UNITS,- rotation: totalRotation- });+ this.updateInProgress = true;- var isScalingRestricted = false;- if (this.canvas && PDFJS.maxCanvasPixels > 0) {- var ctx = this.canvas.getContext('2d');- var outputScale = getOutputScale(ctx);- var pixelsInViewport = this.viewport.width * this.viewport.height;- var maxScale = Math.sqrt(PDFJS.maxCanvasPixels / pixelsInViewport);- if (((Math.floor(this.viewport.width) * outputScale.sx) | 0) *- ((Math.floor(this.viewport.height) * outputScale.sy) | 0) >- PDFJS.maxCanvasPixels) {- isScalingRestricted = true;- }- }+ var suggestedCacheSize = Math.max(DEFAULT_CACHE_SIZE,+ 2 * visiblePages.length + 1);+ this._buffer.resize(suggestedCacheSize);- if (this.canvas &&- (PDFJS.useOnlyCssZoom ||- (this.hasRestrictedScaling && isScalingRestricted))) {- this.cssTransform(this.canvas, true);- return;- } else if (this.canvas && !this.zoomLayer) {- this.zoomLayer = this.canvas.parentNode;- this.zoomLayer.style.position = 'absolute';- }- if (this.zoomLayer) {- this.cssTransform(this.zoomLayer.firstChild);- }- this.reset(true);- };+ this.renderingQueue.renderHighestPriority(visible);- this.cssTransform = function pageCssTransform(canvas, redrawAnnotations) {- // Scale canvas, canvas wrapper, and page container.- var width = this.viewport.width;- var height = this.viewport.height;- canvas.style.width = canvas.parentNode.style.width = div.style.width =- Math.floor(width) + 'px';- canvas.style.height = canvas.parentNode.style.height = div.style.height =- Math.floor(height) + 'px';- // The canvas may have been originally rotated, so rotate relative to that.- var relativeRotation = this.viewport.rotation - canvas._viewport.rotation;- var absRotation = Math.abs(relativeRotation);- var scaleX = 1, scaleY = 1;- if (absRotation === 90 || absRotation === 270) {- // Scale x and y because of the rotation.- scaleX = height / width;- scaleY = width / height;- }- var cssTransform = 'rotate(' + relativeRotation + 'deg) ' +- 'scale(' + scaleX + ',' + scaleY + ')';- CustomStyle.setProp('transform', canvas, cssTransform);-- if (this.textLayer) {- // Rotating the text layer is more complicated since the divs inside the- // the text layer are rotated.- // TODO: This could probably be simplified by drawing the text layer in- // one orientation then rotating overall.- var textLayerViewport = this.textLayer.viewport;- var textRelativeRotation = this.viewport.rotation -- textLayerViewport.rotation;- var textAbsRotation = Math.abs(textRelativeRotation);- var scale = width / textLayerViewport.width;- if (textAbsRotation === 90 || textAbsRotation === 270) {- scale = width / textLayerViewport.height;- }- var textLayerDiv = this.textLayer.textLayerDiv;- var transX, transY;- switch (textAbsRotation) {- case 0:- transX = transY = 0;- break;- case 90:- transX = 0;- transY = '-' + textLayerDiv.style.height;- break;- case 180:- transX = '-' + textLayerDiv.style.width;- transY = '-' + textLayerDiv.style.height;- break;- case 270:- transX = '-' + textLayerDiv.style.width;- transY = 0;+ var currentId = this.currentPageNumber;+ var firstPage = visible.first;++ for (var i = 0, ii = visiblePages.length, stillFullyVisible = false;+ i < ii; ++i) {+ var page = visiblePages[i];++ if (page.percent < 100) {break;- default:- console.error('Bad rotation value.');+ }+ if (page.id === currentId) {+ stillFullyVisible = true;break;+ }}- CustomStyle.setProp('transform', textLayerDiv,- 'rotate(' + textAbsRotation + 'deg) ' +- 'scale(' + scale + ', ' + scale + ') ' +- 'translate(' + transX + ', ' + transY + ')');- CustomStyle.setProp('transformOrigin', textLayerDiv, '0% 0%');- }- if (redrawAnnotations && this.annotationLayer) {- setupAnnotations(div, this.pdfPage, this.viewport);- }- };+ if (!stillFullyVisible) {+ currentId = visiblePages[0].id;+ }- Object.defineProperty(this, 'width', {- get: function PageView_getWidth() {- return this.viewport.width;+ if (this.presentationModeState !== PresentationModeState.FULLSCREEN) {+ this.currentPageNumber = currentId;+ }++ this._updateLocation(firstPage);++ this.updateInProgress = false;++ var event = document.createEvent('UIEvents');+ event.initUIEvent('updateviewarea', true, true, window, 0);+ this.container.dispatchEvent(event);},- enumerable: true- });- Object.defineProperty(this, 'height', {- get: function PageView_getHeight() {- return this.viewport.height;+ containsElement: function (element) {+ return this.container.contains(element);},- enumerable: true- });- var self = this;+ focus: function () {+ this.container.focus();+ },- function setupAnnotations(pageDiv, pdfPage, viewport) {+ blur: function () {+ this.container.blur();+ },- function bindLink(link, dest) {- link.href = PDFView.getDestinationHash(dest);- link.onclick = function pageViewSetupLinksOnclick() {- if (dest) {- PDFView.navigateTo(dest);+ get isHorizontalScrollbarEnabled() {+ return (this.presentationModeState === PresentationModeState.FULLSCREEN ?+ false : (this.container.scrollWidth > this.container.clientWidth));+ },++ _getVisiblePages: function () {+ if (this.presentationModeState !== PresentationModeState.FULLSCREEN) {+ return getVisibleElements(this.container, this.pages, true);+ } else {+ // The algorithm in getVisibleElements doesn't work in all browsers and+ // configurations when presentation mode is active.+ var visible = [];+ var currentPage = this.pages[this._currentPageNumber - 1];+ visible.push({ id: currentPage.id, view: currentPage });+ return { first: currentPage, last: currentPage, views: visible };+ }+ },++ cleanup: function () {+ for (var i = 0, ii = this.pages.length; i < ii; i++) {+ if (this.pages[i] &&+ this.pages[i].renderingState !== RenderingStates.FINISHED) {+ this.pages[i].reset();}- return false;- };- if (dest) {- link.className = 'internalLink';}- }+ },- function bindNamedAction(link, action) {- link.href = PDFView.getAnchorUrl('');- link.onclick = function pageViewSetupNamedActionOnClick() {- // See PDF reference, table 8.45 - Named action- switch (action) {- case 'GoToPage':- document.getElementById('pageNumber').focus();- break;+ /**+ * @param {PDFPageView} pageView+ * @returns {PDFPage}+ * @private+ */+ _ensurePdfPageLoaded: function (pageView) {+ if (pageView.pdfPage) {+ return Promise.resolve(pageView.pdfPage);+ }+ var pageNumber = pageView.id;+ if (this._pagesRequests[pageNumber]) {+ return this._pagesRequests[pageNumber];+ }+ var promise = this.pdfDocument.getPage(pageNumber).then(+ function (pdfPage) {+ pageView.setPdfPage(pdfPage);+ this._pagesRequests[pageNumber] = null;+ return pdfPage;+ }.bind(this));+ this._pagesRequests[pageNumber] = promise;+ return promise;+ },- case 'GoBack':- PDFHistory.back();- break;+ forceRendering: function (currentlyVisiblePages) {+ var visiblePages = currentlyVisiblePages || this._getVisiblePages();+ var pageView = this.renderingQueue.getHighestPriority(visiblePages,+ this.pages,+ this.scroll.down);+ if (pageView) {+ this._ensurePdfPageLoaded(pageView).then(function () {+ this.renderingQueue.renderView(pageView);+ }.bind(this));+ return true;+ }+ return false;+ },- case 'GoForward':- PDFHistory.forward();- break;+ getPageTextContent: function (pageIndex) {+ return this.pdfDocument.getPage(pageIndex + 1).then(function (page) {+ return page.getTextContent();+ });+ },- case 'Find':- if (!PDFView.supportsIntegratedFind) {- PDFView.findBar.toggle();- }- break;+ /**+ * @param {HTMLDivElement} textLayerDiv+ * @param {number} pageIndex+ * @param {PageViewport} viewport+ * @returns {TextLayerBuilder}+ */+ createTextLayerBuilder: function (textLayerDiv, pageIndex, viewport) {+ var isViewerInPresentationMode =+ this.presentationModeState === PresentationModeState.FULLSCREEN;+ return new TextLayerBuilder({+ textLayerDiv: textLayerDiv,+ pageIndex: pageIndex,+ viewport: viewport,+ findController: isViewerInPresentationMode ? null : this.findController+ });+ },- case 'NextPage':- PDFView.page++;- break;+ /**+ * @param {HTMLDivElement} pageDiv+ * @param {PDFPage} pdfPage+ * @returns {AnnotationsLayerBuilder}+ */+ createAnnotationsLayerBuilder: function (pageDiv, pdfPage) {+ return new AnnotationsLayerBuilder({+ pageDiv: pageDiv,+ pdfPage: pdfPage,+ linkService: this.linkService+ });+ },- case 'PrevPage':- PDFView.page--;- break;+ setFindController: function (findController) {+ this.findController = findController;+ },+ };- case 'LastPage':- PDFView.page = PDFView.pages.length;- break;+ return PDFViewer;+})();- case 'FirstPage':- PDFView.page = 1;- break;+var SimpleLinkService = (function SimpleLinkServiceClosure() {+ function SimpleLinkService(pdfViewer) {+ this.pdfViewer = pdfViewer;+ }+ SimpleLinkService.prototype = {+ /**+ * @returns {number}+ */+ get page() {+ return this.pdfViewer.currentPageNumber;+ },+ /**+ * @param {number} value+ */+ set page(value) {+ this.pdfViewer.currentPageNumber = value;+ },+ /**+ * @param dest - The PDF destination object.+ */+ navigateTo: function (dest) {},+ /**+ * @param dest - The PDF destination object.+ * @returns {string} The hyperlink to the PDF object.+ */+ getDestinationHash: function (dest) {+ return '#';+ },+ /**+ * @param hash - The PDF parameters/hash.+ * @returns {string} The hyperlink to the PDF object.+ */+ getAnchorUrl: function (hash) {+ return '#';+ },+ /**+ * @param {string} hash+ */+ setHash: function (hash) {},+ /**+ * @param {string} action+ */+ executeNamedAction: function (action) {},+ };+ return SimpleLinkService;+})();- default:- break; // No action according to spec- }- return false;- };- link.className = 'internalLink';- }-- pdfPage.getAnnotations().then(function(annotationsData) {- viewport = viewport.clone({ dontFlip: true });- var transform = viewport.transform;- var transformStr = 'matrix(' + transform.join(',') + ')';- var data, element, i, ii;-- if (self.annotationLayer) {- // If an annotationLayer already exists, refresh its children's- // transformation matrices- for (i = 0, ii = annotationsData.length; i < ii; i++) {- data = annotationsData[i];- element = self.annotationLayer.querySelector(- '[data-annotation-id="' + data.id + '"]');- if (element) {- CustomStyle.setProp('transform', element, transformStr);- }- }- // See this.reset()- self.annotationLayer.removeAttribute('hidden');- } else {- for (i = 0, ii = annotationsData.length; i < ii; i++) {- data = annotationsData[i];- if (!data || !data.hasHtml) {- continue;- }- element = PDFJS.AnnotationUtils.getHtmlElement(data,- pdfPage.commonObjs);- element.setAttribute('data-annotation-id', data.id);- mozL10n.translate(element);-- var rect = data.rect;- var view = pdfPage.view;- rect = PDFJS.Util.normalizeRect([- rect[0],- view[3] - rect[1] + view[1],- rect[2],- view[3] - rect[3] + view[1]- ]);- element.style.left = rect[0] + 'px';- element.style.top = rect[1] + 'px';- element.style.position = 'absolute';-- CustomStyle.setProp('transform', element, transformStr);- var transformOriginStr = -rect[0] + 'px ' + -rect[1] + 'px';- CustomStyle.setProp('transformOrigin', element, transformOriginStr);-- if (data.subtype === 'Link' && !data.url) {- var link = element.getElementsByTagName('a')[0];- if (link) {- if (data.action) {- bindNamedAction(link, data.action);- } else {- bindLink(link, ('dest' in data) ? data.dest : null);- }- }- }+var THUMBNAIL_SCROLL_MARGIN = -19;- if (!self.annotationLayer) {- var annotationLayerDiv = document.createElement('div');- annotationLayerDiv.className = 'annotationLayer';- pageDiv.appendChild(annotationLayerDiv);- self.annotationLayer = annotationLayerDiv;- }- self.annotationLayer.appendChild(element);- }- }- });- }+var THUMBNAIL_WIDTH = 98; // px+var THUMBNAIL_CANVAS_BORDER_WIDTH = 1; // px- this.getPagePoint = function pageViewGetPagePoint(x, y) {- return this.viewport.convertToPdfPoint(x, y);- };+/**+ * @typedef {Object} PDFThumbnailViewOptions+ * @property {HTMLDivElement} container - The viewer element.+ * @property {number} id - The thumbnail's unique ID (normally its number).+ * @property {PageViewport} defaultViewport - The page viewport.+ * @property {IPDFLinkService} linkService - The navigation/linking service.+ * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.+ */- this.scrollIntoView = function pageViewScrollIntoView(dest) {- if (PresentationMode.active) {- if (PDFView.page !== this.id) {- // Avoid breaking PDFView.getVisiblePages in presentation mode.- PDFView.page = this.id;- return;- }- dest = null;- PDFView.setScale(PDFView.currentScaleValue, true, true);- }- if (!dest) {- scrollIntoView(div);- return;+/**+ * @class+ * @implements {IRenderableView}+ */+var PDFThumbnailView = (function PDFThumbnailViewClosure() {+ function getTempCanvas(width, height) {+ var tempCanvas = PDFThumbnailView.tempImageCache;+ if (!tempCanvas) {+ tempCanvas = document.createElement('canvas');+ PDFThumbnailView.tempImageCache = tempCanvas;}+ tempCanvas.width = width;+ tempCanvas.height = height;- var x = 0, y = 0;- var width = 0, height = 0, widthScale, heightScale;- var changeOrientation = (this.rotation % 180 === 0 ? false : true);- var pageWidth = (changeOrientation ? this.height : this.width) /- this.scale / CSS_UNITS;- var pageHeight = (changeOrientation ? this.width : this.height) /- this.scale / CSS_UNITS;- var scale = 0;- switch (dest[1].name) {- case 'XYZ':- x = dest[2];- y = dest[3];- scale = dest[4];- // If x and/or y coordinates are not supplied, default to- // _top_ left of the page (not the obvious bottom left,- // since aligning the bottom of the intended page with the- // top of the window is rarely helpful).- x = x !== null ? x : 0;- y = y !== null ? y : pageHeight;- break;- case 'Fit':- case 'FitB':- scale = 'page-fit';- break;- case 'FitH':- case 'FitBH':- y = dest[2];- scale = 'page-width';- break;- case 'FitV':- case 'FitBV':- x = dest[2];- width = pageWidth;- height = pageHeight;- scale = 'page-height';- break;- case 'FitR':- x = dest[2];- y = dest[3];- width = dest[4] - x;- height = dest[5] - y;- widthScale = (PDFView.container.clientWidth - SCROLLBAR_PADDING) /- width / CSS_UNITS;- heightScale = (PDFView.container.clientHeight - SCROLLBAR_PADDING) /- height / CSS_UNITS;- scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));- break;- default:- return;- }+ // Since this is a temporary canvas, we need to fill the canvas with a white+ // background ourselves. |_getPageDrawContext| uses CSS rules for this.+ var ctx = tempCanvas.getContext('2d');+ ctx.save();+ ctx.fillStyle = 'rgb(255, 255, 255)';+ ctx.fillRect(0, 0, width, height);+ ctx.restore();+ return tempCanvas;+ }- if (scale && scale !== PDFView.currentScale) {- PDFView.setScale(scale, true, true);- } else if (PDFView.currentScale === UNKNOWN_SCALE) {- PDFView.setScale(DEFAULT_SCALE, true, true);- }+ /**+ * @constructs PDFThumbnailView+ * @param {PDFThumbnailViewOptions} options+ */+ function PDFThumbnailView(options) {+ var container = options.container;+ var id = options.id;+ var defaultViewport = options.defaultViewport;+ var linkService = options.linkService;+ var renderingQueue = options.renderingQueue;- if (scale === 'page-fit' && !dest[4]) {- scrollIntoView(div);- return;- }+ this.id = id;+ this.renderingId = 'thumbnail' + id;- var boundingRect = [- this.viewport.convertToViewportPoint(x, y),- this.viewport.convertToViewportPoint(x + width, y + height)- ];- var left = Math.min(boundingRect[0][0], boundingRect[1][0]);- var top = Math.min(boundingRect[0][1], boundingRect[1][1]);+ this.pdfPage = null;+ this.rotation = 0;+ this.viewport = defaultViewport;+ this.pdfPageRotate = defaultViewport.rotation;- scrollIntoView(div, { left: left, top: top });- };+ this.linkService = linkService;+ this.renderingQueue = renderingQueue;- this.getTextContent = function pageviewGetTextContent() {- return PDFView.getPage(this.id).then(function(pdfPage) {- return pdfPage.getTextContent();- });- };+ this.hasImage = false;+ this.resume = null;+ this.renderingState = RenderingStates.INITIAL;- this.draw = function pageviewDraw(callback) {- var pdfPage = this.pdfPage;+ this.pageWidth = this.viewport.width;+ this.pageHeight = this.viewport.height;+ this.pageRatio = this.pageWidth / this.pageHeight;- if (this.pagePdfPromise) {- return;- }- if (!pdfPage) {- var promise = PDFView.getPage(this.id);- promise.then(function(pdfPage) {- delete this.pagePdfPromise;- this.setPdfPage(pdfPage);- this.draw(callback);- }.bind(this));- this.pagePdfPromise = promise;- return;- }+ this.canvasWidth = THUMBNAIL_WIDTH;+ this.canvasHeight = (this.canvasWidth / this.pageRatio) | 0;+ this.scale = this.canvasWidth / this.pageWidth;- if (this.renderingState !== RenderingStates.INITIAL) {- console.error('Must be in new state before drawing');- }+ var anchor = document.createElement('a');+ anchor.href = linkService.getAnchorUrl('#page=' + id);+ anchor.title = mozL10n.get('thumb_page_title', {page: id}, 'Page {{page}}');+ anchor.onclick = function stopNavigation() {+ linkService.page = id;+ return false;+ };- this.renderingState = RenderingStates.RUNNING;+ var div = document.createElement('div');+ div.id = 'thumbnailContainer' + id;+ div.className = 'thumbnail';+ this.div = div;++ if (id === 1) {+ // Highlight the thumbnail of the first page when no page number is+ // specified (or exists in cache) when the document is loaded.+ div.classList.add('selected');+ }++ var ring = document.createElement('div');+ ring.className = 'thumbnailSelectionRing';+ var borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH;+ ring.style.width = this.canvasWidth + borderAdjustment + 'px';+ ring.style.height = this.canvasHeight + borderAdjustment + 'px';+ this.ring = ring;++ div.appendChild(ring);+ anchor.appendChild(div);+ container.appendChild(anchor);+ }- var viewport = this.viewport;- // Wrap the canvas so if it has a css transform for highdpi the overflow- // will be hidden in FF.- var canvasWrapper = document.createElement('div');- canvasWrapper.style.width = div.style.width;- canvasWrapper.style.height = div.style.height;- canvasWrapper.classList.add('canvasWrapper');+ PDFThumbnailView.prototype = {+ setPdfPage: function PDFThumbnailView_setPdfPage(pdfPage) {+ this.pdfPage = pdfPage;+ this.pdfPageRotate = pdfPage.rotate;+ var totalRotation = (this.rotation + this.pdfPageRotate) % 360;+ this.viewport = pdfPage.getViewport(1, totalRotation);+ this.reset();+ },- var canvas = document.createElement('canvas');- canvas.id = 'page' + this.id;- canvasWrapper.appendChild(canvas);- if (this.annotationLayer) {- // annotationLayer needs to stay on top- div.insertBefore(canvasWrapper, this.annotationLayer);- } else {- div.appendChild(canvasWrapper);- }- this.canvas = canvas;+ reset: function PDFThumbnailView_reset() {+ if (this.renderTask) {+ this.renderTask.cancel();+ }+ this.hasImage = false;+ this.resume = null;+ this.renderingState = RenderingStates.INITIAL;- var ctx = canvas.getContext('2d');- var outputScale = getOutputScale(ctx);+ this.pageWidth = this.viewport.width;+ this.pageHeight = this.viewport.height;+ this.pageRatio = this.pageWidth / this.pageHeight;- if (PDFJS.useOnlyCssZoom) {- var actualSizeViewport = viewport.clone({ scale: CSS_UNITS });- // Use a scale that will make the canvas be the original intended size- // of the page.- outputScale.sx *= actualSizeViewport.width / viewport.width;- outputScale.sy *= actualSizeViewport.height / viewport.height;- outputScale.scaled = true;- }+ this.canvasHeight = (this.canvasWidth / this.pageRatio) | 0;+ this.scale = (this.canvasWidth / this.pageWidth);- if (PDFJS.maxCanvasPixels > 0) {- var pixelsInViewport = viewport.width * viewport.height;- var maxScale = Math.sqrt(PDFJS.maxCanvasPixels / pixelsInViewport);- if (outputScale.sx > maxScale || outputScale.sy > maxScale) {- outputScale.sx = maxScale;- outputScale.sy = maxScale;- outputScale.scaled = true;- this.hasRestrictedScaling = true;- } else {- this.hasRestrictedScaling = false;+ this.div.removeAttribute('data-loaded');+ var ring = this.ring;+ var childNodes = ring.childNodes;+ for (var i = childNodes.length - 1; i >= 0; i--) {+ ring.removeChild(childNodes[i]);}- }+ var borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH;+ ring.style.width = this.canvasWidth + borderAdjustment + 'px';+ ring.style.height = this.canvasHeight + borderAdjustment + 'px';- canvas.width = (Math.floor(viewport.width) * outputScale.sx) | 0;- canvas.height = (Math.floor(viewport.height) * outputScale.sy) | 0;- canvas.style.width = Math.floor(viewport.width) + 'px';- canvas.style.height = Math.floor(viewport.height) + 'px';- // Add the viewport so it's known what it was originally drawn with.- canvas._viewport = viewport;-- var textLayerDiv = null;- if (!PDFJS.disableTextLayer) {- textLayerDiv = document.createElement('div');- textLayerDiv.className = 'textLayer';- textLayerDiv.style.width = canvas.style.width;- textLayerDiv.style.height = canvas.style.height;- if (this.annotationLayer) {- // annotationLayer needs to stay on top- div.insertBefore(textLayerDiv, this.annotationLayer);- } else {- div.appendChild(textLayerDiv);+ if (this.canvas) {+ // Zeroing the width and height causes Firefox to release graphics+ // resources immediately, which can greatly reduce memory consumption.+ this.canvas.width = 0;+ this.canvas.height = 0;+ delete this.canvas;}- }- var textLayer = this.textLayer =- textLayerDiv ? new TextLayerBuilder({- textLayerDiv: textLayerDiv,- pageIndex: this.id - 1,- lastScrollSource: PDFView,- viewport: this.viewport,- isViewerInPresentationMode: PresentationMode.active,- findController: PDFView.findController- }) : null;- // TODO(mack): use data attributes to store these- ctx._scaleX = outputScale.sx;- ctx._scaleY = outputScale.sy;- if (outputScale.scaled) {- ctx.scale(outputScale.sx, outputScale.sy);- }-- // Rendering area+ },- var self = this;- function pageViewDrawCallback(error) {- // The renderTask may have been replaced by a new one, so only remove the- // reference to the renderTask if it matches the one that is triggering- // this callback.- if (renderTask === self.renderTask) {- self.renderTask = null;+ update: function PDFThumbnailView_update(rotation) {+ if (typeof rotation !== 'undefined') {+ this.rotation = rotation;}+ var totalRotation = (this.rotation + this.pdfPageRotate) % 360;+ this.viewport = this.viewport.clone({+ scale: 1,+ rotation: totalRotation+ });+ this.reset();+ },- if (error === 'cancelled') {- return;- }+ /**+ * @private+ */+ _getPageDrawContext: function PDFThumbnailView_getPageDrawContext() {+ var canvas = document.createElement('canvas');+ canvas.id = this.renderingId;- self.renderingState = RenderingStates.FINISHED;+ canvas.width = this.canvasWidth;+ canvas.height = this.canvasHeight;+ canvas.className = 'thumbnailImage';+ canvas.setAttribute('aria-label', mozL10n.get('thumb_page_canvas',+ {page: this.id}, 'Thumbnail of Page {{page}}'));- if (self.loadingIconDiv) {- div.removeChild(self.loadingIconDiv);- delete self.loadingIconDiv;- }+ this.canvas = canvas;+ this.div.setAttribute('data-loaded', true);+ this.ring.appendChild(canvas);- if (self.zoomLayer) {- div.removeChild(self.zoomLayer);- self.zoomLayer = null;- }+ return canvas.getContext('2d');+ },- if (error) {- PDFView.error(mozL10n.get('rendering_error', null,- 'An error occurred while rendering the page.'), error);+ draw: function PDFThumbnailView_draw() {+ if (this.renderingState !== RenderingStates.INITIAL) {+ console.error('Must be in new state before drawing');}-- self.stats = pdfPage.stats;- self.updateStats();- if (self.onAfterDraw) {- self.onAfterDraw();+ if (this.hasImage) {+ return Promise.resolve(undefined);}+ this.hasImage = true;+ this.renderingState = RenderingStates.RUNNING;- var event = document.createEvent('CustomEvent');- event.initCustomEvent('pagerender', true, true, {- pageNumber: pdfPage.pageNumber+ var resolveRenderPromise, rejectRenderPromise;+ var promise = new Promise(function (resolve, reject) {+ resolveRenderPromise = resolve;+ rejectRenderPromise = reject;});- div.dispatchEvent(event);- callback();- }+ var self = this;+ function thumbnailDrawCallback(error) {+ // The renderTask may have been replaced by a new one, so only remove+ // the reference to the renderTask if it matches the one that is+ // triggering this callback.+ if (renderTask === self.renderTask) {+ self.renderTask = null;+ }+ if (error === 'cancelled') {+ rejectRenderPromise(error);+ return;+ }+ self.renderingState = RenderingStates.FINISHED;++ if (!error) {+ resolveRenderPromise(undefined);+ } else {+ rejectRenderPromise(error);+ }+ }- var renderContext = {- canvasContext: ctx,- viewport: this.viewport,- textLayer: textLayer,- // intent: 'default', // === 'display'- continueCallback: function pdfViewcContinueCallback(cont) {- if (PDFView.highestPriorityPage !== 'page' + self.id) {+ var ctx = this._getPageDrawContext();+ var drawViewport = this.viewport.clone({ scale: this.scale });+ var renderContinueCallback = function renderContinueCallback(cont) {+ if (!self.renderingQueue.isHighestPriority(self)) {self.renderingState = RenderingStates.PAUSED;self.resume = function resumeCallback() {self.renderingState = RenderingStates.RUNNING;@@ -4705,759 +5050,1592 @@ var PageView = function pageView(container, id, scale,return;}cont();- }- };- var renderTask = this.renderTask = this.pdfPage.render(renderContext);-- this.renderTask.promise.then(- function pdfPageRenderCallback() {- pageViewDrawCallback(null);- if (textLayer) {- self.getTextContent().then(- function textContentResolved(textContent) {- textLayer.setTextContent(textContent);- }- );- }- },- function pdfPageRenderError(error) {- pageViewDrawCallback(error);- }- );-- setupAnnotations(div, pdfPage, this.viewport);- div.setAttribute('data-loaded', true);-- // Add the page to the cache at the start of drawing. That way it can be- // evicted from the cache and destroyed even if we pause its rendering.- cache.push(this);- };-- this.beforePrint = function pageViewBeforePrint() {- var pdfPage = this.pdfPage;-- var viewport = pdfPage.getViewport(1);- // Use the same hack we use for high dpi displays for printing to get better- // output until bug 811002 is fixed in FF.- var PRINT_OUTPUT_SCALE = 2;- var canvas = document.createElement('canvas');- canvas.width = Math.floor(viewport.width) * PRINT_OUTPUT_SCALE;- canvas.height = Math.floor(viewport.height) * PRINT_OUTPUT_SCALE;- canvas.style.width = (PRINT_OUTPUT_SCALE * viewport.width) + 'pt';- canvas.style.height = (PRINT_OUTPUT_SCALE * viewport.height) + 'pt';- var cssScale = 'scale(' + (1 / PRINT_OUTPUT_SCALE) + ', ' +- (1 / PRINT_OUTPUT_SCALE) + ')';- CustomStyle.setProp('transform' , canvas, cssScale);- CustomStyle.setProp('transformOrigin' , canvas, '0% 0%');-- var printContainer = document.getElementById('printContainer');- var canvasWrapper = document.createElement('div');- canvasWrapper.style.width = viewport.width + 'pt';- canvasWrapper.style.height = viewport.height + 'pt';- canvasWrapper.appendChild(canvas);- printContainer.appendChild(canvasWrapper);-- canvas.mozPrintCallback = function(obj) {- var ctx = obj.context;-- ctx.save();- ctx.fillStyle = 'rgb(255, 255, 255)';- ctx.fillRect(0, 0, canvas.width, canvas.height);- ctx.restore();- ctx.scale(PRINT_OUTPUT_SCALE, PRINT_OUTPUT_SCALE);+ };var renderContext = {canvasContext: ctx,- viewport: viewport,- intent: 'print'+ viewport: drawViewport,+ continueCallback: renderContinueCallback};-- pdfPage.render(renderContext).promise.then(function() {- // Tell the printEngine that rendering this canvas/page has finished.- obj.done();- }, function(error) {- console.error(error);- // Tell the printEngine that rendering this canvas/page has failed.- // This will make the print proces stop.- if ('abort' in obj) {- obj.abort();- } else {- obj.done();+ var renderTask = this.renderTask = this.pdfPage.render(renderContext);++ renderTask.promise.then(+ function pdfPageRenderCallback() {+ thumbnailDrawCallback(null);+ },+ function pdfPageRenderError(error) {+ thumbnailDrawCallback(error);}- });- };- };-- this.updateStats = function pageViewUpdateStats() {- if (!this.stats) {- return;- }+ );+ return promise;+ },- if (PDFJS.pdfBug && Stats.enabled) {- var stats = this.stats;- Stats.add(this.id, stats);- }- };-};+ setImage: function PDFThumbnailView_setImage(pageView) {+ var img = pageView.canvas;+ if (this.hasImage || !img) {+ return;+ }+ if (!this.pdfPage) {+ this.setPdfPage(pageView.pdfPage);+ }+ this.hasImage = true;+ this.renderingState = RenderingStates.FINISHED;+ var ctx = this._getPageDrawContext();+ var canvas = ctx.canvas;-var ThumbnailView = function thumbnailView(container, id, defaultViewport) {- var anchor = document.createElement('a');- anchor.href = PDFView.getAnchorUrl('#page=' + id);- anchor.title = mozL10n.get('thumb_page_title', {page: id}, 'Page {{page}}');- anchor.onclick = function stopNavigation() {- PDFView.page = id;- return false;+ if (img.width <= 2 * canvas.width) {+ ctx.drawImage(img, 0, 0, img.width, img.height,+ 0, 0, canvas.width, canvas.height);+ return;+ }+ // drawImage does an awful job of rescaling the image, doing it gradually.+ var MAX_NUM_SCALING_STEPS = 3;+ var reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS;+ var reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;+ var reducedImage = getTempCanvas(reducedWidth, reducedHeight);+ var reducedImageCtx = reducedImage.getContext('2d');++ while (reducedWidth > img.width || reducedHeight > img.height) {+ reducedWidth >>= 1;+ reducedHeight >>= 1;+ }+ reducedImageCtx.drawImage(img, 0, 0, img.width, img.height,+ 0, 0, reducedWidth, reducedHeight);+ while (reducedWidth > 2 * canvas.width) {+ reducedImageCtx.drawImage(reducedImage,+ 0, 0, reducedWidth, reducedHeight,+ 0, 0, reducedWidth >> 1, reducedHeight >> 1);+ reducedWidth >>= 1;+ reducedHeight >>= 1;+ }+ ctx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight,+ 0, 0, canvas.width, canvas.height);+ }};- this.pdfPage = undefined;- this.viewport = defaultViewport;- this.pdfPageRotate = defaultViewport.rotation;+ return PDFThumbnailView;+})();- this.rotation = 0;- this.pageWidth = this.viewport.width;- this.pageHeight = this.viewport.height;- this.pageRatio = this.pageWidth / this.pageHeight;- this.id = id;+PDFThumbnailView.tempImageCache = null;- this.canvasWidth = 98;- this.canvasHeight = this.canvasWidth / this.pageWidth * this.pageHeight;- this.scale = (this.canvasWidth / this.pageWidth);- var div = this.el = document.createElement('div');- div.id = 'thumbnailContainer' + id;- div.className = 'thumbnail';+/**+ * @typedef {Object} PDFThumbnailViewerOptions+ * @property {HTMLDivElement} container - The container for the thumbnail+ * elements.+ * @property {IPDFLinkService} linkService - The navigation/linking service.+ * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.+ */- if (id === 1) {- // Highlight the thumbnail of the first page when no page number is- // specified (or exists in cache) when the document is loaded.- div.classList.add('selected');- }+/**+ * Simple viewer control to display thumbnails for pages.+ * @class+ * @implements {IRenderableView}+ */+var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {+ /**+ * @constructs PDFThumbnailViewer+ * @param {PDFThumbnailViewerOptions} options+ */+ function PDFThumbnailViewer(options) {+ this.container = options.container;+ this.renderingQueue = options.renderingQueue;+ this.linkService = options.linkService;- var ring = document.createElement('div');- ring.className = 'thumbnailSelectionRing';- ring.style.width = this.canvasWidth + 'px';- ring.style.height = this.canvasHeight + 'px';+ this.scroll = watchScroll(this.container, this._scrollUpdated.bind(this));+ this._resetView();+ }- div.appendChild(ring);- anchor.appendChild(div);- container.appendChild(anchor);+ PDFThumbnailViewer.prototype = {+ /**+ * @private+ */+ _scrollUpdated: function PDFThumbnailViewer_scrollUpdated() {+ this.renderingQueue.renderHighestPriority();+ },- this.hasImage = false;- this.renderingState = RenderingStates.INITIAL;+ getThumbnail: function PDFThumbnailViewer_getThumbnail(index) {+ return this.thumbnails[index];+ },- this.setPdfPage = function thumbnailViewSetPdfPage(pdfPage) {- this.pdfPage = pdfPage;- this.pdfPageRotate = pdfPage.rotate;- var totalRotation = (this.rotation + this.pdfPageRotate) % 360;- this.viewport = pdfPage.getViewport(1, totalRotation);- this.update();- };+ /**+ * @private+ */+ _getVisibleThumbs: function PDFThumbnailViewer_getVisibleThumbs() {+ return getVisibleElements(this.container, this.thumbnails);+ },- this.update = function thumbnailViewUpdate(rotation) {- if (rotation !== undefined) {- this.rotation = rotation;- }- var totalRotation = (this.rotation + this.pdfPageRotate) % 360;- this.viewport = this.viewport.clone({- scale: 1,- rotation: totalRotation- });- this.pageWidth = this.viewport.width;- this.pageHeight = this.viewport.height;- this.pageRatio = this.pageWidth / this.pageHeight;+ scrollThumbnailIntoView:+ function PDFThumbnailViewer_scrollThumbnailIntoView(page) {+ var selected = document.querySelector('.thumbnail.selected');+ if (selected) {+ selected.classList.remove('selected');+ }+ var thumbnail = document.getElementById('thumbnailContainer' + page);+ if (thumbnail) {+ thumbnail.classList.add('selected');+ }+ var visibleThumbs = this._getVisibleThumbs();+ var numVisibleThumbs = visibleThumbs.views.length;++ // If the thumbnail isn't currently visible, scroll it into view.+ if (numVisibleThumbs > 0) {+ var first = visibleThumbs.first.id;+ // Account for only one thumbnail being visible.+ var last = (numVisibleThumbs > 1 ? visibleThumbs.last.id : first);+ if (page <= first || page >= last) {+ scrollIntoView(thumbnail, { top: THUMBNAIL_SCROLL_MARGIN });+ }+ }+ },- this.canvasHeight = this.canvasWidth / this.pageWidth * this.pageHeight;- this.scale = (this.canvasWidth / this.pageWidth);+ get pagesRotation() {+ return this._pagesRotation;+ },- div.removeAttribute('data-loaded');- ring.textContent = '';- ring.style.width = this.canvasWidth + 'px';- ring.style.height = this.canvasHeight + 'px';+ set pagesRotation(rotation) {+ this._pagesRotation = rotation;+ for (var i = 0, l = this.thumbnails.length; i < l; i++) {+ var thumb = this.thumbnails[i];+ thumb.update(rotation);+ }+ },- this.hasImage = false;- this.renderingState = RenderingStates.INITIAL;- this.resume = null;- };+ cleanup: function PDFThumbnailViewer_cleanup() {+ var tempCanvas = PDFThumbnailView.tempImageCache;+ if (tempCanvas) {+ // Zeroing the width and height causes Firefox to release graphics+ // resources immediately, which can greatly reduce memory consumption.+ tempCanvas.width = 0;+ tempCanvas.height = 0;+ }+ PDFThumbnailView.tempImageCache = null;+ },- this.getPageDrawContext = function thumbnailViewGetPageDrawContext() {- var canvas = document.createElement('canvas');- canvas.id = 'thumbnail' + id;+ /**+ * @private+ */+ _resetView: function PDFThumbnailViewer_resetView() {+ this.thumbnails = [];+ this._pagesRotation = 0;+ this._pagesRequests = [];+ },- canvas.width = this.canvasWidth;- canvas.height = this.canvasHeight;- canvas.className = 'thumbnailImage';- canvas.setAttribute('aria-label', mozL10n.get('thumb_page_canvas',- {page: id}, 'Thumbnail of Page {{page}}'));+ setDocument: function PDFThumbnailViewer_setDocument(pdfDocument) {+ if (this.pdfDocument) {+ // cleanup of the elements and views+ var thumbsView = this.container;+ while (thumbsView.hasChildNodes()) {+ thumbsView.removeChild(thumbsView.lastChild);+ }+ this._resetView();+ }++ this.pdfDocument = pdfDocument;+ if (!pdfDocument) {+ return Promise.resolve();+ }++ return pdfDocument.getPage(1).then(function (firstPage) {+ var pagesCount = pdfDocument.numPages;+ var viewport = firstPage.getViewport(1.0);+ for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {+ var thumbnail = new PDFThumbnailView({+ container: this.container,+ id: pageNum,+ defaultViewport: viewport.clone(),+ linkService: this.linkService,+ renderingQueue: this.renderingQueue+ });+ this.thumbnails.push(thumbnail);+ }+ }.bind(this));+ },- div.setAttribute('data-loaded', true);+ /**+ * @param {PDFPageView} pageView+ * @returns {PDFPage}+ * @private+ */+ _ensurePdfPageLoaded:+ function PDFThumbnailViewer_ensurePdfPageLoaded(thumbView) {+ if (thumbView.pdfPage) {+ return Promise.resolve(thumbView.pdfPage);+ }+ var pageNumber = thumbView.id;+ if (this._pagesRequests[pageNumber]) {+ return this._pagesRequests[pageNumber];+ }+ var promise = this.pdfDocument.getPage(pageNumber).then(+ function (pdfPage) {+ thumbView.setPdfPage(pdfPage);+ this._pagesRequests[pageNumber] = null;+ return pdfPage;+ }.bind(this));+ this._pagesRequests[pageNumber] = promise;+ return promise;+ },- ring.appendChild(canvas);+ ensureThumbnailVisible:+ function PDFThumbnailViewer_ensureThumbnailVisible(page) {+ // Ensure that the thumbnail of the current page is visible+ // when switching from another view.+ scrollIntoView(document.getElementById('thumbnailContainer' + page));+ },- var ctx = canvas.getContext('2d');- ctx.save();- ctx.fillStyle = 'rgb(255, 255, 255)';- ctx.fillRect(0, 0, this.canvasWidth, this.canvasHeight);- ctx.restore();- return ctx;+ forceRendering: function () {+ var visibleThumbs = this._getVisibleThumbs();+ var thumbView = this.renderingQueue.getHighestPriority(visibleThumbs,+ this.thumbnails,+ this.scroll.down);+ if (thumbView) {+ this._ensurePdfPageLoaded(thumbView).then(function () {+ this.renderingQueue.renderView(thumbView);+ }.bind(this));+ return true;+ }+ return false;+ }};- this.drawingRequired = function thumbnailViewDrawingRequired() {- return !this.hasImage;- };+ return PDFThumbnailViewer;+})();- this.draw = function thumbnailViewDraw(callback) {- if (!this.pdfPage) {- var promise = PDFView.getPage(this.id);- promise.then(function(pdfPage) {- this.setPdfPage(pdfPage);- this.draw(callback);- }.bind(this));- return;- }- if (this.renderingState !== RenderingStates.INITIAL) {- console.error('Must be in new state before drawing');- }+/**+ * @typedef {Object} PDFOutlineViewOptions+ * @property {HTMLDivElement} container - The viewer element.+ * @property {Array} outline - An array of outline objects.+ * @property {IPDFLinkService} linkService - The navigation/linking service.+ */- this.renderingState = RenderingStates.RUNNING;- if (this.hasImage) {- callback();- return;- }+/**+ * @class+ */+var PDFOutlineView = (function PDFOutlineViewClosure() {+ /**+ * @constructs PDFOutlineView+ * @param {PDFOutlineViewOptions} options+ */+ function PDFOutlineView(options) {+ this.container = options.container;+ this.outline = options.outline;+ this.linkService = options.linkService;+ }- var self = this;- var ctx = this.getPageDrawContext();- var drawViewport = this.viewport.clone({ scale: this.scale });- var renderContext = {- canvasContext: ctx,- viewport: drawViewport,- continueCallback: function(cont) {- if (PDFView.highestPriorityPage !== 'thumbnail' + self.id) {- self.renderingState = RenderingStates.PAUSED;- self.resume = function() {- self.renderingState = RenderingStates.RUNNING;- cont();- };- return;- }- cont();- }- };- this.pdfPage.render(renderContext).promise.then(- function pdfPageRenderCallback() {- self.renderingState = RenderingStates.FINISHED;- callback();- },- function pdfPageRenderError(error) {- self.renderingState = RenderingStates.FINISHED;- callback();+ PDFOutlineView.prototype = {+ reset: function PDFOutlineView_reset() {+ var container = this.container;+ while (container.firstChild) {+ container.removeChild(container.firstChild);}- );- this.hasImage = true;- };+ },- function getTempCanvas(width, height) {- var tempCanvas = ThumbnailView.tempImageCache;- if (!tempCanvas) {- tempCanvas = document.createElement('canvas');- ThumbnailView.tempImageCache = tempCanvas;- }- tempCanvas.width = width;- tempCanvas.height = height;- return tempCanvas;- }+ /**+ * @private+ */+ _bindLink: function PDFOutlineView_bindLink(element, item) {+ var linkService = this.linkService;+ element.href = linkService.getDestinationHash(item.dest);+ element.onclick = function goToDestination(e) {+ linkService.navigateTo(item.dest);+ return false;+ };+ },- this.setImage = function thumbnailViewSetImage(img) {- if (!this.pdfPage) {- var promise = PDFView.getPage(this.id);- promise.then(function(pdfPage) {- this.setPdfPage(pdfPage);- this.setImage(img);- }.bind(this));- return;- }- if (this.hasImage || !img) {- return;- }- this.renderingState = RenderingStates.FINISHED;- var ctx = this.getPageDrawContext();+ render: function PDFOutlineView_render() {+ var outline = this.outline;- var reducedImage = img;- var reducedWidth = img.width;- var reducedHeight = img.height;+ this.reset();- // drawImage does an awful job of rescaling the image, doing it gradually- var MAX_SCALE_FACTOR = 2.0;- if (Math.max(img.width / ctx.canvas.width,- img.height / ctx.canvas.height) > MAX_SCALE_FACTOR) {- reducedWidth >>= 1;- reducedHeight >>= 1;- reducedImage = getTempCanvas(reducedWidth, reducedHeight);- var reducedImageCtx = reducedImage.getContext('2d');- reducedImageCtx.drawImage(img, 0, 0, img.width, img.height,- 0, 0, reducedWidth, reducedHeight);- while (Math.max(reducedWidth / ctx.canvas.width,- reducedHeight / ctx.canvas.height) > MAX_SCALE_FACTOR) {- reducedImageCtx.drawImage(reducedImage,- 0, 0, reducedWidth, reducedHeight,- 0, 0, reducedWidth >> 1, reducedHeight >> 1);- reducedWidth >>= 1;- reducedHeight >>= 1;+ if (!outline) {+ return;}- }- ctx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight,- 0, 0, ctx.canvas.width, ctx.canvas.height);+ var queue = [{ parent: this.container, items: this.outline }];+ while (queue.length > 0) {+ var levelData = queue.shift();+ for (var i = 0, len = levelData.items.length; i < len; i++) {+ var item = levelData.items[i];+ var div = document.createElement('div');+ div.className = 'outlineItem';+ var element = document.createElement('a');+ this._bindLink(element, item);+ element.textContent = item.title;+ div.appendChild(element);++ if (item.items.length > 0) {+ var itemsDiv = document.createElement('div');+ itemsDiv.className = 'outlineItems';+ div.appendChild(itemsDiv);+ queue.push({ parent: itemsDiv, items: item.items });+ }- this.hasImage = true;+ levelData.parent.appendChild(div);+ }+ }+ }};-};--ThumbnailView.tempImageCache = null;+ return PDFOutlineView;+})();-var FIND_SCROLL_OFFSET_TOP = -50;-var FIND_SCROLL_OFFSET_LEFT = -400;-var MAX_TEXT_DIVS_TO_RENDER = 100000;-var RENDER_DELAY = 200; // ms--var NonWhitespaceRegexp = /\S/;-function isAllWhitespace(str) {- return !NonWhitespaceRegexp.test(str);-}+/**+ * @typedef {Object} PDFAttachmentViewOptions+ * @property {HTMLDivElement} container - The viewer element.+ * @property {Array} attachments - An array of attachment objects.+ * @property {DownloadManager} downloadManager - The download manager.+ *//**- * TextLayerBuilder provides text-selection functionality for the PDF.- * It does this by creating overlay divs over the PDF text. These divs- * contain text that matches the PDF text they are overlaying. This object- * also provides a way to highlight text that is being searched for.+ * @class*/-var TextLayerBuilder = (function TextLayerBuilderClosure() {- function TextLayerBuilder(options) {- this.textLayerDiv = options.textLayerDiv;- this.layoutDone = false;- this.divContentDone = false;- this.pageIdx = options.pageIndex;- this.matches = [];- this.lastScrollSource = options.lastScrollSource || null;- this.viewport = options.viewport;- this.isViewerInPresentationMode = options.isViewerInPresentationMode;- this.textDivs = [];- this.findController = options.findController || null;+var PDFAttachmentView = (function PDFAttachmentViewClosure() {+ /**+ * @constructs PDFAttachmentView+ * @param {PDFAttachmentViewOptions} options+ */+ function PDFAttachmentView(options) {+ this.container = options.container;+ this.attachments = options.attachments;+ this.downloadManager = options.downloadManager;}- TextLayerBuilder.prototype = {- renderLayer: function TextLayerBuilder_renderLayer() {- var textLayerFrag = document.createDocumentFragment();- var textDivs = this.textDivs;- var textDivsLength = textDivs.length;- var canvas = document.createElement('canvas');- var ctx = canvas.getContext('2d');+ PDFAttachmentView.prototype = {+ reset: function PDFAttachmentView_reset() {+ var container = this.container;+ while (container.firstChild) {+ container.removeChild(container.firstChild);+ }+ },- // No point in rendering many divs as it would make the browser- // unusable even after the divs are rendered.- if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) {+ /**+ * @private+ */+ _bindLink: function PDFAttachmentView_bindLink(button, content, filename) {+ button.onclick = function downloadFile(e) {+ this.downloadManager.downloadData(content, filename, '');+ return false;+ }.bind(this);+ },++ render: function PDFAttachmentView_render() {+ var attachments = this.attachments;++ this.reset();++ if (!attachments) {return;}- var lastFontSize;- var lastFontFamily;- for (var i = 0; i < textDivsLength; i++) {- var textDiv = textDivs[i];- if (textDiv.dataset.isWhitespace !== undefined) {- continue;- }+ var names = Object.keys(attachments).sort(function(a, b) {+ return a.toLowerCase().localeCompare(b.toLowerCase());+ });+ for (var i = 0, len = names.length; i < len; i++) {+ var item = attachments[names[i]];+ var filename = getFileName(item.filename);+ var div = document.createElement('div');+ div.className = 'attachmentsItem';+ var button = document.createElement('button');+ this._bindLink(button, item.content, filename);+ button.textContent = filename;+ div.appendChild(button);+ this.container.appendChild(div);+ }+ }+ };- var fontSize = textDiv.style.fontSize;- var fontFamily = textDiv.style.fontFamily;+ return PDFAttachmentView;+})();- // Only build font string and set to context if different from last.- if (fontSize !== lastFontSize || fontFamily !== lastFontFamily) {- ctx.font = fontSize + ' ' + fontFamily;- lastFontSize = fontSize;- lastFontFamily = fontFamily;- }- var width = ctx.measureText(textDiv.textContent).width;- if (width > 0) {- textLayerFrag.appendChild(textDiv);- // Dataset values come of type string.- var textScale = textDiv.dataset.canvasWidth / width;- var rotation = textDiv.dataset.angle;- var transform = 'scale(' + textScale + ', 1)';- if (rotation) {- transform = 'rotate(' + rotation + 'deg) ' + transform;- }- CustomStyle.setProp('transform' , textDiv, transform);- CustomStyle.setProp('transformOrigin' , textDiv, '0% 0%');- }- }+var PDFViewerApplication = {+ initialBookmark: document.location.hash.substring(1),+ initialized: false,+ fellback: false,+ pdfDocument: null,+ sidebarOpen: false,+ printing: false,+ /** @type {PDFViewer} */+ pdfViewer: null,+ /** @type {PDFThumbnailViewer} */+ pdfThumbnailViewer: null,+ /** @type {PDFRenderingQueue} */+ pdfRenderingQueue: null,+ pageRotation: 0,+ updateScaleControls: true,+ isInitialViewSet: false,+ animationStartedPromise: null,+ mouseScrollTimeStamp: 0,+ mouseScrollDelta: 0,+ preferenceSidebarViewOnLoad: SidebarView.NONE,+ preferencePdfBugEnabled: false,+ preferenceShowPreviousViewOnLoad: true,+ isViewerEmbedded: (window.parent !== window),+ url: '',- this.textLayerDiv.appendChild(textLayerFrag);- this.renderingDone = true;- this.updateMatches();- },+ // called once when the document is loaded+ initialize: function pdfViewInitialize() {+ var pdfRenderingQueue = new PDFRenderingQueue();+ pdfRenderingQueue.onIdle = this.cleanup.bind(this);+ this.pdfRenderingQueue = pdfRenderingQueue;- setupRenderLayoutTimer:- function TextLayerBuilder_setupRenderLayoutTimer() {- // Schedule renderLayout() if the user has been scrolling,- // otherwise run it right away.- var self = this;- var lastScroll = (this.lastScrollSource === null ?- 0 : this.lastScrollSource.lastScroll);+ var container = document.getElementById('viewerContainer');+ var viewer = document.getElementById('viewer');+ this.pdfViewer = new PDFViewer({+ container: container,+ viewer: viewer,+ renderingQueue: pdfRenderingQueue,+ linkService: this+ });+ pdfRenderingQueue.setViewer(this.pdfViewer);- if (Date.now() - lastScroll > RENDER_DELAY) { // Render right away- this.renderLayer();- } else { // Schedule- if (this.renderTimer) {- clearTimeout(this.renderTimer);- }- this.renderTimer = setTimeout(function() {- self.setupRenderLayoutTimer();- }, RENDER_DELAY);- }- },+ var thumbnailContainer = document.getElementById('thumbnailView');+ this.pdfThumbnailViewer = new PDFThumbnailViewer({+ container: thumbnailContainer,+ renderingQueue: pdfRenderingQueue,+ linkService: this+ });+ pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);- appendText: function TextLayerBuilder_appendText(geom, styles) {- var style = styles[geom.fontName];- var textDiv = document.createElement('div');- this.textDivs.push(textDiv);- if (isAllWhitespace(geom.str)) {- textDiv.dataset.isWhitespace = true;- return;- }- var tx = PDFJS.Util.transform(this.viewport.transform, geom.transform);- var angle = Math.atan2(tx[1], tx[0]);- if (style.vertical) {- angle += Math.PI / 2;+ Preferences.initialize();++ this.findController = new PDFFindController({+ pdfViewer: this.pdfViewer,+ integratedFind: this.supportsIntegratedFind+ });+ this.pdfViewer.setFindController(this.findController);++ this.findBar = new PDFFindBar({+ bar: document.getElementById('findbar'),+ toggleButton: document.getElementById('viewFind'),+ findField: document.getElementById('findInput'),+ highlightAllCheckbox: document.getElementById('findHighlightAll'),+ caseSensitiveCheckbox: document.getElementById('findMatchCase'),+ findMsg: document.getElementById('findMsg'),+ findStatusIcon: document.getElementById('findStatusIcon'),+ findPreviousButton: document.getElementById('findPrevious'),+ findNextButton: document.getElementById('findNext'),+ findController: this.findController+ });++ this.findController.setFindBar(this.findBar);++ HandTool.initialize({+ container: container,+ toggleHandTool: document.getElementById('toggleHandTool')+ });++ SecondaryToolbar.initialize({+ toolbar: document.getElementById('secondaryToolbar'),+ presentationMode: PresentationMode,+ toggleButton: document.getElementById('secondaryToolbarToggle'),+ presentationModeButton:+ document.getElementById('secondaryPresentationMode'),+ openFile: document.getElementById('secondaryOpenFile'),+ print: document.getElementById('secondaryPrint'),+ download: document.getElementById('secondaryDownload'),+ viewBookmark: document.getElementById('secondaryViewBookmark'),+ firstPage: document.getElementById('firstPage'),+ lastPage: document.getElementById('lastPage'),+ pageRotateCw: document.getElementById('pageRotateCw'),+ pageRotateCcw: document.getElementById('pageRotateCcw'),+ documentProperties: DocumentProperties,+ documentPropertiesButton: document.getElementById('documentProperties')+ });++ PresentationMode.initialize({+ container: container,+ secondaryToolbar: SecondaryToolbar,+ firstPage: document.getElementById('contextFirstPage'),+ lastPage: document.getElementById('contextLastPage'),+ pageRotateCw: document.getElementById('contextPageRotateCw'),+ pageRotateCcw: document.getElementById('contextPageRotateCcw')+ });++ PasswordPrompt.initialize({+ overlayName: 'passwordOverlay',+ passwordField: document.getElementById('password'),+ passwordText: document.getElementById('passwordText'),+ passwordSubmit: document.getElementById('passwordSubmit'),+ passwordCancel: document.getElementById('passwordCancel')+ });++ DocumentProperties.initialize({+ overlayName: 'documentPropertiesOverlay',+ closeButton: document.getElementById('documentPropertiesClose'),+ fileNameField: document.getElementById('fileNameField'),+ fileSizeField: document.getElementById('fileSizeField'),+ titleField: document.getElementById('titleField'),+ authorField: document.getElementById('authorField'),+ subjectField: document.getElementById('subjectField'),+ keywordsField: document.getElementById('keywordsField'),+ creationDateField: document.getElementById('creationDateField'),+ modificationDateField: document.getElementById('modificationDateField'),+ creatorField: document.getElementById('creatorField'),+ producerField: document.getElementById('producerField'),+ versionField: document.getElementById('versionField'),+ pageCountField: document.getElementById('pageCountField')+ });++ var self = this;+ var initializedPromise = Promise.all([+ Preferences.get('enableWebGL').then(function resolved(value) {+ PDFJS.disableWebGL = !value;+ }),+ Preferences.get('sidebarViewOnLoad').then(function resolved(value) {+ self.preferenceSidebarViewOnLoad = value;+ }),+ Preferences.get('pdfBugEnabled').then(function resolved(value) {+ self.preferencePdfBugEnabled = value;+ }),+ Preferences.get('showPreviousViewOnLoad').then(function resolved(value) {+ self.preferenceShowPreviousViewOnLoad = value;+ if (!value && window.history.state) {+ window.history.replaceState(null, '');+ }+ }),+ Preferences.get('disableTextLayer').then(function resolved(value) {+ if (PDFJS.disableTextLayer === true) {+ return;+ }+ PDFJS.disableTextLayer = value;+ }),+ Preferences.get('disableRange').then(function resolved(value) {+ if (PDFJS.disableRange === true) {+ return;+ }+ PDFJS.disableRange = value;+ }),+ Preferences.get('disableAutoFetch').then(function resolved(value) {+ PDFJS.disableAutoFetch = value;+ }),+ Preferences.get('disableFontFace').then(function resolved(value) {+ if (PDFJS.disableFontFace === true) {+ return;+ }+ PDFJS.disableFontFace = value;+ }),+ Preferences.get('useOnlyCssZoom').then(function resolved(value) {+ PDFJS.useOnlyCssZoom = value;+ })++ // TODO move more preferences and other async stuff here+ ]).catch(function (reason) { });++ return initializedPromise.then(function () {+ PDFViewerApplication.initialized = true;+ });+ },++ zoomIn: function pdfViewZoomIn(ticks) {+ var newScale = this.pdfViewer.currentScale;+ do {+ newScale = (newScale * DEFAULT_SCALE_DELTA).toFixed(2);+ newScale = Math.ceil(newScale * 10) / 10;+ newScale = Math.min(MAX_SCALE, newScale);+ } while (--ticks && newScale < MAX_SCALE);+ this.setScale(newScale, true);+ },++ zoomOut: function pdfViewZoomOut(ticks) {+ var newScale = this.pdfViewer.currentScale;+ do {+ newScale = (newScale / DEFAULT_SCALE_DELTA).toFixed(2);+ newScale = Math.floor(newScale * 10) / 10;+ newScale = Math.max(MIN_SCALE, newScale);+ } while (--ticks && newScale > MIN_SCALE);+ this.setScale(newScale, true);+ },++ get currentScaleValue() {+ return this.pdfViewer.currentScaleValue;+ },++ get pagesCount() {+ return this.pdfDocument.numPages;+ },++ set page(val) {+ this.pdfViewer.currentPageNumber = val;+ },++ get page() {+ return this.pdfViewer.currentPageNumber;+ },++ get supportsPrinting() {+ var canvas = document.createElement('canvas');+ var value = 'mozPrintCallback' in canvas;++ return PDFJS.shadow(this, 'supportsPrinting', value);+ },++ get supportsFullscreen() {+ var doc = document.documentElement;+ var support = doc.requestFullscreen || doc.mozRequestFullScreen ||+ doc.webkitRequestFullScreen || doc.msRequestFullscreen;++ if (document.fullscreenEnabled === false ||+ document.mozFullScreenEnabled === false ||+ document.webkitFullscreenEnabled === false ||+ document.msFullscreenEnabled === false) {+ support = false;+ }+ if (support && PDFJS.disableFullscreen === true) {+ support = false;+ }++ return PDFJS.shadow(this, 'supportsFullscreen', support);+ },++ get supportsIntegratedFind() {+ var support = false;++ return PDFJS.shadow(this, 'supportsIntegratedFind', support);+ },++ get supportsDocumentFonts() {+ var support = true;++ return PDFJS.shadow(this, 'supportsDocumentFonts', support);+ },++ get supportsDocumentColors() {+ var support = true;++ return PDFJS.shadow(this, 'supportsDocumentColors', support);+ },++ get loadingBar() {+ var bar = new ProgressBar('#loadingBar', {});++ return PDFJS.shadow(this, 'loadingBar', bar);+ },+++ setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) {+ this.url = url;+ try {+ this.setTitle(decodeURIComponent(getFileName(url)) || url);+ } catch (e) {+ // decodeURIComponent may throw URIError,+ // fall back to using the unprocessed url in that case+ this.setTitle(url);+ }+ },++ setTitle: function pdfViewSetTitle(title) {+ if (this.isViewerEmbedded) {+ // Embedded PDF viewers should not be changing their parent page's title.+ return;+ }+ document.title = title;+ },++ close: function pdfViewClose() {+ var errorWrapper = document.getElementById('errorWrapper');+ errorWrapper.setAttribute('hidden', 'true');++ if (!this.pdfDocument) {+ return;+ }++ this.pdfDocument.destroy();+ this.pdfDocument = null;++ this.pdfThumbnailViewer.setDocument(null);+ this.pdfViewer.setDocument(null);++ if (typeof PDFBug !== 'undefined') {+ PDFBug.cleanup();+ }+ },++ // TODO(mack): This function signature should really be pdfViewOpen(url, args)+ open: function pdfViewOpen(file, scale, password,+ pdfDataRangeTransport, args) {+ if (this.pdfDocument) {+ // Reload the preferences if a document was previously opened.+ Preferences.reload();+ }+ this.close();++ var parameters = {password: password};+ if (typeof file === 'string') { // URL+ this.setTitleUsingUrl(file);+ parameters.url = file;+ } else if (file && 'byteLength' in file) { // ArrayBuffer+ parameters.data = file;+ } else if (file.url && file.originalUrl) {+ this.setTitleUsingUrl(file.originalUrl);+ parameters.url = file.url;+ }+ if (args) {+ for (var prop in args) {+ parameters[prop] = args[prop];}- var fontHeight = Math.sqrt((tx[2] * tx[2]) + (tx[3] * tx[3]));- var fontAscent = fontHeight;- if (style.ascent) {- fontAscent = style.ascent * fontAscent;- } else if (style.descent) {- fontAscent = (1 + style.descent) * fontAscent;+ }++ var self = this;+ self.loading = true;+ self.downloadComplete = false;++ var passwordNeeded = function passwordNeeded(updatePassword, reason) {+ PasswordPrompt.updatePassword = updatePassword;+ PasswordPrompt.reason = reason;+ PasswordPrompt.open();+ };++ function getDocumentProgress(progressData) {+ self.progress(progressData.loaded / progressData.total);+ }++ PDFJS.getDocument(parameters, pdfDataRangeTransport, passwordNeeded,+ getDocumentProgress).then(+ function getDocumentCallback(pdfDocument) {+ self.load(pdfDocument, scale);+ self.loading = false;+ },+ function getDocumentError(exception) {+ var message = exception && exception.message;+ var loadingErrorMessage = mozL10n.get('loading_error', null,+ 'An error occurred while loading the PDF.');++ if (exception instanceof PDFJS.InvalidPDFException) {+ // change error message also for other builds+ loadingErrorMessage = mozL10n.get('invalid_file_error', null,+ 'Invalid or corrupted PDF file.');+ } else if (exception instanceof PDFJS.MissingPDFException) {+ // special message for missing PDF's+ loadingErrorMessage = mozL10n.get('missing_file_error', null,+ 'Missing PDF file.');+ } else if (exception instanceof PDFJS.UnexpectedResponseException) {+ loadingErrorMessage = mozL10n.get('unexpected_response_error', null,+ 'Unexpected server response.');+ }++ var moreInfo = {+ message: message+ };+ self.error(loadingErrorMessage, moreInfo);+ self.loading = false;+ }+ );++ if (args && args.length) {+ DocumentProperties.setFileSize(args.length);+ }+ },++ download: function pdfViewDownload() {+ function downloadByUrl() {+ downloadManager.downloadUrl(url, filename);+ }++ var url = this.url.split('#')[0];+ var filename = getPDFFileNameFromURL(url);+ var downloadManager = new DownloadManager();+ downloadManager.onerror = function (err) {+ // This error won't really be helpful because it's likely the+ // fallback won't work either (or is already open).+ PDFViewerApplication.error('PDF failed to download.');+ };++ if (!this.pdfDocument) { // the PDF is not ready yet+ downloadByUrl();+ return;+ }++ if (!this.downloadComplete) { // the PDF is still downloading+ downloadByUrl();+ return;+ }++ this.pdfDocument.getData().then(+ function getDataSuccess(data) {+ var blob = PDFJS.createBlob(data, 'application/pdf');+ downloadManager.download(blob, url, filename);+ },+ downloadByUrl // Error occurred try downloading with just the url.+ ).then(null, downloadByUrl);+ },++ fallback: function pdfViewFallback(featureId) {+ return;+ },++ navigateTo: function pdfViewNavigateTo(dest) {+ var destString = '';+ var self = this;++ var goToDestination = function(destRef) {+ self.pendingRefStr = null;+ // dest array looks like that: <page-ref> </XYZ|FitXXX> <args..>+ var pageNumber = destRef instanceof Object ?+ self.pagesRefMap[destRef.num + ' ' + destRef.gen + ' R'] :+ (destRef + 1);+ if (pageNumber) {+ if (pageNumber > self.pagesCount) {+ pageNumber = self.pagesCount;+ }+ self.pdfViewer.scrollPageIntoView(pageNumber, dest);++ // Update the browsing history.+ PDFHistory.push({ dest: dest, hash: destString, page: pageNumber });+ } else {+ self.pdfDocument.getPageIndex(destRef).then(function (pageIndex) {+ var pageNum = pageIndex + 1;+ self.pagesRefMap[destRef.num + ' ' + destRef.gen + ' R'] = pageNum;+ goToDestination(destRef);+ });+ }+ };++ var destinationPromise;+ if (typeof dest === 'string') {+ destString = dest;+ destinationPromise = this.pdfDocument.getDestination(dest);+ } else {+ destinationPromise = Promise.resolve(dest);+ }+ destinationPromise.then(function(destination) {+ dest = destination;+ if (!(destination instanceof Array)) {+ return; // invalid destination+ }+ goToDestination(destination[0]);+ });+ },++ executeNamedAction: function pdfViewExecuteNamedAction(action) {+ // See PDF reference, table 8.45 - Named action+ switch (action) {+ case 'GoToPage':+ document.getElementById('pageNumber').focus();+ break;++ case 'GoBack':+ PDFHistory.back();+ break;++ case 'GoForward':+ PDFHistory.forward();+ break;++ case 'Find':+ if (!this.supportsIntegratedFind) {+ this.findBar.toggle();+ }+ break;++ case 'NextPage':+ this.page++;+ break;++ case 'PrevPage':+ this.page--;+ break;++ case 'LastPage':+ this.page = this.pagesCount;+ break;++ case 'FirstPage':+ this.page = 1;+ break;++ default:+ break; // No action according to spec+ }+ },++ getDestinationHash: function pdfViewGetDestinationHash(dest) {+ if (typeof dest === 'string') {+ return this.getAnchorUrl('#' + escape(dest));+ }+ if (dest instanceof Array) {+ var destRef = dest[0]; // see navigateTo method for dest format+ var pageNumber = destRef instanceof Object ?+ this.pagesRefMap[destRef.num + ' ' + destRef.gen + ' R'] :+ (destRef + 1);+ if (pageNumber) {+ var pdfOpenParams = this.getAnchorUrl('#page=' + pageNumber);+ var destKind = dest[1];+ if (typeof destKind === 'object' && 'name' in destKind &&+ destKind.name === 'XYZ') {+ var scale = (dest[4] || this.currentScaleValue);+ var scaleNumber = parseFloat(scale);+ if (scaleNumber) {+ scale = scaleNumber * 100;+ }+ pdfOpenParams += '&zoom=' + scale;+ if (dest[2] || dest[3]) {+ pdfOpenParams += ',' + (dest[2] || 0) + ',' + (dest[3] || 0);+ }+ }+ return pdfOpenParams;}+ }+ return '';+ },- var left;- var top;- if (angle === 0) {- left = tx[4];- top = tx[5] - fontAscent;+ /**+ * Prefix the full url on anchor links to make sure that links are resolved+ * relative to the current URL instead of the one defined in <base href>.+ * @param {String} anchor The anchor hash, including the #.+ */+ getAnchorUrl: function getAnchorUrl(anchor) {+ return anchor;+ },++ /**+ * Show the error box.+ * @param {String} message A message that is human readable.+ * @param {Object} moreInfo (optional) Further information about the error+ * that is more technical. Should have a 'message'+ * and optionally a 'stack' property.+ */+ error: function pdfViewError(message, moreInfo) {+ var moreInfoText = mozL10n.get('error_version_info',+ {version: PDFJS.version || '?', build: PDFJS.build || '?'},+ 'PDF.js v{{version}} (build: {{build}})') + '\n';+ if (moreInfo) {+ moreInfoText +=+ mozL10n.get('error_message', {message: moreInfo.message},+ 'Message: {{message}}');+ if (moreInfo.stack) {+ moreInfoText += '\n' ++ mozL10n.get('error_stack', {stack: moreInfo.stack},+ 'Stack: {{stack}}');} else {- left = tx[4] + (fontAscent * Math.sin(angle));- top = tx[5] - (fontAscent * Math.cos(angle));+ if (moreInfo.filename) {+ moreInfoText += '\n' ++ mozL10n.get('error_file', {file: moreInfo.filename},+ 'File: {{file}}');+ }+ if (moreInfo.lineNumber) {+ moreInfoText += '\n' ++ mozL10n.get('error_line', {line: moreInfo.lineNumber},+ 'Line: {{line}}');+ }}- textDiv.style.left = left + 'px';- textDiv.style.top = top + 'px';- textDiv.style.fontSize = fontHeight + 'px';- textDiv.style.fontFamily = style.fontFamily;+ }- textDiv.textContent = geom.str;- // |fontName| is only used by the Font Inspector. This test will succeed- // when e.g. the Font Inspector is off but the Stepper is on, but it's- // not worth the effort to do a more accurate test.- if (PDFJS.pdfBug) {- textDiv.dataset.fontName = geom.fontName;+ var errorWrapper = document.getElementById('errorWrapper');+ errorWrapper.removeAttribute('hidden');++ var errorMessage = document.getElementById('errorMessage');+ errorMessage.textContent = message;++ var closeButton = document.getElementById('errorClose');+ closeButton.onclick = function() {+ errorWrapper.setAttribute('hidden', 'true');+ };++ var errorMoreInfo = document.getElementById('errorMoreInfo');+ var moreInfoButton = document.getElementById('errorShowMore');+ var lessInfoButton = document.getElementById('errorShowLess');+ moreInfoButton.onclick = function() {+ errorMoreInfo.removeAttribute('hidden');+ moreInfoButton.setAttribute('hidden', 'true');+ lessInfoButton.removeAttribute('hidden');+ errorMoreInfo.style.height = errorMoreInfo.scrollHeight + 'px';+ };+ lessInfoButton.onclick = function() {+ errorMoreInfo.setAttribute('hidden', 'true');+ moreInfoButton.removeAttribute('hidden');+ lessInfoButton.setAttribute('hidden', 'true');+ };+ moreInfoButton.oncontextmenu = noContextMenuHandler;+ lessInfoButton.oncontextmenu = noContextMenuHandler;+ closeButton.oncontextmenu = noContextMenuHandler;+ moreInfoButton.removeAttribute('hidden');+ lessInfoButton.setAttribute('hidden', 'true');+ errorMoreInfo.value = moreInfoText;+ },++ progress: function pdfViewProgress(level) {+ var percent = Math.round(level * 100);+ // When we transition from full request to range requests, it's possible+ // that we discard some of the loaded data. This can cause the loading+ // bar to move backwards. So prevent this by only updating the bar if it+ // increases.+ if (percent > this.loadingBar.percent || isNaN(percent)) {+ this.loadingBar.percent = percent;++ // When disableAutoFetch is enabled, it's not uncommon for the entire file+ // to never be fetched (depends on e.g. the file structure). In this case+ // the loading bar will not be completely filled, nor will it be hidden.+ // To prevent displaying a partially filled loading bar permanently, we+ // hide it when no data has been loaded during a certain amount of time.+ if (PDFJS.disableAutoFetch && percent) {+ if (this.disableAutoFetchLoadingBarTimeout) {+ clearTimeout(this.disableAutoFetchLoadingBarTimeout);+ this.disableAutoFetchLoadingBarTimeout = null;+ }+ this.loadingBar.show();++ this.disableAutoFetchLoadingBarTimeout = setTimeout(function () {+ this.loadingBar.hide();+ this.disableAutoFetchLoadingBarTimeout = null;+ }.bind(this), DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT);}- // Storing into dataset will convert number into string.- if (angle !== 0) {- textDiv.dataset.angle = angle * (180 / Math.PI);+ }+ },++ load: function pdfViewLoad(pdfDocument, scale) {+ var self = this;+ scale = scale || UNKNOWN_SCALE;++ this.findController.reset();++ this.pdfDocument = pdfDocument;++ DocumentProperties.url = this.url;+ DocumentProperties.pdfDocument = pdfDocument;+ DocumentProperties.resolveDataAvailable();++ var downloadedPromise = pdfDocument.getDownloadInfo().then(function() {+ self.downloadComplete = true;+ self.loadingBar.hide();+ });++ var pagesCount = pdfDocument.numPages;+ document.getElementById('numPages').textContent =+ mozL10n.get('page_of', {pageCount: pagesCount}, 'of {{pageCount}}');+ document.getElementById('pageNumber').max = pagesCount;++ var id = this.documentFingerprint = pdfDocument.fingerprint;+ var store = this.store = new ViewHistory(id);++ var pdfViewer = this.pdfViewer;+ pdfViewer.currentScale = scale;+ pdfViewer.setDocument(pdfDocument);+ var firstPagePromise = pdfViewer.firstPagePromise;+ var pagesPromise = pdfViewer.pagesPromise;+ var onePageRendered = pdfViewer.onePageRendered;++ this.pageRotation = 0;+ this.isInitialViewSet = false;+ this.pagesRefMap = pdfViewer.pagesRefMap;++ this.pdfThumbnailViewer.setDocument(pdfDocument);++ firstPagePromise.then(function(pdfPage) {+ downloadedPromise.then(function () {+ var event = document.createEvent('CustomEvent');+ event.initCustomEvent('documentload', true, true, {});+ window.dispatchEvent(event);+ });++ self.loadingBar.setWidth(document.getElementById('viewer'));++ if (!PDFJS.disableHistory && !self.isViewerEmbedded) {+ // The browsing history is only enabled when the viewer is standalone,+ // i.e. not when it is embedded in a web page.+ PDFHistory.initialize(self.documentFingerprint, self);}- if (style.vertical) {- textDiv.dataset.canvasWidth = geom.height * this.viewport.scale;- } else {- textDiv.dataset.canvasWidth = geom.width * this.viewport.scale;+ });++ // Fetch the necessary preference values.+ var defaultZoomValue;+ var defaultZoomValuePromise =+ Preferences.get('defaultZoomValue').then(function (prefValue) {+ defaultZoomValue = prefValue;+ });++ var storePromise = store.initializedPromise;+ Promise.all([firstPagePromise, storePromise, defaultZoomValuePromise]).then(+ function resolved() {+ var storedHash = null;+ if (PDFViewerApplication.preferenceShowPreviousViewOnLoad &&+ store.get('exists', false)) {+ var pageNum = store.get('page', '1');+ var zoom = defaultZoomValue ||+ store.get('zoom', self.pdfViewer.currentScale);+ var left = store.get('scrollLeft', '0');+ var top = store.get('scrollTop', '0');++ storedHash = 'page=' + pageNum + '&zoom=' + zoom + ',' ++ left + ',' + top;+ } else if (defaultZoomValue) {+ storedHash = 'page=1&zoom=' + defaultZoomValue;+ }+ self.setInitialView(storedHash, scale);++ // Make all navigation keys work on document load,+ // unless the viewer is embedded in a web page.+ if (!self.isViewerEmbedded) {+ self.pdfViewer.focus();+ }+ }, function rejected(reason) {+ console.error(reason);++ firstPagePromise.then(function () {+ self.setInitialView(null, scale);+ });+ });++ pagesPromise.then(function() {+ if (self.supportsPrinting) {+ pdfDocument.getJavaScript().then(function(javaScript) {+ if (javaScript.length) {+ console.warn('Warning: JavaScript is not supported');+ self.fallback(PDFJS.UNSUPPORTED_FEATURES.javaScript);+ }+ // Hack to support auto printing.+ var regex = /\bprint\s*\(/g;+ for (var i = 0, ii = javaScript.length; i < ii; i++) {+ var js = javaScript[i];+ if (js && regex.test(js)) {+ setTimeout(function() {+ window.print();+ });+ return;+ }+ }+ });+ }+ });++ // outline depends on pagesRefMap+ var promises = [pagesPromise, this.animationStartedPromise];+ Promise.all(promises).then(function() {+ pdfDocument.getOutline().then(function(outline) {+ var container = document.getElementById('outlineView');+ self.outline = new PDFOutlineView({+ container: container,+ outline: outline,+ linkService: self+ });+ self.outline.render();+ document.getElementById('viewOutline').disabled = !outline;++ if (!outline && !container.classList.contains('hidden')) {+ self.switchSidebarView('thumbs');+ }+ if (outline &&+ self.preferenceSidebarViewOnLoad === SidebarView.OUTLINE) {+ self.switchSidebarView('outline', true);+ }+ });+ pdfDocument.getAttachments().then(function(attachments) {+ var container = document.getElementById('attachmentsView');+ self.attachments = new PDFAttachmentView({+ container: container,+ attachments: attachments,+ downloadManager: new DownloadManager()+ });+ self.attachments.render();+ document.getElementById('viewAttachments').disabled = !attachments;++ if (!attachments && !container.classList.contains('hidden')) {+ self.switchSidebarView('thumbs');+ }+ if (attachments &&+ self.preferenceSidebarViewOnLoad === SidebarView.ATTACHMENTS) {+ self.switchSidebarView('attachments', true);+ }+ });+ });++ if (self.preferenceSidebarViewOnLoad === SidebarView.THUMBS) {+ Promise.all([firstPagePromise, onePageRendered]).then(function () {+ self.switchSidebarView('thumbs', true);+ });+ }++ pdfDocument.getMetadata().then(function(data) {+ var info = data.info, metadata = data.metadata;+ self.documentInfo = info;+ self.metadata = metadata;++ // Provides some basic debug information+ console.log('PDF ' + pdfDocument.fingerprint + ' [' ++ info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() ++ ' / ' + (info.Creator || '-').trim() + ']' ++ ' (PDF.js: ' + (PDFJS.version || '-') ++ (!PDFJS.disableWebGL ? ' [WebGL]' : '') + ')');++ var pdfTitle;+ if (metadata && metadata.has('dc:title')) {+ var title = metadata.get('dc:title');+ // Ghostscript sometimes return 'Untitled', sets the title to 'Untitled'+ if (title !== 'Untitled') {+ pdfTitle = title;+ }}- },- setTextContent: function TextLayerBuilder_setTextContent(textContent) {- this.textContent = textContent;+ if (!pdfTitle && info && info['Title']) {+ pdfTitle = info['Title'];+ }- var textItems = textContent.items;- for (var i = 0, len = textItems.length; i < len; i++) {- this.appendText(textItems[i], textContent.styles);+ if (pdfTitle) {+ self.setTitle(pdfTitle + ' - ' + document.title);}- this.divContentDone = true;- this.setupRenderLayoutTimer();- },- convertMatches: function TextLayerBuilder_convertMatches(matches) {- var i = 0;- var iIndex = 0;- var bidiTexts = this.textContent.items;- var end = bidiTexts.length - 1;- var queryLen = (this.findController === null ?- 0 : this.findController.state.query.length);- var ret = [];+ if (info.IsAcroFormPresent) {+ console.warn('Warning: AcroForm/XFA is not supported');+ self.fallback(PDFJS.UNSUPPORTED_FEATURES.forms);+ }- for (var m = 0, len = matches.length; m < len; m++) {- // Calculate the start position.- var matchIdx = matches[m];+ });+ },- // Loop over the divIdxs.- while (i !== end && matchIdx >= (iIndex + bidiTexts[i].str.length)) {- iIndex += bidiTexts[i].str.length;- i++;- }+ setInitialView: function pdfViewSetInitialView(storedHash, scale) {+ this.isInitialViewSet = true;- if (i === bidiTexts.length) {- console.error('Could not find a matching mapping');- }+ // When opening a new file (when one is already loaded in the viewer):+ // Reset 'currentPageNumber', since otherwise the page's scale will be wrong+ // if 'currentPageNumber' is larger than the number of pages in the file.+ document.getElementById('pageNumber').value =+ this.pdfViewer.currentPageNumber = 1;- var match = {- begin: {- divIdx: i,- offset: matchIdx - iIndex- }- };+ if (PDFHistory.initialDestination) {+ this.navigateTo(PDFHistory.initialDestination);+ PDFHistory.initialDestination = null;+ } else if (this.initialBookmark) {+ this.setHash(this.initialBookmark);+ PDFHistory.push({ hash: this.initialBookmark }, !!this.initialBookmark);+ this.initialBookmark = null;+ } else if (storedHash) {+ this.setHash(storedHash);+ } else if (scale) {+ this.setScale(scale, true);+ this.page = 1;+ }- // Calculate the end position.- matchIdx += queryLen;+ if (this.pdfViewer.currentScale === UNKNOWN_SCALE) {+ // Scale was not initialized: invalid bookmark or scale was not specified.+ // Setting the default one.+ this.setScale(DEFAULT_SCALE, true);+ }+ },- // Somewhat the same array as above, but use > instead of >= to get- // the end position right.- while (i !== end && matchIdx > (iIndex + bidiTexts[i].str.length)) {- iIndex += bidiTexts[i].str.length;- i++;- }+ cleanup: function pdfViewCleanup() {+ this.pdfViewer.cleanup();+ this.pdfThumbnailViewer.cleanup();+ this.pdfDocument.cleanup();+ },- match.end = {- divIdx: i,- offset: matchIdx - iIndex- };- ret.push(match);- }+ forceRendering: function pdfViewForceRendering() {+ this.pdfRenderingQueue.printing = this.printing;+ this.pdfRenderingQueue.isThumbnailViewEnabled = this.sidebarOpen;+ this.pdfRenderingQueue.renderHighestPriority();+ },- return ret;- },+ setHash: function pdfViewSetHash(hash) {+ if (!this.isInitialViewSet) {+ this.initialBookmark = hash;+ return;+ }+ if (!hash) {+ return;+ }- renderMatches: function TextLayerBuilder_renderMatches(matches) {- // Early exit if there is nothing to render.- if (matches.length === 0) {+ if (hash.indexOf('=') >= 0) {+ var params = this.parseQueryString(hash);+ // borrowing syntax from "Parameters for Opening PDF Files"+ if ('nameddest' in params) {+ PDFHistory.updateNextHashParam(params.nameddest);+ this.navigateTo(params.nameddest);return;}-- var bidiTexts = this.textContent.items;- var textDivs = this.textDivs;- var prevEnd = null;- var isSelectedPage = (this.findController === null ?- false : (this.pageIdx === this.findController.selected.pageIdx));- var selectedMatchIdx = (this.findController === null ?- -1 : this.findController.selected.matchIdx);- var highlightAll = (this.findController === null ?- false : this.findController.state.highlightAll);- var infinity = {- divIdx: -1,- offset: undefined- };-- function beginText(begin, className) {- var divIdx = begin.divIdx;- textDivs[divIdx].textContent = '';- appendTextToDiv(divIdx, 0, begin.offset, className);+ var pageNumber, dest;+ if ('page' in params) {+ pageNumber = (params.page | 0) || 1;}+ if ('zoom' in params) {+ // Build the destination array.+ var zoomArgs = params.zoom.split(','); // scale,left,top+ var zoomArg = zoomArgs[0];+ var zoomArgNumber = parseFloat(zoomArg);- function appendTextToDiv(divIdx, fromOffset, toOffset, className) {- var div = textDivs[divIdx];- var content = bidiTexts[divIdx].str.substring(fromOffset, toOffset);- var node = document.createTextNode(content);- if (className) {- var span = document.createElement('span');- span.className = className;- span.appendChild(node);- div.appendChild(span);- return;+ if (zoomArg.indexOf('Fit') === -1) {+ // If the zoomArg is a number, it has to get divided by 100. If it's+ // a string, it should stay as it is.+ dest = [null, { name: 'XYZ' },+ zoomArgs.length > 1 ? (zoomArgs[1] | 0) : null,+ zoomArgs.length > 2 ? (zoomArgs[2] | 0) : null,+ (zoomArgNumber ? zoomArgNumber / 100 : zoomArg)];+ } else {+ if (zoomArg === 'Fit' || zoomArg === 'FitB') {+ dest = [null, { name: zoomArg }];+ } else if ((zoomArg === 'FitH' || zoomArg === 'FitBH') ||+ (zoomArg === 'FitV' || zoomArg === 'FitBV')) {+ dest = [null, { name: zoomArg },+ zoomArgs.length > 1 ? (zoomArgs[1] | 0) : null];+ } else if (zoomArg === 'FitR') {+ if (zoomArgs.length !== 5) {+ console.error('pdfViewSetHash: ' ++ 'Not enough parameters for \'FitR\'.');+ } else {+ dest = [null, { name: zoomArg },+ (zoomArgs[1] | 0), (zoomArgs[2] | 0),+ (zoomArgs[3] | 0), (zoomArgs[4] | 0)];+ }+ } else {+ console.error('pdfViewSetHash: \'' + zoomArg ++ '\' is not a valid zoom value.');+ }}- div.appendChild(node);}+ if (dest) {+ this.pdfViewer.scrollPageIntoView(pageNumber || this.page, dest);+ } else if (pageNumber) {+ this.page = pageNumber; // simple page+ }+ if ('pagemode' in params) {+ if (params.pagemode === 'thumbs' || params.pagemode === 'bookmarks' ||+ params.pagemode === 'attachments') {+ this.switchSidebarView((params.pagemode === 'bookmarks' ?+ 'outline' : params.pagemode), true);+ } else if (params.pagemode === 'none' && this.sidebarOpen) {+ document.getElementById('sidebarToggle').click();+ }+ }+ } else if (/^\d+$/.test(hash)) { // page number+ this.page = hash;+ } else { // named destination+ PDFHistory.updateNextHashParam(unescape(hash));+ this.navigateTo(unescape(hash));+ }+ },- var i0 = selectedMatchIdx, i1 = i0 + 1;- if (highlightAll) {- i0 = 0;- i1 = matches.length;- } else if (!isSelectedPage) {- // Not highlighting all and this isn't the selected page, so do nothing.- return;+ refreshThumbnailViewer: function pdfViewRefreshThumbnailViewer() {+ var pdfViewer = this.pdfViewer;+ var thumbnailViewer = this.pdfThumbnailViewer;++ // set thumbnail images of rendered pages+ var pagesCount = pdfViewer.pagesCount;+ for (var pageIndex = 0; pageIndex < pagesCount; pageIndex++) {+ var pageView = pdfViewer.getPageView(pageIndex);+ if (pageView && pageView.renderingState === RenderingStates.FINISHED) {+ var thumbnailView = thumbnailViewer.getThumbnail(pageIndex);+ thumbnailView.setImage(pageView);}+ }- for (var i = i0; i < i1; i++) {- var match = matches[i];- var begin = match.begin;- var end = match.end;- var isSelected = (isSelectedPage && i === selectedMatchIdx);- var highlightSuffix = (isSelected ? ' selected' : '');+ thumbnailViewer.scrollThumbnailIntoView(this.page);+ },++ switchSidebarView: function pdfViewSwitchSidebarView(view, openSidebar) {+ if (openSidebar && !this.sidebarOpen) {+ document.getElementById('sidebarToggle').click();+ }+ var thumbsView = document.getElementById('thumbnailView');+ var outlineView = document.getElementById('outlineView');+ var attachmentsView = document.getElementById('attachmentsView');++ var thumbsButton = document.getElementById('viewThumbnail');+ var outlineButton = document.getElementById('viewOutline');+ var attachmentsButton = document.getElementById('viewAttachments');++ switch (view) {+ case 'thumbs':+ var wasAnotherViewVisible = thumbsView.classList.contains('hidden');++ thumbsButton.classList.add('toggled');+ outlineButton.classList.remove('toggled');+ attachmentsButton.classList.remove('toggled');+ thumbsView.classList.remove('hidden');+ outlineView.classList.add('hidden');+ attachmentsView.classList.add('hidden');- if (isSelected && !this.isViewerInPresentationMode) {- scrollIntoView(textDivs[begin.divIdx],- { top: FIND_SCROLL_OFFSET_TOP,- left: FIND_SCROLL_OFFSET_LEFT });+ this.forceRendering();++ if (wasAnotherViewVisible) {+ this.pdfThumbnailViewer.ensureThumbnailVisible(this.page);}+ break;- // Match inside new div.- if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {- // If there was a previous div, then add the text at the end.- if (prevEnd !== null) {- appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);- }- // Clear the divs and set the content until the starting point.- beginText(begin);- } else {- appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);+ case 'outline':+ thumbsButton.classList.remove('toggled');+ outlineButton.classList.add('toggled');+ attachmentsButton.classList.remove('toggled');+ thumbsView.classList.add('hidden');+ outlineView.classList.remove('hidden');+ attachmentsView.classList.add('hidden');++ if (outlineButton.getAttribute('disabled')) {+ return;+ }+ break;++ case 'attachments':+ thumbsButton.classList.remove('toggled');+ outlineButton.classList.remove('toggled');+ attachmentsButton.classList.add('toggled');+ thumbsView.classList.add('hidden');+ outlineView.classList.add('hidden');+ attachmentsView.classList.remove('hidden');++ if (attachmentsButton.getAttribute('disabled')) {+ return;}+ break;+ }+ },++ // Helper function to parse query string (e.g. ?param1=value&parm2=...).+ parseQueryString: function pdfViewParseQueryString(query) {+ var parts = query.split('&');+ var params = {};+ for (var i = 0, ii = parts.length; i < ii; ++i) {+ var param = parts[i].split('=');+ var key = param[0].toLowerCase();+ var value = param.length > 1 ? param[1] : null;+ params[decodeURIComponent(key)] = decodeURIComponent(value);+ }+ return params;+ },++ beforePrint: function pdfViewSetupBeforePrint() {+ if (!this.supportsPrinting) {+ var printMessage = mozL10n.get('printing_not_supported', null,+ 'Warning: Printing is not fully supported by this browser.');+ this.error(printMessage);+ return;+ }- if (begin.divIdx === end.divIdx) {- appendTextToDiv(begin.divIdx, begin.offset, end.offset,- 'highlight' + highlightSuffix);- } else {- appendTextToDiv(begin.divIdx, begin.offset, infinity.offset,- 'highlight begin' + highlightSuffix);- for (var n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {- textDivs[n0].className = 'highlight middle' + highlightSuffix;- }- beginText(end, 'highlight end' + highlightSuffix);+ var alertNotReady = false;+ var i, ii;+ if (!this.pagesCount) {+ alertNotReady = true;+ } else {+ for (i = 0, ii = this.pagesCount; i < ii; ++i) {+ if (!this.pdfViewer.getPageView(i).pdfPage) {+ alertNotReady = true;+ break;}- prevEnd = end;}+ }+ if (alertNotReady) {+ var notReadyMessage = mozL10n.get('printing_not_ready', null,+ 'Warning: The PDF is not fully loaded for printing.');+ window.alert(notReadyMessage);+ return;+ }- if (prevEnd) {- appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);- }- },+ this.printing = true;+ this.forceRendering();- updateMatches: function TextLayerBuilder_updateMatches() {- // Only show matches when all rendering is done.- if (!this.renderingDone) {- return;- }+ var body = document.querySelector('body');+ body.setAttribute('data-mozPrintCallback', true);+ for (i = 0, ii = this.pagesCount; i < ii; ++i) {+ this.pdfViewer.getPageView(i).beforePrint();+ }- // Clear all matches.- var matches = this.matches;- var textDivs = this.textDivs;- var bidiTexts = this.textContent.items;- var clearedUntilDivIdx = -1;+ },- // Clear all current matches.- for (var i = 0, len = matches.length; i < len; i++) {- var match = matches[i];- var begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);- for (var n = begin, end = match.end.divIdx; n <= end; n++) {- var div = textDivs[n];- div.textContent = bidiTexts[n].str;- div.className = '';- }- clearedUntilDivIdx = match.end.divIdx + 1;- }+ afterPrint: function pdfViewSetupAfterPrint() {+ var div = document.getElementById('printContainer');+ while (div.hasChildNodes()) {+ div.removeChild(div.lastChild);+ }- if (this.findController === null || !this.findController.active) {- return;- }+ this.printing = false;+ this.forceRendering();+ },- // Convert the matches on the page controller into the match format- // used for the textLayer.- this.matches = this.convertMatches(this.findController === null ?- [] : (this.findController.pageMatches[this.pageIdx] || []));- this.renderMatches(this.matches);- }- };- return TextLayerBuilder;-})();+ setScale: function (value, resetAutoSettings) {+ this.updateScaleControls = !!resetAutoSettings;+ this.pdfViewer.currentScaleValue = value;+ this.updateScaleControls = true;+ },+ rotatePages: function pdfViewRotatePages(delta) {+ var pageNumber = this.page;+ this.pageRotation = (this.pageRotation + 360 + delta) % 360;+ this.pdfViewer.pagesRotation = this.pageRotation;+ this.pdfThumbnailViewer.pagesRotation = this.pageRotation;-var DocumentOutlineView = function documentOutlineView(outline) {- var outlineView = document.getElementById('outlineView');- while (outlineView.firstChild) {- outlineView.removeChild(outlineView.firstChild);- }+ this.forceRendering();- if (!outline) {- if (!outlineView.classList.contains('hidden')) {- PDFView.switchSidebarView('thumbs');- }- return;- }+ this.pdfViewer.scrollPageIntoView(pageNumber);+ },- function bindItemLink(domObj, item) {- domObj.href = PDFView.getDestinationHash(item.dest);- domObj.onclick = function documentOutlineViewOnclick(e) {- PDFView.navigateTo(item.dest);- return false;- };- }+ /**+ * This function flips the page in presentation mode if the user scrolls up+ * or down with large enough motion and prevents page flipping too often.+ *+ * @this {PDFView}+ * @param {number} mouseScrollDelta The delta value from the mouse event.+ */+ mouseScroll: function pdfViewMouseScroll(mouseScrollDelta) {+ var MOUSE_SCROLL_COOLDOWN_TIME = 50;- var queue = [{parent: outlineView, items: outline}];- while (queue.length > 0) {- var levelData = queue.shift();- var i, n = levelData.items.length;- for (i = 0; i < n; i++) {- var item = levelData.items[i];- var div = document.createElement('div');- div.className = 'outlineItem';- var a = document.createElement('a');- bindItemLink(a, item);- a.textContent = item.title;- div.appendChild(a);+ var currentTime = (new Date()).getTime();+ var storedTime = this.mouseScrollTimeStamp;- if (item.items.length > 0) {- var itemsDiv = document.createElement('div');- itemsDiv.className = 'outlineItems';- div.appendChild(itemsDiv);- queue.push({parent: itemsDiv, items: item.items});- }+ // In case one page has already been flipped there is a cooldown time+ // which has to expire before next page can be scrolled on to.+ if (currentTime > storedTime &&+ currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) {+ return;+ }- levelData.parent.appendChild(div);+ // In case the user decides to scroll to the opposite direction than before+ // clear the accumulated delta.+ if ((this.mouseScrollDelta > 0 && mouseScrollDelta < 0) ||+ (this.mouseScrollDelta < 0 && mouseScrollDelta > 0)) {+ this.clearMouseScrollState();}- }-};+ this.mouseScrollDelta += mouseScrollDelta;-var DocumentAttachmentsView = function documentAttachmentsView(attachments) {- var attachmentsView = document.getElementById('attachmentsView');- while (attachmentsView.firstChild) {- attachmentsView.removeChild(attachmentsView.firstChild);- }+ var PAGE_FLIP_THRESHOLD = 120;+ if (Math.abs(this.mouseScrollDelta) >= PAGE_FLIP_THRESHOLD) {- if (!attachments) {- if (!attachmentsView.classList.contains('hidden')) {- PDFView.switchSidebarView('thumbs');- }- return;- }+ var PageFlipDirection = {+ UP: -1,+ DOWN: 1+ };- function bindItemLink(domObj, item) {- domObj.onclick = function documentAttachmentsViewOnclick(e) {- var downloadManager = new DownloadManager();- downloadManager.downloadData(item.content, getFileName(item.filename),- '');- return false;- };- }+ // In presentation mode scroll one page at a time.+ var pageFlipDirection = (this.mouseScrollDelta > 0) ?+ PageFlipDirection.UP :+ PageFlipDirection.DOWN;+ this.clearMouseScrollState();+ var currentPage = this.page;- var names = Object.keys(attachments).sort(function(a,b) {- return a.toLowerCase().localeCompare(b.toLowerCase());- });- for (var i = 0, ii = names.length; i < ii; i++) {- var item = attachments[names[i]];- var div = document.createElement('div');- div.className = 'attachmentsItem';- var button = document.createElement('button');- bindItemLink(button, item);- button.textContent = getFileName(item.filename);- div.appendChild(button);- attachmentsView.appendChild(div);+ // In case we are already on the first or the last page there is no need+ // to do anything.+ if ((currentPage === 1 && pageFlipDirection === PageFlipDirection.UP) ||+ (currentPage === this.pagesCount &&+ pageFlipDirection === PageFlipDirection.DOWN)) {+ return;+ }++ this.page += pageFlipDirection;+ this.mouseScrollTimeStamp = currentTime;+ }+ },++ /**+ * This function clears the member attributes used with mouse scrolling in+ * presentation mode.+ *+ * @this {PDFView}+ */+ clearMouseScrollState: function pdfViewClearMouseScrollState() {+ this.mouseScrollTimeStamp = 0;+ this.mouseScrollDelta = 0;}};-+window.PDFView = PDFViewerApplication; // obsolete name, using it as an aliasfunction webViewerLoad(evt) {- PDFView.initialize().then(webViewerInitialized);+ PDFViewerApplication.initialize().then(webViewerInitialized);}function webViewerInitialized() {- var params = PDFView.parseQueryString(document.location.search.substring(1));+ var queryString = document.location.search.substring(1);+ var params = PDFViewerApplication.parseQueryString(queryString);var file = 'file' in params ? params.file : DEFAULT_URL;var fileInput = document.createElement('input');@@ -5474,94 +6652,89 @@ function webViewerInitialized() {document.getElementById('fileInput').value = null;}- // Special debugging flags in the hash section of the URL.- var hash = document.location.hash.substring(1);- var hashParams = PDFView.parseQueryString(hash);-- if ('disableWorker' in hashParams) {- PDFJS.disableWorker = (hashParams['disableWorker'] === 'true');- }-- if ('disableRange' in hashParams) {- PDFJS.disableRange = (hashParams['disableRange'] === 'true');- }-- if ('disableAutoFetch' in hashParams) {- PDFJS.disableAutoFetch = (hashParams['disableAutoFetch'] === 'true');- }-- if ('disableFontFace' in hashParams) {- PDFJS.disableFontFace = (hashParams['disableFontFace'] === 'true');- }-- if ('disableHistory' in hashParams) {- PDFJS.disableHistory = (hashParams['disableHistory'] === 'true');- }-- if ('webgl' in hashParams) {- PDFJS.disableWebGL = (hashParams['webgl'] !== 'true');- }-- if ('useOnlyCssZoom' in hashParams) {- PDFJS.useOnlyCssZoom = (hashParams['useOnlyCssZoom'] === 'true');- }-- if ('verbosity' in hashParams) {- PDFJS.verbosity = hashParams['verbosity'] | 0;- }-- if ('ignoreCurrentPositionOnZoom' in hashParams) {- IGNORE_CURRENT_POSITION_ON_ZOOM =- (hashParams['ignoreCurrentPositionOnZoom'] === 'true');- }---var locale = PDFJS.locale || navigator.language;- if ('locale' in hashParams) {- locale = hashParams['locale'];- }- mozL10n.setLanguage(locale);- if ('textLayer' in hashParams) {- switch (hashParams['textLayer']) {- case 'off':- PDFJS.disableTextLayer = true;- break;- case 'visible':- case 'shadow':- case 'hover':- var viewer = document.getElementById('viewer');- viewer.classList.add('textLayer-' + hashParams['textLayer']);- break;+ if (PDFViewerApplication.preferencePdfBugEnabled) {+ // Special debugging flags in the hash section of the URL.+ var hash = document.location.hash.substring(1);+ var hashParams = PDFViewerApplication.parseQueryString(hash);++ if ('disableworker' in hashParams) {+ PDFJS.disableWorker = (hashParams['disableworker'] === 'true');+ }+ if ('disablerange' in hashParams) {+ PDFJS.disableRange = (hashParams['disablerange'] === 'true');+ }+ if ('disablestream' in hashParams) {+ PDFJS.disableStream = (hashParams['disablestream'] === 'true');+ }+ if ('disableautofetch' in hashParams) {+ PDFJS.disableAutoFetch = (hashParams['disableautofetch'] === 'true');+ }+ if ('disablefontface' in hashParams) {+ PDFJS.disableFontFace = (hashParams['disablefontface'] === 'true');+ }+ if ('disablehistory' in hashParams) {+ PDFJS.disableHistory = (hashParams['disablehistory'] === 'true');+ }+ if ('webgl' in hashParams) {+ PDFJS.disableWebGL = (hashParams['webgl'] !== 'true');+ }+ if ('useonlycsszoom' in hashParams) {+ PDFJS.useOnlyCssZoom = (hashParams['useonlycsszoom'] === 'true');+ }+ if ('verbosity' in hashParams) {+ PDFJS.verbosity = hashParams['verbosity'] | 0;+ }+ if ('ignorecurrentpositiononzoom' in hashParams) {+ IGNORE_CURRENT_POSITION_ON_ZOOM =+ (hashParams['ignorecurrentpositiononzoom'] === 'true');+ }+ if ('locale' in hashParams) {+ locale = hashParams['locale'];+ }+ if ('textlayer' in hashParams) {+ switch (hashParams['textlayer']) {+ case 'off':+ PDFJS.disableTextLayer = true;+ break;+ case 'visible':+ case 'shadow':+ case 'hover':+ var viewer = document.getElementById('viewer');+ viewer.classList.add('textLayer-' + hashParams['textlayer']);+ break;+ }+ }+ if ('pdfbug' in hashParams) {+ PDFJS.pdfBug = true;+ var pdfBug = hashParams['pdfbug'];+ var enabled = pdfBug.split(',');+ PDFBug.enable(enabled);+ PDFBug.init();}}- if ('pdfBug' in hashParams) {- PDFJS.pdfBug = true;- var pdfBug = hashParams['pdfBug'];- var enabled = pdfBug.split(',');- PDFBug.enable(enabled);- PDFBug.init();- }+ mozL10n.setLanguage(locale);- if (!PDFView.supportsPrinting) {+ if (!PDFViewerApplication.supportsPrinting) {document.getElementById('print').classList.add('hidden');document.getElementById('secondaryPrint').classList.add('hidden');}- if (!PDFView.supportsFullscreen) {+ if (!PDFViewerApplication.supportsFullscreen) {document.getElementById('presentationMode').classList.add('hidden');document.getElementById('secondaryPresentationMode').classList.add('hidden');}- if (PDFView.supportsIntegratedFind) {+ if (PDFViewerApplication.supportsIntegratedFind) {document.getElementById('viewFind').classList.add('hidden');}// Listen for unsupported features to trigger the fallback UI.- PDFJS.UnsupportedManager.listen(PDFView.fallback.bind(PDFView));+ PDFJS.UnsupportedManager.listen(+ PDFViewerApplication.fallback.bind(PDFViewerApplication));// Suppress context menus for some controlsdocument.getElementById('scaleSelect').oncontextmenu = noContextMenuHandler;@@ -5582,63 +6755,65 @@ function webViewerInitialized() {this.classList.toggle('toggled');outerContainer.classList.add('sidebarMoving');outerContainer.classList.toggle('sidebarOpen');- PDFView.sidebarOpen = outerContainer.classList.contains('sidebarOpen');- PDFView.renderHighestPriority();+ PDFViewerApplication.sidebarOpen =+ outerContainer.classList.contains('sidebarOpen');+ if (PDFViewerApplication.sidebarOpen) {+ PDFViewerApplication.refreshThumbnailViewer();+ }+ PDFViewerApplication.forceRendering();});document.getElementById('viewThumbnail').addEventListener('click',function() {- PDFView.switchSidebarView('thumbs');+ PDFViewerApplication.switchSidebarView('thumbs');});document.getElementById('viewOutline').addEventListener('click',function() {- PDFView.switchSidebarView('outline');+ PDFViewerApplication.switchSidebarView('outline');});document.getElementById('viewAttachments').addEventListener('click',function() {- PDFView.switchSidebarView('attachments');+ PDFViewerApplication.switchSidebarView('attachments');});document.getElementById('previous').addEventListener('click',function() {- PDFView.page--;+ PDFViewerApplication.page--;});document.getElementById('next').addEventListener('click',function() {- PDFView.page++;+ PDFViewerApplication.page++;});document.getElementById('zoomIn').addEventListener('click',function() {- PDFView.zoomIn();+ PDFViewerApplication.zoomIn();});document.getElementById('zoomOut').addEventListener('click',function() {- PDFView.zoomOut();+ PDFViewerApplication.zoomOut();});- document.getElementById('pageNumber').addEventListener('click',- function() {- this.select();- });+ document.getElementById('pageNumber').addEventListener('click', function() {+ this.select();+ });- document.getElementById('pageNumber').addEventListener('change',- function() {- // Handle the user inputting a floating point number.- PDFView.page = (this.value | 0);+ document.getElementById('pageNumber').addEventListener('change', function() {+ // Handle the user inputting a floating point number.+ PDFViewerApplication.page = (this.value | 0);- if (this.value !== (this.value | 0).toString()) {- this.value = PDFView.page;- }- });+ if (this.value !== (this.value | 0).toString()) {+ this.value = PDFViewerApplication.page;+ }+ });document.getElementById('scaleSelect').addEventListener('change',function() {- PDFView.setScale(this.value);+ PDFViewerApplication.setScale(this.value, false);});document.getElementById('presentationMode').addEventListener('click',@@ -5658,129 +6833,133 @@ function webViewerInitialized() {// file:-scheme. Load the contents in the main thread because QtWebKit// cannot load file:-URLs in a Web Worker. file:-URLs are usually loaded// very quickly, so there is no need to set up progress event listeners.- PDFView.setTitleUsingUrl(file);+ PDFViewerApplication.setTitleUsingUrl(file);var xhr = new XMLHttpRequest();xhr.onload = function() {- PDFView.open(new Uint8Array(xhr.response), 0);+ PDFViewerApplication.open(new Uint8Array(xhr.response), 0);};try {xhr.open('GET', file);xhr.responseType = 'arraybuffer';xhr.send();} catch (e) {- PDFView.error(mozL10n.get('loading_error', null,- 'An error occurred while loading the PDF.'), e);+ PDFViewerApplication.error(mozL10n.get('loading_error', null,+ 'An error occurred while loading the PDF.'), e);}return;}if (file) {- PDFView.open(file, 0);+ PDFViewerApplication.open(file, 0);}}document.addEventListener('DOMContentLoaded', webViewerLoad, true);-function updateViewarea() {+document.addEventListener('pagerendered', function (e) {+ var pageNumber = e.detail.pageNumber;+ var pageIndex = pageNumber - 1;+ var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex);- if (!PDFView.initialized) {- return;+ if (PDFViewerApplication.sidebarOpen) {+ var thumbnailView = PDFViewerApplication.pdfThumbnailViewer.+ getThumbnail(pageIndex);+ thumbnailView.setImage(pageView);}- var visible = PDFView.getVisiblePages();- var visiblePages = visible.views;- if (visiblePages.length === 0) {- return;++ if (PDFJS.pdfBug && Stats.enabled && pageView.stats) {+ Stats.add(pageNumber, pageView.stats);}- var suggestedCacheSize = Math.max(DEFAULT_CACHE_SIZE,- 2 * visiblePages.length + 1);- cache.resize(suggestedCacheSize);+ if (pageView.error) {+ PDFViewerApplication.error(mozL10n.get('rendering_error', null,+ 'An error occurred while rendering the page.'), pageView.error);+ }- PDFView.renderHighestPriority(visible);- var currentId = PDFView.page;- var firstPage = visible.first;+ // If the page is still visible when it has finished rendering,+ // ensure that the page number input loading indicator is hidden.+ if (pageNumber === PDFViewerApplication.page) {+ var pageNumberInput = document.getElementById('pageNumber');+ pageNumberInput.classList.remove(PAGE_NUMBER_LOADING_INDICATOR);+ }+}, true);- for (var i = 0, ii = visiblePages.length, stillFullyVisible = false;- i < ii; ++i) {- var page = visiblePages[i];+document.addEventListener('textlayerrendered', function (e) {+ var pageIndex = e.detail.pageNumber - 1;+ var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex);- if (page.percent < 100) {- break;- }- if (page.id === PDFView.page) {- stillFullyVisible = true;- break;- }- }+}, true);- if (!stillFullyVisible) {- currentId = visiblePages[0].id;- }+window.addEventListener('presentationmodechanged', function (e) {+ var active = e.detail.active;+ var switchInProgress = e.detail.switchInProgress;+ PDFViewerApplication.pdfViewer.presentationModeState =+ switchInProgress ? PresentationModeState.CHANGING :+ active ? PresentationModeState.FULLSCREEN : PresentationModeState.NORMAL;+});- if (!PresentationMode.active) {- updateViewarea.inProgress = true; // used in "set page"- PDFView.page = currentId;- updateViewarea.inProgress = false;+function updateViewarea() {+ if (!PDFViewerApplication.initialized) {+ return;}+ PDFViewerApplication.pdfViewer.update();+}- var currentScale = PDFView.currentScale;- var currentScaleValue = PDFView.currentScaleValue;- var normalizedScaleValue = parseFloat(currentScaleValue) === currentScale ?- Math.round(currentScale * 10000) / 100 : currentScaleValue;-- var pageNumber = firstPage.id;- var pdfOpenParams = '#page=' + pageNumber;- pdfOpenParams += '&zoom=' + normalizedScaleValue;- var currentPage = PDFView.pages[pageNumber - 1];- var container = PDFView.container;- var topLeft = currentPage.getPagePoint((container.scrollLeft - firstPage.x),- (container.scrollTop - firstPage.y));- var intLeft = Math.round(topLeft[0]);- var intTop = Math.round(topLeft[1]);- pdfOpenParams += ',' + intLeft + ',' + intTop;-- if (PresentationMode.active || PresentationMode.switchInProgress) {- PDFView.currentPosition = null;- } else {- PDFView.currentPosition = { page: pageNumber, left: intLeft, top: intTop };+window.addEventListener('updateviewarea', function () {+ if (!PDFViewerApplication.initialized) {+ return;}- PDFView.store.initializedPromise.then(function() {- PDFView.store.setMultiple({+ var location = PDFViewerApplication.pdfViewer.location;++ PDFViewerApplication.store.initializedPromise.then(function() {+ PDFViewerApplication.store.setMultiple({'exists': true,- 'page': pageNumber,- 'zoom': normalizedScaleValue,- 'scrollLeft': intLeft,- 'scrollTop': intTop+ 'page': location.pageNumber,+ 'zoom': location.scale,+ 'scrollLeft': location.left,+ 'scrollTop': location.top}).catch(function() {// unable to write to storage});});- var href = PDFView.getAnchorUrl(pdfOpenParams);+ var href = PDFViewerApplication.getAnchorUrl(location.pdfOpenParams);document.getElementById('viewBookmark').href = href;document.getElementById('secondaryViewBookmark').href = href;// Update the current bookmark in the browsing history.- PDFHistory.updateCurrentBookmark(pdfOpenParams, pageNumber);-}+ PDFHistory.updateCurrentBookmark(location.pdfOpenParams, location.pageNumber);++ // Show/hide the loading indicator in the page number input element.+ var pageNumberInput = document.getElementById('pageNumber');+ var currentPage =+ PDFViewerApplication.pdfViewer.getPageView(PDFViewerApplication.page - 1);++ if (currentPage.renderingState === RenderingStates.FINISHED) {+ pageNumberInput.classList.remove(PAGE_NUMBER_LOADING_INDICATOR);+ } else {+ pageNumberInput.classList.add(PAGE_NUMBER_LOADING_INDICATOR);+ }+}, true);window.addEventListener('resize', function webViewerResize(evt) {- if (PDFView.initialized &&+ if (PDFViewerApplication.initialized &&(document.getElementById('pageWidthOption').selected ||document.getElementById('pageFitOption').selected ||document.getElementById('pageAutoOption').selected)) {- PDFView.setScale(document.getElementById('scaleSelect').value);+ var selectedScale = document.getElementById('scaleSelect').value;+ PDFViewerApplication.setScale(selectedScale, false);}updateViewarea();// Set the 'max-height' CSS property of the secondary toolbar.- SecondaryToolbar.setMaxHeight(PDFView.container);+ SecondaryToolbar.setMaxHeight(document.getElementById('viewerContainer'));});window.addEventListener('hashchange', function webViewerHashchange(evt) {if (PDFHistory.isHashChangeUnlocked) {- PDFView.setHash(document.location.hash.substring(1));+ PDFViewerApplication.setHash(document.location.hash.substring(1));}});@@ -5793,19 +6972,19 @@ window.addEventListener('change', function webViewerChange(evt) {if (!PDFJS.disableCreateObjectURL &&typeof URL !== 'undefined' && URL.createObjectURL) {- PDFView.open(URL.createObjectURL(file), 0);+ PDFViewerApplication.open(URL.createObjectURL(file), 0);} else {// Read the local file into a Uint8Array.var fileReader = new FileReader();fileReader.onload = function webViewerChangeFileReaderOnload(evt) {var buffer = evt.target.result;var uint8Array = new Uint8Array(buffer);- PDFView.open(uint8Array, 0);+ PDFViewerApplication.open(uint8Array, 0);};fileReader.readAsArrayBuffer(file);}- PDFView.setTitleUsingUrl(file.name);+ PDFViewerApplication.setTitleUsingUrl(file.name);// URL does not reflect proper document location - hiding some icons.document.getElementById('viewBookmark').setAttribute('hidden', 'true');@@ -5833,11 +7012,14 @@ function selectScaleOption(value) {window.addEventListener('localized', function localized(evt) {document.getElementsByTagName('html')[0].dir = mozL10n.getDirection();- PDFView.animationStartedPromise.then(function() {+ PDFViewerApplication.animationStartedPromise.then(function() {// Adjust the width of the zoom box to fit the content.- // Note: This is only done if the zoom box is actually visible,- // since otherwise element.clientWidth will return 0.+ // Note: If the window is narrow enough that the zoom box is not visible,+ // we temporarily show it to be able to adjust its width.var container = document.getElementById('scaleSelectContainer');+ if (container.clientWidth === 0) {+ container.setAttribute('style', 'display: inherit;');+ }if (container.clientWidth > 0) {var select = document.getElementById('scaleSelect');select.setAttribute('style', 'min-width: inherit;');@@ -5849,7 +7031,7 @@ window.addEventListener('localized', function localized(evt) {}// Set the 'max-height' CSS property of the secondary toolbar.- SecondaryToolbar.setMaxHeight(PDFView.container);+ SecondaryToolbar.setMaxHeight(document.getElementById('viewerContainer'));});}, true);@@ -5860,7 +7042,7 @@ window.addEventListener('scalechange', function scalechange(evt) {var customScaleOption = document.getElementById('customScaleOption');customScaleOption.selected = false;- if (!evt.resetAutoSettings &&+ if (!PDFViewerApplication.updateScaleControls &&(document.getElementById('pageWidthOption').selected ||document.getElementById('pageFitOption').selected ||document.getElementById('pageAutoOption').selected)) {@@ -5868,9 +7050,17 @@ window.addEventListener('scalechange', function scalechange(evt) {return;}+ if (evt.presetValue) {+ selectScaleOption(evt.presetValue);+ updateViewarea();+ return;+ }+var predefinedValueFound = selectScaleOption('' + evt.scale);if (!predefinedValueFound) {- customScaleOption.textContent = Math.round(evt.scale * 10000) / 100 + '%';+ var customScale = Math.round(evt.scale * 10000) / 100;+ customScaleOption.textContent =+ mozL10n.get('page_scale_percent', { scale: customScale }, '{{scale}}%');customScaleOption.selected = true;}updateViewarea();@@ -5878,34 +7068,37 @@ window.addEventListener('scalechange', function scalechange(evt) {window.addEventListener('pagechange', function pagechange(evt) {var page = evt.pageNumber;- if (PDFView.previousPageNumber !== page) {+ if (evt.previousPageNumber !== page) {document.getElementById('pageNumber').value = page;- var selected = document.querySelector('.thumbnail.selected');- if (selected) {- selected.classList.remove('selected');- }- var thumbnail = document.getElementById('thumbnailContainer' + page);- thumbnail.classList.add('selected');- var visibleThumbs = PDFView.getVisibleThumbs();- var numVisibleThumbs = visibleThumbs.views.length;-- // If the thumbnail isn't currently visible, scroll it into view.- if (numVisibleThumbs > 0) {- var first = visibleThumbs.first.id;- // Account for only one thumbnail being visible.- var last = (numVisibleThumbs > 1 ? visibleThumbs.last.id : first);- if (page <= first || page >= last) {- scrollIntoView(thumbnail, { top: THUMBNAIL_SCROLL_MARGIN });- }+ if (PDFViewerApplication.sidebarOpen) {+ PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page);}}- var numPages = PDFView.pages.length;+ var numPages = PDFViewerApplication.pagesCount;document.getElementById('previous').disabled = (page <= 1);document.getElementById('next').disabled = (page >= numPages);document.getElementById('firstPage').disabled = (page <= 1);document.getElementById('lastPage').disabled = (page >= numPages);++ // we need to update stats+ if (PDFJS.pdfBug && Stats.enabled) {+ var pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1);+ if (pageView.stats) {+ Stats.add(page, pageView.stats);+ }+ }++ // checking if the this.page was called from the updateViewarea function+ if (evt.updateInProgress) {+ return;+ }+ // Avoid scrolling the first page during loading+ if (this.loading && page === 1) {+ return;+ }+ PDFViewerApplication.pdfViewer.scrollPageIntoView(page);}, true);function handleMouseWheel(evt) {@@ -5914,11 +7107,12 @@ function handleMouseWheel(evt) {evt.wheelDelta / MOUSE_WHEEL_DELTA_FACTOR;var direction = (ticks < 0) ? 'zoomOut' : 'zoomIn';- if (evt.ctrlKey) { // Only zoom the pages, not the entire viewer+ if (PresentationMode.active) {evt.preventDefault();- PDFView[direction](Math.abs(ticks));- } else if (PresentationMode.active) {- PDFView.mouseScroll(ticks * MOUSE_WHEEL_DELTA_FACTOR);+ PDFViewerApplication.mouseScroll(ticks * MOUSE_WHEEL_DELTA_FACTOR);+ } else if (evt.ctrlKey) { // Only zoom the pages, not the entire viewer+ evt.preventDefault();+ PDFViewerApplication[direction](Math.abs(ticks));}}@@ -5927,7 +7121,8 @@ window.addEventListener('mousewheel', handleMouseWheel);window.addEventListener('click', function click(evt) {if (!PresentationMode.active) {- if (SecondaryToolbar.opened && PDFView.container.contains(evt.target)) {+ if (SecondaryToolbar.opened &&+ PDFViewerApplication.pdfViewer.containsElement(evt.target)) {SecondaryToolbar.close();}} else if (evt.button === 0) {@@ -5952,16 +7147,22 @@ window.addEventListener('keydown', function keydown(evt) {// control is selected or not.if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {// either CTRL or META key with optional SHIFT.+ var pdfViewer = PDFViewerApplication.pdfViewer;+ var inPresentationMode = pdfViewer &&+ (pdfViewer.presentationModeState === PresentationModeState.CHANGING ||+ pdfViewer.presentationModeState === PresentationModeState.FULLSCREEN);+switch (evt.keyCode) {case 70: // f- if (!PDFView.supportsIntegratedFind) {- PDFView.findBar.open();+ if (!PDFViewerApplication.supportsIntegratedFind) {+ PDFViewerApplication.findBar.open();handled = true;}break;case 71: // g- if (!PDFView.supportsIntegratedFind) {- PDFView.findBar.dispatchEvent('again', cmd === 5 || cmd === 12);+ if (!PDFViewerApplication.supportsIntegratedFind) {+ PDFViewerApplication.findBar.dispatchEvent('again',+ cmd === 5 || cmd === 12);handled = true;}break;@@ -5969,23 +7170,29 @@ window.addEventListener('keydown', function keydown(evt) {case 107: // FF '+' and '='case 187: // Chrome '+'case 171: // FF with German keyboard- PDFView.zoomIn();+ if (!inPresentationMode) {+ PDFViewerApplication.zoomIn();+ }handled = true;break;case 173: // FF/Mac '-'case 109: // FF '-'case 189: // Chrome '-'- PDFView.zoomOut();+ if (!inPresentationMode) {+ PDFViewerApplication.zoomOut();+ }handled = true;break;case 48: // '0'case 96: // '0' on Numpad of Swedish keyboard- // keeping it unhandled (to restore page zoom to 100%)- setTimeout(function () {- // ... and resetting the scale after browser adjusts its scale- PDFView.setScale(DEFAULT_SCALE, true);- });- handled = false;+ if (!inPresentationMode) {+ // keeping it unhandled (to restore page zoom to 100%)+ setTimeout(function () {+ // ... and resetting the scale after browser adjusts its scale+ PDFViewerApplication.setScale(DEFAULT_SCALE, true);+ });+ handled = false;+ }break;}}@@ -5994,7 +7201,7 @@ window.addEventListener('keydown', function keydown(evt) {if (cmd === 1 || cmd === 8) {switch (evt.keyCode) {case 83: // s- PDFView.download();+ PDFViewerApplication.download();handled = true;break;}@@ -6039,20 +7246,20 @@ window.addEventListener('keydown', function keydown(evt) {case 33: // pg upcase 8: // backspaceif (!PresentationMode.active &&- PDFView.currentScaleValue !== 'page-fit') {+ PDFViewerApplication.currentScaleValue !== 'page-fit') {break;}/* in presentation mode *//* falls through */case 37: // left arrow// horizontal scrolling using arrow keys- if (PDFView.isHorizontalScrollbarEnabled) {+ if (PDFViewerApplication.pdfViewer.isHorizontalScrollbarEnabled) {break;}/* falls through */case 75: // 'k'case 80: // 'p'- PDFView.page--;+ PDFViewerApplication.page--;handled = true;break;case 27: // esc key@@ -6060,8 +7267,9 @@ window.addEventListener('keydown', function keydown(evt) {SecondaryToolbar.close();handled = true;}- if (!PDFView.supportsIntegratedFind && PDFView.findBar.opened) {- PDFView.findBar.close();+ if (!PDFViewerApplication.supportsIntegratedFind &&+ PDFViewerApplication.findBar.opened) {+ PDFViewerApplication.findBar.close();handled = true;}break;@@ -6069,32 +7277,32 @@ window.addEventListener('keydown', function keydown(evt) {case 34: // pg downcase 32: // spacebarif (!PresentationMode.active &&- PDFView.currentScaleValue !== 'page-fit') {+ PDFViewerApplication.currentScaleValue !== 'page-fit') {break;}/* falls through */case 39: // right arrow// horizontal scrolling using arrow keys- if (PDFView.isHorizontalScrollbarEnabled) {+ if (PDFViewerApplication.pdfViewer.isHorizontalScrollbarEnabled) {break;}/* falls through */case 74: // 'j'case 78: // 'n'- PDFView.page++;+ PDFViewerApplication.page++;handled = true;break;case 36: // home- if (PresentationMode.active || PDFView.page > 1) {- PDFView.page = 1;+ if (PresentationMode.active || PDFViewerApplication.page > 1) {+ PDFViewerApplication.page = 1;handled = true;}break;case 35: // end- if (PresentationMode.active || (PDFView.pdfDocument &&- PDFView.page < PDFView.pdfDocument.numPages)) {- PDFView.page = PDFView.pdfDocument.numPages;+ if (PresentationMode.active || (PDFViewerApplication.pdfDocument &&+ PDFViewerApplication.page < PDFViewerApplication.pagesCount)) {+ PDFViewerApplication.page = PDFViewerApplication.pagesCount;handled = true;}break;@@ -6105,7 +7313,7 @@ window.addEventListener('keydown', function keydown(evt) {}break;case 82: // 'r'- PDFView.rotatePages(90);+ PDFViewerApplication.rotatePages(90);break;}}@@ -6114,15 +7322,15 @@ window.addEventListener('keydown', function keydown(evt) {switch (evt.keyCode) {case 32: // spacebarif (!PresentationMode.active &&- PDFView.currentScaleValue !== 'page-fit') {+ PDFViewerApplication.currentScaleValue !== 'page-fit') {break;}- PDFView.page--;+ PDFViewerApplication.page--;handled = true;break;case 82: // 'r'- PDFView.rotatePages(-90);+ PDFViewerApplication.rotatePages(-90);break;}}@@ -6131,16 +7339,16 @@ window.addEventListener('keydown', function keydown(evt) {// 33=Page Up 34=Page Down 35=End 36=Home// 37=Left 38=Up 39=Right 40=Downif (evt.keyCode >= 33 && evt.keyCode <= 40 &&- !PDFView.container.contains(curElement)) {+ !PDFViewerApplication.pdfViewer.containsElement(curElement)) {// The page container is not focused, but a page navigation key has been// pressed. Change the focus to the viewer container to make sure that// navigation by keyboard works as expected.- PDFView.container.focus();+ PDFViewerApplication.pdfViewer.focus();}// 32=Spacebarif (evt.keyCode === 32 && curElementTagName !== 'BUTTON') {- if (!PDFView.container.contains(curElement)) {- PDFView.container.focus();+ if (!PDFViewerApplication.pdfViewer.containsElement(curElement)) {+ PDFViewerApplication.pdfViewer.focus();}}}@@ -6164,22 +7372,23 @@ window.addEventListener('keydown', function keydown(evt) {if (handled) {evt.preventDefault();- PDFView.clearMouseScrollState();+ PDFViewerApplication.clearMouseScrollState();}});window.addEventListener('beforeprint', function beforePrint(evt) {- PDFView.beforePrint();+ PDFViewerApplication.beforePrint();});window.addEventListener('afterprint', function afterPrint(evt) {- PDFView.afterPrint();+ PDFViewerApplication.afterPrint();});(function animationStartedClosure() {// The offsetParent is not set until the pdf.js iframe or object is visible.// Waiting for first animation.- PDFView.animationStartedPromise = new Promise(function (resolve) {+ PDFViewerApplication.animationStartedPromise = new Promise(+ function (resolve) {window.requestAnimationFrame(resolve);});})();