|  | @@ -840,7 +840,6 @@ exports.binarySearchFirstItem = binarySearchFirstItem;
 | 
	
		
			
				|  |  |        var event = document.createEvent('UIEvents');
 | 
	
		
			
				|  |  |        event.initUIEvent('pagechange', true, true, window, 0);
 | 
	
		
			
				|  |  |        event.pageNumber = e.pageNumber;
 | 
	
		
			
				|  |  | -      event.previousPageNumber = e.previousPageNumber;
 | 
	
		
			
				|  |  |        e.source.container.dispatchEvent(event);
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |      eventBus.on('pagesinit', function (e) {
 | 
	
	
		
			
				|  | @@ -3427,6 +3426,9 @@ var PDFViewer = (function pdfViewer() {
 | 
	
		
			
				|  |  |       * @param {number} val - The page number.
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      set currentPageNumber(val) {
 | 
	
		
			
				|  |  | +      if ((val | 0) !== val) { // Ensure that `val` is an integer.
 | 
	
		
			
				|  |  | +        throw new Error('Invalid page number.');
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |        if (!this.pdfDocument) {
 | 
	
		
			
				|  |  |          this._currentPageNumber = val;
 | 
	
		
			
				|  |  |          return;
 | 
	
	
		
			
				|  | @@ -3446,22 +3448,14 @@ var PDFViewer = (function pdfViewer() {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -      var arg;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |        if (!(0 < val && val <= this.pagesCount)) {
 | 
	
		
			
				|  |  | -        arg = {
 | 
	
		
			
				|  |  | -          source: this,
 | 
	
		
			
				|  |  | -          pageNumber: this._currentPageNumber,
 | 
	
		
			
				|  |  | -          previousPageNumber: val
 | 
	
		
			
				|  |  | -        };
 | 
	
		
			
				|  |  | -        this.eventBus.dispatch('pagechanging', arg);
 | 
	
		
			
				|  |  | -        this.eventBus.dispatch('pagechange', arg);
 | 
	
		
			
				|  |  |          return;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -      arg = {
 | 
	
		
			
				|  |  | +      var arg = {
 | 
	
		
			
				|  |  |          source: this,
 | 
	
		
			
				|  |  |          pageNumber: val,
 | 
	
		
			
				|  |  | -        previousPageNumber: this._currentPageNumber
 | 
	
		
			
				|  |  |        };
 | 
	
		
			
				|  |  |        this._currentPageNumber = val;
 | 
	
		
			
				|  |  |        this.eventBus.dispatch('pagechanging', arg);
 | 
	
	
		
			
				|  | @@ -3484,7 +3478,7 @@ var PDFViewer = (function pdfViewer() {
 | 
	
		
			
				|  |  |       * @param {number} val - Scale of the pages in percents.
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      set currentScale(val) {
 | 
	
		
			
				|  |  | -      if (isNaN(val))  {
 | 
	
		
			
				|  |  | +      if (isNaN(val)) {
 | 
	
		
			
				|  |  |          throw new Error('Invalid numeric scale');
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        if (!this.pdfDocument) {
 |