pdfjs-dist
Advanced tools
Comparing version 2.0.455 to 2.0.457
{ | ||
"name": "pdfjs-dist", | ||
"version": "2.0.455", | ||
"version": "2.0.457", | ||
"main": [ | ||
@@ -5,0 +5,0 @@ "build/pdf.js", |
@@ -226,3 +226,3 @@ /** | ||
var apiVersion = docParams.apiVersion; | ||
var workerVersion = '2.0.455'; | ||
var workerVersion = '2.0.457'; | ||
if (apiVersion !== null && apiVersion !== workerVersion) { | ||
@@ -229,0 +229,0 @@ throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".')); |
@@ -31,4 +31,2 @@ /** | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
@@ -238,3 +236,3 @@ | ||
docId: docId, | ||
apiVersion: '2.0.455', | ||
apiVersion: '2.0.457', | ||
source: { | ||
@@ -453,15 +451,2 @@ data: source.data, | ||
}, | ||
get pageSizeInches() { | ||
var _view = _slicedToArray(this.view, 4), | ||
x1 = _view[0], | ||
y1 = _view[1], | ||
x2 = _view[2], | ||
y2 = _view[3], | ||
userUnit = this.userUnit; | ||
return { | ||
width: (x2 - x1) / 72 * userUnit, | ||
height: (y2 - y1) / 72 * userUnit | ||
}; | ||
}, | ||
getViewport: function getViewport(scale) { | ||
@@ -1671,4 +1656,4 @@ var rotate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.rotate; | ||
{ | ||
exports.version = version = '2.0.455'; | ||
exports.build = build = '6cc0efe1'; | ||
exports.version = version = '2.0.457'; | ||
exports.build = build = '5c1a16ba'; | ||
} | ||
@@ -1675,0 +1660,0 @@ exports.getDocument = getDocument; |
@@ -24,4 +24,4 @@ /** | ||
var pdfjsVersion = '2.0.455'; | ||
var pdfjsBuild = '6cc0efe1'; | ||
var pdfjsVersion = '2.0.457'; | ||
var pdfjsBuild = '5c1a16ba'; | ||
var pdfjsSharedUtil = require('./shared/util.js'); | ||
@@ -28,0 +28,0 @@ var pdfjsDisplayAPI = require('./display/api.js'); |
@@ -24,5 +24,5 @@ /** | ||
var pdfjsVersion = '2.0.455'; | ||
var pdfjsBuild = '6cc0efe1'; | ||
var pdfjsVersion = '2.0.457'; | ||
var pdfjsBuild = '5c1a16ba'; | ||
var pdfjsCoreWorker = require('./core/worker.js'); | ||
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; |
@@ -848,10 +848,2 @@ /** | ||
}); | ||
it('gets page size (in inches)', function () { | ||
var _page$pageSizeInches = page.pageSizeInches, | ||
width = _page$pageSizeInches.width, | ||
height = _page$pageSizeInches.height; | ||
expect(+width.toPrecision(3)).toEqual(8.27); | ||
expect(+height.toPrecision(4)).toEqual(11.69); | ||
}); | ||
it('gets viewport', function () { | ||
@@ -858,0 +850,0 @@ var viewport = page.getViewport(1.5, 90); |
@@ -321,2 +321,44 @@ /** | ||
}); | ||
describe('getPageSizeInches', function () { | ||
it('gets page size (in inches)', function () { | ||
var page = { | ||
view: [0, 0, 595.28, 841.89], | ||
userUnit: 1.0, | ||
rotate: 0 | ||
}; | ||
var _getPageSizeInches = (0, _ui_utils.getPageSizeInches)(page), | ||
width = _getPageSizeInches.width, | ||
height = _getPageSizeInches.height; | ||
expect(+width.toPrecision(3)).toEqual(8.27); | ||
expect(+height.toPrecision(4)).toEqual(11.69); | ||
}); | ||
it('gets page size (in inches), for non-default /Rotate entry', function () { | ||
var pdfPage1 = { | ||
view: [0, 0, 612, 792], | ||
userUnit: 1, | ||
rotate: 0 | ||
}; | ||
var _getPageSizeInches2 = (0, _ui_utils.getPageSizeInches)(pdfPage1), | ||
width1 = _getPageSizeInches2.width, | ||
height1 = _getPageSizeInches2.height; | ||
expect(width1).toEqual(8.5); | ||
expect(height1).toEqual(11); | ||
var pdfPage2 = { | ||
view: [0, 0, 612, 792], | ||
userUnit: 1, | ||
rotate: 90 | ||
}; | ||
var _getPageSizeInches3 = (0, _ui_utils.getPageSizeInches)(pdfPage2), | ||
width2 = _getPageSizeInches3.width, | ||
height2 = _getPageSizeInches3.height; | ||
expect(width2).toEqual(11); | ||
expect(height2).toEqual(8.5); | ||
}); | ||
}); | ||
}); |
@@ -96,3 +96,3 @@ /** | ||
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(pdfPage.pageSizeInches); | ||
return _this2._parsePageSize((0, _ui_utils.getPageSizeInches)(pdfPage)); | ||
})]); | ||
@@ -99,0 +99,0 @@ }).then(function (_ref3) { |
@@ -51,4 +51,4 @@ /** | ||
var pdfjsVersion = '2.0.455'; | ||
var pdfjsBuild = '6cc0efe1'; | ||
var pdfjsVersion = '2.0.457'; | ||
var pdfjsBuild = '5c1a16ba'; | ||
exports.PDFViewer = _pdf_viewer.PDFViewer; | ||
@@ -55,0 +55,0 @@ exports.PDFSinglePageViewer = _pdf_single_page_viewer.PDFSinglePageViewer; |
@@ -27,3 +27,3 @@ /** | ||
}); | ||
exports.waitOnEventOrTimeout = exports.WaitOnType = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = 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.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; | ||
@@ -34,2 +34,4 @@ 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; }; }(); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _pdf = require('../pdf'); | ||
@@ -223,2 +225,21 @@ | ||
} | ||
function getPageSizeInches(_ref) { | ||
var view = _ref.view, | ||
userUnit = _ref.userUnit, | ||
rotate = _ref.rotate; | ||
var _view = _slicedToArray(view, 4), | ||
x1 = _view[0], | ||
y1 = _view[1], | ||
x2 = _view[2], | ||
y2 = _view[3]; | ||
var changeOrientation = rotate % 180 !== 0; | ||
var width = (x2 - x1) / 72 * userUnit; | ||
var height = (y2 - y1) / 72 * userUnit; | ||
return { | ||
width: changeOrientation ? height : width, | ||
height: changeOrientation ? width : height | ||
}; | ||
} | ||
function getVisibleElements(scrollEl, views) { | ||
@@ -359,7 +380,7 @@ var sortByVisibility = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
}; | ||
function waitOnEventOrTimeout(_ref) { | ||
var target = _ref.target, | ||
name = _ref.name, | ||
_ref$delay = _ref.delay, | ||
delay = _ref$delay === undefined ? 0 : _ref$delay; | ||
function waitOnEventOrTimeout(_ref2) { | ||
var target = _ref2.target, | ||
name = _ref2.name, | ||
_ref2$delay = _ref2.delay, | ||
delay = _ref2$delay === undefined ? 0 : _ref2$delay; | ||
@@ -445,6 +466,6 @@ if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) !== 'object' || !(name && typeof name === 'string') || !(Number.isInteger(delay) && delay >= 0)) { | ||
function ProgressBar(id) { | ||
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
height = _ref2.height, | ||
width = _ref2.width, | ||
units = _ref2.units; | ||
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
height = _ref3.height, | ||
width = _ref3.width, | ||
units = _ref3.units; | ||
@@ -545,2 +566,3 @@ _classCallCheck(this, ProgressBar); | ||
exports.roundToDivide = roundToDivide; | ||
exports.getPageSizeInches = getPageSizeInches; | ||
exports.approximateFraction = approximateFraction; | ||
@@ -547,0 +569,0 @@ exports.getOutputScale = getOutputScale; |
{ | ||
"name": "pdfjs-dist", | ||
"version": "2.0.455", | ||
"version": "2.0.457", | ||
"main": "build/pdf.js", | ||
@@ -5,0 +5,0 @@ "description": "Generic build of Mozilla's PDF.js library.", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11059387
138684