|
|
@ -17,7 +17,7 @@ |
|
|
|
/*jshint globalstrict: false */ |
|
|
|
/*jshint globalstrict: false */ |
|
|
|
/* globals PDFJS, PDFViewer, PDFPageView, TextLayerBuilder, PDFLinkService, |
|
|
|
/* globals PDFJS, PDFViewer, PDFPageView, TextLayerBuilder, PDFLinkService, |
|
|
|
DefaultTextLayerFactory, AnnotationsLayerBuilder, PDFHistory, |
|
|
|
DefaultTextLayerFactory, AnnotationsLayerBuilder, PDFHistory, |
|
|
|
DefaultAnnotationsLayerFactory, getFileName */ |
|
|
|
DefaultAnnotationsLayerFactory, getFileName, ProgressBar */ |
|
|
|
|
|
|
|
|
|
|
|
// Initializing PDFJS global object (if still undefined)
|
|
|
|
// Initializing PDFJS global object (if still undefined)
|
|
|
|
if (typeof PDFJS === 'undefined') { |
|
|
|
if (typeof PDFJS === 'undefined') { |
|
|
@ -29,7 +29,8 @@ if (typeof PDFJS === 'undefined') { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var CSS_UNITS = 96.0 / 72.0; |
|
|
|
var CSS_UNITS = 96.0 / 72.0; |
|
|
|
var DEFAULT_SCALE = 'auto'; |
|
|
|
var DEFAULT_SCALE_VALUE = 'auto'; |
|
|
|
|
|
|
|
var DEFAULT_SCALE = 1.0; |
|
|
|
var UNKNOWN_SCALE = 0; |
|
|
|
var UNKNOWN_SCALE = 0; |
|
|
|
var MAX_AUTO_SCALE = 1.25; |
|
|
|
var MAX_AUTO_SCALE = 1.25; |
|
|
|
var SCROLLBAR_PADDING = 40; |
|
|
|
var SCROLLBAR_PADDING = 40; |
|
|
@ -2079,7 +2080,8 @@ var PDFViewer = (function pdfViewer() { |
|
|
|
* @returns {number} |
|
|
|
* @returns {number} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
get currentScale() { |
|
|
|
get currentScale() { |
|
|
|
return this._currentScale; |
|
|
|
return this._currentScale !== UNKNOWN_SCALE ? this._currentScale : |
|
|
|
|
|
|
|
DEFAULT_SCALE; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -2091,7 +2093,7 @@ var PDFViewer = (function pdfViewer() { |
|
|
|
} |
|
|
|
} |
|
|
|
if (!this.pdfDocument) { |
|
|
|
if (!this.pdfDocument) { |
|
|
|
this._currentScale = val; |
|
|
|
this._currentScale = val; |
|
|
|
this._currentScaleValue = val.toString(); |
|
|
|
this._currentScaleValue = val !== UNKNOWN_SCALE ? val.toString() : null; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
this._setScale(val, false); |
|
|
|
this._setScale(val, false); |
|
|
@ -2195,7 +2197,7 @@ var PDFViewer = (function pdfViewer() { |
|
|
|
// Fetch a single page so we can get a viewport that will be the default
|
|
|
|
// Fetch a single page so we can get a viewport that will be the default
|
|
|
|
// viewport for all pages
|
|
|
|
// viewport for all pages
|
|
|
|
return firstPagePromise.then(function(pdfPage) { |
|
|
|
return firstPagePromise.then(function(pdfPage) { |
|
|
|
var scale = this._currentScale || 1.0; |
|
|
|
var scale = this.currentScale; |
|
|
|
var viewport = pdfPage.getViewport(scale * CSS_UNITS); |
|
|
|
var viewport = pdfPage.getViewport(scale * CSS_UNITS); |
|
|
|
for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) { |
|
|
|
for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) { |
|
|
|
var textLayerFactory = null; |
|
|
|
var textLayerFactory = null; |
|
|
@ -2453,10 +2455,10 @@ var PDFViewer = (function pdfViewer() { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (scale && scale !== this.currentScale) { |
|
|
|
if (scale && scale !== this._currentScale) { |
|
|
|
this.currentScaleValue = scale; |
|
|
|
this.currentScaleValue = scale; |
|
|
|
} else if (this.currentScale === UNKNOWN_SCALE) { |
|
|
|
} else if (this._currentScale === UNKNOWN_SCALE) { |
|
|
|
this.currentScaleValue = DEFAULT_SCALE; |
|
|
|
this.currentScaleValue = DEFAULT_SCALE_VALUE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (scale === 'page-fit' && !dest[4]) { |
|
|
|
if (scale === 'page-fit' && !dest[4]) { |
|
|
@ -3104,5 +3106,6 @@ var PDFHistory = (function () { |
|
|
|
PDFJS.PDFHistory = PDFHistory; |
|
|
|
PDFJS.PDFHistory = PDFHistory; |
|
|
|
|
|
|
|
|
|
|
|
PDFJS.getFileName = getFileName; |
|
|
|
PDFJS.getFileName = getFileName; |
|
|
|
|
|
|
|
PDFJS.ProgressBar = ProgressBar; |
|
|
|
}).call((typeof window === 'undefined') ? this : window); |
|
|
|
}).call((typeof window === 'undefined') ? this : window); |
|
|
|
|
|
|
|
|
|
|
|