Browse Source

PDF.js version 2.0.466 - See mozilla/pdf.js@a8e9f6cc290e4f12ceb01f36c783477d1fc75bfe

master v2.0.466
pdfjsbot 7 years ago
parent
commit
de65be6afe
  1. 2
      bower.json
  2. 10
      build/pdf.js
  3. 2
      build/pdf.js.map
  4. 2
      build/pdf.min.js
  5. 6
      build/pdf.worker.js
  6. 2
      build/pdf.worker.js.map
  7. 2
      build/pdf.worker.min.js
  8. 2
      lib/core/worker.js
  9. 6
      lib/display/api.js
  10. 4
      lib/pdf.js
  11. 4
      lib/pdf.worker.js
  12. 18
      lib/test/unit/ui_utils_spec.js
  13. 10
      lib/web/base_viewer.js
  14. 5
      lib/web/firefoxcom.js
  15. 7
      lib/web/genericl10n.js
  16. 3
      lib/web/interfaces.js
  17. 112
      lib/web/pdf_document_properties.js
  18. 4
      lib/web/pdf_viewer.component.js
  19. 9
      lib/web/ui_utils.js
  20. 2
      package.json
  21. 30
      web/pdf_viewer.js
  22. 2
      web/pdf_viewer.js.map

2
bower.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "2.0.457",
"version": "2.0.466",
"main": [
"build/pdf.js",
"build/pdf.worker.js"

10
build/pdf.js

@ -3004,8 +3004,8 @@ exports.GlobalWorkerOptions = GlobalWorkerOptions; @@ -3004,8 +3004,8 @@ exports.GlobalWorkerOptions = GlobalWorkerOptions;
"use strict";
var pdfjsVersion = '2.0.457';
var pdfjsBuild = '5c1a16ba';
var pdfjsVersion = '2.0.466';
var pdfjsBuild = 'a8e9f6cc';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayAPI = __w_pdfjs_require__(117);
var pdfjsDisplayTextLayer = __w_pdfjs_require__(125);
@ -8434,7 +8434,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { @@ -8434,7 +8434,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
}
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId: docId,
apiVersion: '2.0.457',
apiVersion: '2.0.466',
source: {
data: source.data,
url: source.url,
@ -9852,8 +9852,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { @@ -9852,8 +9852,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.457';
exports.build = build = '5c1a16ba';
exports.version = version = '2.0.466';
exports.build = build = 'a8e9f6cc';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

2
build/pdf.js.map

File diff suppressed because one or more lines are too long

2
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

6
build/pdf.worker.js vendored

@ -22361,8 +22361,8 @@ exports.PostScriptCompiler = PostScriptCompiler; @@ -22361,8 +22361,8 @@ exports.PostScriptCompiler = PostScriptCompiler;
"use strict";
var pdfjsVersion = '2.0.457';
var pdfjsBuild = '5c1a16ba';
var pdfjsVersion = '2.0.466';
var pdfjsBuild = 'a8e9f6cc';
var pdfjsCoreWorker = __w_pdfjs_require__(74);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -22575,7 +22575,7 @@ var WorkerMessageHandler = { @@ -22575,7 +22575,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.457';
var workerVersion = '2.0.466';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
}

2
build/pdf.worker.js.map vendored

File diff suppressed because one or more lines are too long

2
build/pdf.worker.min.js vendored

File diff suppressed because one or more lines are too long

2
lib/core/worker.js

@ -223,7 +223,7 @@ var WorkerMessageHandler = { @@ -223,7 +223,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.457';
var workerVersion = '2.0.466';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
}

6
lib/display/api.js

@ -232,7 +232,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { @@ -232,7 +232,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
}
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId: docId,
apiVersion: '2.0.457',
apiVersion: '2.0.466',
source: {
data: source.data,
url: source.url,
@ -1650,8 +1650,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { @@ -1650,8 +1650,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.457';
exports.build = build = '5c1a16ba';
exports.version = version = '2.0.466';
exports.build = build = 'a8e9f6cc';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

4
lib/pdf.js

@ -21,8 +21,8 @@ @@ -21,8 +21,8 @@
*/
'use strict';
var pdfjsVersion = '2.0.457';
var pdfjsBuild = '5c1a16ba';
var pdfjsVersion = '2.0.466';
var pdfjsBuild = 'a8e9f6cc';
var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayAPI = require('./display/api.js');
var pdfjsDisplayTextLayer = require('./display/text_layer.js');

4
lib/pdf.worker.js vendored

@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
*/
'use strict';
var pdfjsVersion = '2.0.457';
var pdfjsBuild = '5c1a16ba';
var pdfjsVersion = '2.0.466';
var pdfjsBuild = 'a8e9f6cc';
var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

18
lib/test/unit/ui_utils_spec.js

@ -226,6 +226,24 @@ describe('ui_utils', function () { @@ -226,6 +226,24 @@ describe('ui_utils', function () {
expect((0, _ui_utils.isValidRotation)(540)).toEqual(true);
});
});
describe('isPortraitOrientation', function () {
it('should be portrait orientation', function () {
expect((0, _ui_utils.isPortraitOrientation)({
width: 200,
height: 400
})).toEqual(true);
expect((0, _ui_utils.isPortraitOrientation)({
width: 500,
height: 500
})).toEqual(true);
});
it('should be landscape orientation', function () {
expect((0, _ui_utils.isPortraitOrientation)({
width: 600,
height: 300
})).toEqual(false);
});
});
describe('waitOnEventOrTimeout', function () {
var eventBus = void 0;
beforeAll(function (done) {

10
lib/web/base_viewer.js

@ -75,9 +75,6 @@ function isSameScale(oldScale, newScale) { @@ -75,9 +75,6 @@ function isSameScale(oldScale, newScale) {
}
return false;
}
function isPortraitOrientation(size) {
return size.width <= size.height;
}
var BaseViewer = function () {
function BaseViewer(options) {
@ -391,8 +388,7 @@ var BaseViewer = function () { @@ -391,8 +388,7 @@ var BaseViewer = function () {
scale = Math.min(pageWidthScale, pageHeightScale);
break;
case 'auto':
var isLandscape = currentPage.width > currentPage.height;
var horizontalScale = isLandscape ? Math.min(pageHeightScale, pageWidthScale) : pageWidthScale;
var horizontalScale = (0, _ui_utils.isPortraitOrientation)(currentPage) ? pageWidthScale : Math.min(pageHeightScale, pageWidthScale);
scale = Math.min(_ui_utils.MAX_AUTO_SCALE, horizontalScale);
break;
default:
@ -675,9 +671,9 @@ var BaseViewer = function () { @@ -675,9 +671,9 @@ var BaseViewer = function () {
if (!this.enablePrintAutoRotate) {
return pagesOverview;
}
var isFirstPagePortrait = isPortraitOrientation(pagesOverview[0]);
var isFirstPagePortrait = (0, _ui_utils.isPortraitOrientation)(pagesOverview[0]);
return pagesOverview.map(function (size) {
if (isFirstPagePortrait === isPortraitOrientation(size)) {
if (isFirstPagePortrait === (0, _ui_utils.isPortraitOrientation)(size)) {
return size;
}
return {

5
lib/web/firefoxcom.js

@ -175,6 +175,11 @@ var MozL10n = function () { @@ -175,6 +175,11 @@ var MozL10n = function () {
}
_createClass(MozL10n, [{
key: 'getLanguage',
value: function getLanguage() {
return Promise.resolve(this.mozL10n.getLanguage());
}
}, {
key: 'getDirection',
value: function getDirection() {
return Promise.resolve(this.mozL10n.getDirection());

7
lib/web/genericl10n.js

@ -47,6 +47,13 @@ var GenericL10n = function () { @@ -47,6 +47,13 @@ var GenericL10n = function () {
}
_createClass(GenericL10n, [{
key: 'getLanguage',
value: function getLanguage() {
return this._ready.then(function (l10n) {
return l10n.getLanguage();
});
}
}, {
key: 'getDirection',
value: function getDirection() {
return this._ready.then(function (l10n) {

3
lib/web/interfaces.js

@ -159,6 +159,9 @@ var IL10n = function () { @@ -159,6 +159,9 @@ var IL10n = function () {
}
_createClass(IL10n, [{
key: 'getLanguage',
value: function getLanguage() {}
}, {
key: 'getDirection',
value: function getDirection() {}
}, {

112
lib/web/pdf_document_properties.js

@ -37,6 +37,20 @@ var _pdf = require('../pdf'); @@ -37,6 +37,20 @@ var _pdf = require('../pdf');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var DEFAULT_FIELD_CONTENT = '-';
var NON_METRIC_LOCALES = ['en-us', 'en-lr', 'my'];
var US_PAGE_NAMES = {
'8.5x11': 'Letter',
'8.5x14': 'Legal'
};
var METRIC_PAGE_NAMES = {
'297x420': 'A3',
'210x297': 'A4'
};
function getPageName(size, isPortrait, pageNames) {
var width = isPortrait ? size.width : size.height;
var height = isPortrait ? size.height : size.width;
return pageNames[width + 'x' + height];
}
var PDFDocumentProperties = function () {
function PDFDocumentProperties(_ref, overlayManager, eventBus) {
@ -65,7 +79,14 @@ var PDFDocumentProperties = function () { @@ -65,7 +79,14 @@ var PDFDocumentProperties = function () {
eventBus.on('pagechanging', function (evt) {
_this._currentPageNumber = evt.pageNumber;
});
eventBus.on('rotationchanging', function (evt) {
_this._pagesRotation = evt.pagesRotation;
});
}
this._isNonMetricLocale = true;
l10n.getLanguage().then(function (locale) {
_this._isNonMetricLocale = NON_METRIC_LOCALES.includes(locale);
});
}
_createClass(PDFDocumentProperties, [{
@ -83,7 +104,8 @@ var PDFDocumentProperties = function () { @@ -83,7 +104,8 @@ var PDFDocumentProperties = function () {
};
Promise.all([this.overlayManager.open(this.overlayName), this._dataAvailableCapability.promise]).then(function () {
var currentPageNumber = _this2._currentPageNumber;
if (_this2.fieldData && currentPageNumber === _this2.fieldData['_currentPageNumber']) {
var pagesRotation = _this2._pagesRotation;
if (_this2.fieldData && currentPageNumber === _this2.fieldData['_currentPageNumber'] && pagesRotation === _this2.fieldData['_pagesRotation']) {
_this2._updateUI();
return;
}
@ -93,7 +115,7 @@ var PDFDocumentProperties = function () { @@ -93,7 +115,7 @@ var PDFDocumentProperties = function () {
contentDispositionFilename = _ref2.contentDispositionFilename;
return Promise.all([info, metadata, contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(_this2.url), _this2._parseFileSize(_this2.maybeFileSize), _this2._parseDate(info.CreationDate), _this2._parseDate(info.ModDate), _this2.pdfDocument.getPage(currentPageNumber).then(function (pdfPage) {
return _this2._parsePageSize((0, _ui_utils.getPageSizeInches)(pdfPage));
return _this2._parsePageSize((0, _ui_utils.getPageSizeInches)(pdfPage), pagesRotation);
})]);
}).then(function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 7),
@ -103,7 +125,7 @@ var PDFDocumentProperties = function () { @@ -103,7 +125,7 @@ var PDFDocumentProperties = function () {
fileSize = _ref4[3],
creationDate = _ref4[4],
modDate = _ref4[5],
pageSizes = _ref4[6];
pageSize = _ref4[6];
freezeFieldData({
'fileName': fileName,
@ -118,9 +140,9 @@ var PDFDocumentProperties = function () { @@ -118,9 +140,9 @@ var PDFDocumentProperties = function () {
'producer': info.Producer,
'version': info.PDFFormatVersion,
'pageCount': _this2.pdfDocument.numPages,
'pageSizeInch': pageSizes.inch,
'pageSizeMM': pageSizes.mm,
'_currentPageNumber': currentPageNumber
'pageSize': pageSize,
'_currentPageNumber': currentPageNumber,
'_pagesRotation': pagesRotation
});
_this2._updateUI();
return _this2.pdfDocument.getDownloadInfo();
@ -175,6 +197,7 @@ var PDFDocumentProperties = function () { @@ -175,6 +197,7 @@ var PDFDocumentProperties = function () {
delete this.fieldData;
this._dataAvailableCapability = (0, _pdf.createPromiseCapability)();
this._currentPageNumber = 1;
this._pagesRotation = 0;
}
}, {
key: '_updateUI',
@ -216,27 +239,68 @@ var PDFDocumentProperties = function () { @@ -216,27 +239,68 @@ var PDFDocumentProperties = function () {
}
}, {
key: '_parsePageSize',
value: function _parsePageSize(pageSizeInches) {
value: function _parsePageSize(pageSizeInches, pagesRotation) {
var _this3 = this;
if (!pageSizeInches) {
return Promise.resolve({
inch: undefined,
mm: undefined
});
return Promise.resolve(undefined);
}
var width = pageSizeInches.width,
height = pageSizeInches.height;
return Promise.all([this.l10n.get('document_properties_page_size_in_2', {
width: (Math.round(width * 100) / 100).toLocaleString(),
height: (Math.round(height * 100) / 100).toLocaleString()
}, '{{width}} × {{height}} in'), this.l10n.get('document_properties_page_size_mm_2', {
width: (Math.round(width * 25.4 * 10) / 10).toLocaleString(),
height: (Math.round(height * 25.4 * 10) / 10).toLocaleString()
}, '{{width}} × {{height}} mm')]).then(function (sizes) {
return {
inch: sizes[0],
mm: sizes[1]
if (pagesRotation % 180 !== 0) {
pageSizeInches = {
width: pageSizeInches.height,
height: pageSizeInches.width
};
}
var isPortrait = (0, _ui_utils.isPortraitOrientation)(pageSizeInches);
var sizeInches = {
width: Math.round(pageSizeInches.width * 100) / 100,
height: Math.round(pageSizeInches.height * 100) / 100
};
var sizeMillimeters = {
width: Math.round(pageSizeInches.width * 25.4 * 10) / 10,
height: Math.round(pageSizeInches.height * 25.4 * 10) / 10
};
var pageName = null;
var name = getPageName(sizeInches, isPortrait, US_PAGE_NAMES) || getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES);
if (!name && !(Number.isInteger(sizeMillimeters.width) && Number.isInteger(sizeMillimeters.height))) {
var exactMillimeters = {
width: pageSizeInches.width * 25.4,
height: pageSizeInches.height * 25.4
};
var intMillimeters = {
width: Math.round(sizeMillimeters.width),
height: Math.round(sizeMillimeters.height)
};
if (Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 && Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1) {
name = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES);
if (name) {
sizeInches = {
width: Math.round(intMillimeters.width / 25.4 * 100) / 100,
height: Math.round(intMillimeters.height / 25.4 * 100) / 100
};
sizeMillimeters = intMillimeters;
}
}
}
if (name) {
pageName = this.l10n.get('document_properties_page_size_name_' + name.toLowerCase(), null, name);
}
return Promise.all([this._isNonMetricLocale ? sizeInches : sizeMillimeters, this.l10n.get('document_properties_page_size_unit_' + (this._isNonMetricLocale ? 'inches' : 'millimeters'), null, this._isNonMetricLocale ? 'in' : 'mm'), pageName, this.l10n.get('document_properties_page_size_orientation_' + (isPortrait ? 'portrait' : 'landscape'), null, isPortrait ? 'portrait' : 'landscape')]).then(function (_ref6) {
var _ref7 = _slicedToArray(_ref6, 4),
_ref7$ = _ref7[0],
width = _ref7$.width,
height = _ref7$.height,
unit = _ref7[1],
name = _ref7[2],
orientation = _ref7[3];
return _this3.l10n.get('document_properties_page_size_dimension_' + (name ? 'name_' : '') + 'string', {
width: width.toLocaleString(),
height: height.toLocaleString(),
unit: unit,
name: name,
orientation: orientation
}, '{{width}} × {{height}} {{unit}} (' + (name ? '{{name}}, ' : '') + '{{orientation}})');
});
}
}, {

4
lib/web/pdf_viewer.component.js

@ -48,8 +48,8 @@ var _pdf_single_page_viewer = require('./pdf_single_page_viewer'); @@ -48,8 +48,8 @@ var _pdf_single_page_viewer = require('./pdf_single_page_viewer');
var _pdf_viewer = require('./pdf_viewer.js');
var pdfjsVersion = '2.0.457';
var pdfjsBuild = '5c1a16ba';
var pdfjsVersion = '2.0.466';
var pdfjsBuild = 'a8e9f6cc';
exports.PDFViewer = _pdf_viewer.PDFViewer;
exports.PDFSinglePageViewer = _pdf_single_page_viewer.PDFSinglePageViewer;
exports.PDFPageView = _pdf_page_view.PDFPageView;

9
lib/web/ui_utils.js

@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.waitOnEventOrTimeout = exports.WaitOnType = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.getPageSizeInches = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.TextLayerMode = exports.RendererType = exports.PresentationModeState = exports.cloneObj = exports.isFileSchema = exports.isValidRotation = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined;
exports.waitOnEventOrTimeout = exports.WaitOnType = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.getPageSizeInches = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.TextLayerMode = exports.RendererType = exports.PresentationModeState = exports.cloneObj = exports.isFileSchema = exports.isPortraitOrientation = exports.isValidRotation = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@ -69,6 +69,9 @@ function formatL10nValue(text, args) { @@ -69,6 +69,9 @@ function formatL10nValue(text, args) {
});
}
var NullL10n = {
getLanguage: function getLanguage() {
return Promise.resolve('en-us');
},
getDirection: function getDirection() {
return Promise.resolve('ltr');
},
@ -361,6 +364,9 @@ function normalizeWheelEventDelta(evt) { @@ -361,6 +364,9 @@ function normalizeWheelEventDelta(evt) {
function isValidRotation(angle) {
return Number.isInteger(angle) && angle % 90 === 0;
}
function isPortraitOrientation(size) {
return size.width <= size.height;
}
function cloneObj(obj) {
var result = Object.create(null);
for (var i in obj) {
@ -545,6 +551,7 @@ exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE; @@ -545,6 +551,7 @@ exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE;
exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
exports.VERTICAL_PADDING = VERTICAL_PADDING;
exports.isValidRotation = isValidRotation;
exports.isPortraitOrientation = isPortraitOrientation;
exports.isFileSchema = isFileSchema;
exports.cloneObj = cloneObj;
exports.PresentationModeState = PresentationModeState;

2
package.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "2.0.457",
"version": "2.0.466",
"main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.",
"keywords": [

30
web/pdf_viewer.js

@ -105,7 +105,7 @@ return /******/ (function(modules) { // webpackBootstrap @@ -105,7 +105,7 @@ return /******/ (function(modules) { // webpackBootstrap
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.waitOnEventOrTimeout = exports.WaitOnType = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.getPageSizeInches = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.TextLayerMode = exports.RendererType = exports.PresentationModeState = exports.cloneObj = exports.isFileSchema = exports.isValidRotation = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined;
exports.waitOnEventOrTimeout = exports.WaitOnType = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.getPageSizeInches = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.TextLayerMode = exports.RendererType = exports.PresentationModeState = exports.cloneObj = exports.isFileSchema = exports.isPortraitOrientation = exports.isValidRotation = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@ -150,6 +150,9 @@ function formatL10nValue(text, args) { @@ -150,6 +150,9 @@ function formatL10nValue(text, args) {
});
}
var NullL10n = {
getLanguage: function getLanguage() {
return Promise.resolve('en-us');
},
getDirection: function getDirection() {
return Promise.resolve('ltr');
},
@ -442,6 +445,9 @@ function normalizeWheelEventDelta(evt) { @@ -442,6 +445,9 @@ function normalizeWheelEventDelta(evt) {
function isValidRotation(angle) {
return Number.isInteger(angle) && angle % 90 === 0;
}
function isPortraitOrientation(size) {
return size.width <= size.height;
}
function cloneObj(obj) {
var result = Object.create(null);
for (var i in obj) {
@ -626,6 +632,7 @@ exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE; @@ -626,6 +632,7 @@ exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE;
exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
exports.VERTICAL_PADDING = VERTICAL_PADDING;
exports.isValidRotation = isValidRotation;
exports.isPortraitOrientation = isPortraitOrientation;
exports.isFileSchema = isFileSchema;
exports.cloneObj = cloneObj;
exports.PresentationModeState = PresentationModeState;
@ -2419,9 +2426,6 @@ function isSameScale(oldScale, newScale) { @@ -2419,9 +2426,6 @@ function isSameScale(oldScale, newScale) {
}
return false;
}
function isPortraitOrientation(size) {
return size.width <= size.height;
}
var BaseViewer = function () {
function BaseViewer(options) {
@ -2735,8 +2739,7 @@ var BaseViewer = function () { @@ -2735,8 +2739,7 @@ var BaseViewer = function () {
scale = Math.min(pageWidthScale, pageHeightScale);
break;
case 'auto':
var isLandscape = currentPage.width > currentPage.height;
var horizontalScale = isLandscape ? Math.min(pageHeightScale, pageWidthScale) : pageWidthScale;
var horizontalScale = (0, _ui_utils.isPortraitOrientation)(currentPage) ? pageWidthScale : Math.min(pageHeightScale, pageWidthScale);
scale = Math.min(_ui_utils.MAX_AUTO_SCALE, horizontalScale);
break;
default:
@ -3019,9 +3022,9 @@ var BaseViewer = function () { @@ -3019,9 +3022,9 @@ var BaseViewer = function () {
if (!this.enablePrintAutoRotate) {
return pagesOverview;
}
var isFirstPagePortrait = isPortraitOrientation(pagesOverview[0]);
var isFirstPagePortrait = (0, _ui_utils.isPortraitOrientation)(pagesOverview[0]);
return pagesOverview.map(function (size) {
if (isFirstPagePortrait === isPortraitOrientation(size)) {
if (isFirstPagePortrait === (0, _ui_utils.isPortraitOrientation)(size)) {
return size;
}
return {
@ -3201,8 +3204,8 @@ var _pdf_single_page_viewer = __w_pdfjs_require__(16); @@ -3201,8 +3204,8 @@ var _pdf_single_page_viewer = __w_pdfjs_require__(16);
var _pdf_viewer = __w_pdfjs_require__(17);
var pdfjsVersion = '2.0.457';
var pdfjsBuild = '5c1a16ba';
var pdfjsVersion = '2.0.466';
var pdfjsBuild = 'a8e9f6cc';
exports.PDFViewer = _pdf_viewer.PDFViewer;
exports.PDFSinglePageViewer = _pdf_single_page_viewer.PDFSinglePageViewer;
exports.PDFPageView = _pdf_page_view.PDFPageView;
@ -3338,6 +3341,13 @@ var GenericL10n = function () { @@ -3338,6 +3341,13 @@ var GenericL10n = function () {
}
_createClass(GenericL10n, [{
key: 'getLanguage',
value: function getLanguage() {
return this._ready.then(function (l10n) {
return l10n.getLanguage();
});
}
}, {
key: 'getDirection',
value: function getDirection() {
return this._ready.then(function (l10n) {

2
web/pdf_viewer.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save