pdf.js增加快捷键放大缩小旋转手型拖动,并增加全屏显示工具栏

master
zengwh 6 years ago
parent 769adeb7e3
commit 2a7d53af59

@ -1,3 +1,17 @@
$(function(){
//加载载入组件
$("#loading").css("background","url(../../img/load.gif) no-repeat 10px 50%");
});
//监听加载文件完成情况,完成后移除加载载入组件
var interval = setInterval('loadPdf()', 1000);
function loadPdf() {
if (PDFViewerApplication.pdfDocument == null) {
$('#myModal').modal('show');
} else {
clearInterval(interval);
$('#myModal').remove();
}
}
//屏蔽鼠标右键 //屏蔽鼠标右键
document.oncontextmenu = function(e) { document.oncontextmenu = function(e) {
var e = e || window.event; var e = e || window.event;
@ -10,12 +24,34 @@ function disabledPrint(){
event.keyCode=0; event.keyCode=0;
event.returnValue=false; event.returnValue=false;
} }
if (event.ctrlKey && event.keyCode == 83) { if (event.keyCode == 83 && event.ctrlKey) {
event.preventDefault(); event.preventDefault();
event.returnValue = false; event.returnValue = false;
return false; return false;
} }
} }
document.onkeydown = function(e) {
//快捷键ctrl+上图片放大
if (38 == e.keyCode && e.ctrlKey) {
PDFViewerApplication.zoomIn()
}
//快捷键ctrl+下图片缩小
if (40 == e.keyCode && e.ctrlKey) {
PDFViewerApplication.zoomOut()
}
//快捷键ctrl+←图片顺时针旋转
if (37 == e.keyCode && e.ctrlKey){
PDFViewerApplication.rotatePages(90);
}
//快捷键ctrl+右图片逆时针旋转
if (39 == e.keyCode && e.ctrlKey){
PDFViewerApplication.rotatePages(-90);
}
//快捷键Tab键启用手型选取
if (9 == e.keyCode){
HandTool.toggle()
}
}
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* Copyright 2012 Mozilla Foundation /* Copyright 2012 Mozilla Foundation
@ -8035,5 +8071,3 @@ if (!PDFJS.workerSrc && typeof document !== 'undefined') {
return pdfjsSrc && pdfjsSrc.replace(/\.js$/i, '.worker.js'); return pdfjsSrc && pdfjsSrc.replace(/\.js$/i, '.worker.js');
})(); })();
} }

@ -26,7 +26,7 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<link rel="stylesheet" href="viewer.css"/> <link rel="stylesheet" href="viewer.css"/>
<link rel="stylesheet" href="../../../static/bootstrap-3.3.7/bower_components/font-awesome/css/font-awesome.min.css"/>
<script src="compatibility.js"></script> <script src="compatibility.js"></script>
@ -38,9 +38,6 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<script type="text/javascript" src="../../bootstrap-3.3.7/bower_components/bootstrap/dist/js/bootstrap.min.js"></script> <script type="text/javascript" src="../../bootstrap-3.3.7/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="l10n.js"></script> <script src="l10n.js"></script>
<script src="../build/pdf.js"></script> <script src="../build/pdf.js"></script>
<script src="debugger.js"></script> <script src="debugger.js"></script>
<script src="viewer.js"></script> <script src="viewer.js"></script>
@ -63,6 +60,32 @@ http://sourceforge.net/adobe/cmap/wiki/License/
border-radius: 20px; border-radius: 20px;
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=70); filter: progid:DXImageTransform.Microsoft.Alpha(opacity=70);
} }
.fullScreamBtn{
visibility: hidden;
opacity: 0;
width: 150px;
height: 30px;
border-radius: 5px;
background: #898989;
position: fixed;
bottom: 2px;
left: calc(100vw / 2 - 75px);
z-index: 999;
transition: all 0.5s;
}
.fullScreamBtn i{
line-height: 30px;
color: white;
margin-right: 8px;
cursor: pointer;
}
.fullScreamBtn i:first-child{
margin-left: 11px;
}
.page:hover~.fullScreamBtn,.fullScreamBtn:hover{
visibility: visible;
opacity: 1;
}
</style> </style>
</head> </head>
@ -442,49 +465,5 @@ http://sourceforge.net/adobe/cmap/wiki/License/
</div> </div>
</body> </body>
<script>
$("#loading").css("background","url(../../img/load.gif) no-repeat 10px 50%");
var interval = setInterval('loadPdf()', 1000);
function loadPdf() {
if (PDFViewerApplication.pdfDocument == null) {
$('#myModal').modal('show');
} else {
clearInterval(interval);
$('#myModal').remove();
}
}
//屏蔽鼠标右键
document.oncontextmenu = function(e) {
var e = e || window.event;
e.returnValue = false;
return false;
}
//禁止快捷键打印
function disabledPrint(){
if(event.keyCode==80 && event.ctrlKey){
event.keyCode=0;
event.returnValue=false;
}
if (event.ctrlKey && event.keyCode == 83) {
event.preventDefault();
event.returnValue = false;
return false;
}
}
/*$(function() {
//PDFFindBar.prototype.open(); //optional if you want to show the search bar
var keys = ['人','心','人心'];
for (var i = 0; i < keys.length; i++) {
var event = document.createEvent('CustomEvent');
event.initCustomEvent('find' + 'again', true, true, {
query: keys[i],
highlightAll: true,
findPrevious: false
});
window.dispatchEvent(event);
}
//return window.dispatchEvent(event);
})*/
</script>
</html> </html>

@ -1839,6 +1839,36 @@ var SecondaryToolbar = {
// Event handling functions. // Event handling functions.
presentationModeClick: function secondaryToolbarPresentationModeClick(evt) { presentationModeClick: function secondaryToolbarPresentationModeClick(evt) {
PDFViewerApplication.requestPresentationMode(); PDFViewerApplication.requestPresentationMode();
$("#viewer").append("<div id='fullScreamBtn' class='fullScreamBtn'><i class='fa fa-search-plus fa-lg' id='plus' title='放大(快捷键ctrl+↑)'></i><i class='fa fa-search-minus fa-lg' id='minus' title='缩小(快捷键ctrl+↓)'></i><i class='fa fa-lg fa-undo' id='undo' title='逆时针旋转(快捷键ctrl+→)'></i><i class='fa fa-repeat fa-lg' id='repeat' title='顺时针旋转(快捷键ctrl+←)'></i><i class='fa fa-hand-paper-o fa-lg' id='hand-paper' title='启用手形工具(键盘按下Tab键)'></i></div>")
//阻止外层div鼠标点击冒泡事件
document.getElementById("fullScreamBtn").addEventListener("mousedown", function (evt) {
evt.stopPropagation();
}, false);
//图片放大
document.getElementById("plus").addEventListener("click",
function () {
PDFViewerApplication.zoomIn();
},false);
//图片缩小
document.getElementById("minus").addEventListener("click",
function () {
PDFViewerApplication.zoomOut();
},false);
//顺时针旋转
document.getElementById("repeat").addEventListener("click",
function () {
PDFViewerApplication.rotatePages(90);
},false);
//逆时针旋转
document.getElementById("undo").addEventListener("click",
function () {
PDFViewerApplication.rotatePages(-90);
},false);
//启用手型选取
document.getElementById("hand-paper").addEventListener("click",
function () {
HandTool.toggle();
},false);
this.close(); this.close();
}, },
@ -7328,7 +7358,7 @@ function handleMouseWheel(evt) {
var direction = (ticks < 0) ? 'zoomOut' : 'zoomIn'; var direction = (ticks < 0) ? 'zoomOut' : 'zoomIn';
if (PDFViewerApplication.pdfViewer.isInPresentationMode) { if (PDFViewerApplication.pdfViewer.isInPresentationMode) {
evt.preventDefault(); //evt.preventDefault();
PDFViewerApplication.scrollPresentationMode(ticks * PDFViewerApplication.scrollPresentationMode(ticks *
MOUSE_WHEEL_DELTA_FACTOR); MOUSE_WHEEL_DELTA_FACTOR);
} else if (evt.ctrlKey || evt.metaKey) { } else if (evt.ctrlKey || evt.metaKey) {

@ -26,6 +26,7 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<link rel="stylesheet" href="viewer.css"/> <link rel="stylesheet" href="viewer.css"/>
<link rel="stylesheet" href="../../../static/bootstrap-3.3.7/bower_components/font-awesome/css/font-awesome.min.css"/>
<script src="compatibility.js"></script> <script src="compatibility.js"></script>
@ -37,12 +38,13 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<script type="text/javascript" src="../../js/jquery-3.3.1.js"></script> <script type="text/javascript" src="../../js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../bootstrap-3.3.7/bower_components/bootstrap/dist/js/bootstrap.min.js"></script> <script type="text/javascript" src="../../bootstrap-3.3.7/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="l10n.js"></script> <script src="l10n.js"></script>
<script src="../build/pdf.js"></script>
<script src="debugger.js"></script> <script src="debugger.js"></script>
<script src="viewer1.js"></script> <script src="viewer1.js"></script>
<script src="../build/pdf.js"></script>
<style> <style>
.loading { .loading {
@ -63,6 +65,32 @@ http://sourceforge.net/adobe/cmap/wiki/License/
border-radius: 20px; border-radius: 20px;
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=70); filter: progid:DXImageTransform.Microsoft.Alpha(opacity=70);
} }
.fullScreamBtn{
visibility: hidden;
opacity: 0;
width: 150px;
height: 30px;
border-radius: 5px;
background: #898989;
position: fixed;
bottom: 2px;
left: calc(100vw / 2 - 75px);
z-index: 999;
transition: all 0.5s;
}
.fullScreamBtn i{
line-height: 30px;
color: white;
margin-right: 8px;
cursor: pointer;
}
.fullScreamBtn i:first-child{
margin-left: 11px;
}
.page:hover~.fullScreamBtn,.fullScreamBtn:hover{
visibility: visible;
opacity: 1;
}
</style> </style>
</head> </head>
@ -440,19 +468,8 @@ http://sourceforge.net/adobe/cmap/wiki/License/
</div> </div>
</div> </div>
</div> </div>
</body> </body>
<script> <script>
$("#loading").css("background","url(../../img/load.gif) no-repeat 10px 50%");
var interval = setInterval('loadPdf()', 1000);
function loadPdf() {
if (PDFViewerApplication.pdfDocument == null) {
$('#myModal').modal('show');
} else {
clearInterval(interval);
$('#myModal').remove();
}
}
$(function(){ $(function(){
//获取父页面打印权限显示打印按钮 //获取父页面打印权限显示打印按钮
var print = parent.$("#print").val(); var print = parent.$("#print").val();
@ -460,24 +477,6 @@ http://sourceforge.net/adobe/cmap/wiki/License/
$("#print").show(); $("#print").show();
} }
}) })
//屏蔽鼠标右键
document.oncontextmenu = function(e) {
var e = e || window.event;
e.returnValue = false;
return false;
}
//禁止快捷键打印
function disabledPrint(){
if(event.keyCode==80 && event.ctrlKey){
event.keyCode=0;
event.returnValue=false;
}
if (event.ctrlKey && event.keyCode == 83) {
event.preventDefault();
event.returnValue = false;
return false;
}
}
</script> </script>
</html> </html>

@ -62,7 +62,8 @@ var CustomStyle = (function CustomStyleClosure() {
var prefixes = ['ms', 'Moz', 'Webkit', 'O']; var prefixes = ['ms', 'Moz', 'Webkit', 'O'];
var _cache = {}; var _cache = {};
function CustomStyle() {} function CustomStyle() {
}
CustomStyle.getProp = function get(propName, element) { CustomStyle.getProp = function get(propName, element) {
// check cache only when no element is given // check cache only when no element is given
@ -423,7 +424,6 @@ var ProgressBar = (function ProgressBarClosure() {
})(); })();
var DEFAULT_PREFERENCES = { var DEFAULT_PREFERENCES = {
showPreviousViewOnLoad: true, showPreviousViewOnLoad: true,
defaultZoomValue: '', defaultZoomValue: '',
@ -581,7 +581,6 @@ var Preferences = {
}; };
Preferences._writeToStorage = function (prefObj) { Preferences._writeToStorage = function (prefObj) {
return new Promise(function (resolve) { return new Promise(function (resolve) {
localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj)); localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj));
@ -724,7 +723,6 @@ Preferences._readFromStorage = function (prefObj) {
})(); })();
var DownloadManager = (function DownloadManagerClosure() { var DownloadManager = (function DownloadManagerClosure() {
function download(blobUrl, filename) { function download(blobUrl, filename) {
@ -763,7 +761,8 @@ var DownloadManager = (function DownloadManagerClosure() {
} }
} }
function DownloadManager() {} function DownloadManager() {
}
DownloadManager.prototype = { DownloadManager.prototype = {
downloadUrl: function DownloadManager_downloadUrl(url, filename) { downloadUrl: function DownloadManager_downloadUrl(url, filename) {
@ -809,9 +808,6 @@ var DownloadManager = (function DownloadManagerClosure() {
})(); })();
/** /**
* View History - This is a utility for saving various view parameters for * View History - This is a utility for saving various view parameters for
* recently opened files. * recently opened files.
@ -859,7 +855,6 @@ var ViewHistory = (function ViewHistoryClosure() {
var databaseStr = JSON.stringify(this.database); var databaseStr = JSON.stringify(this.database);
localStorage.setItem('database', databaseStr); localStorage.setItem('database', databaseStr);
resolve(); resolve();
}.bind(this)); }.bind(this));
@ -1191,6 +1186,7 @@ var PDFFindController = (function PDFFindControllerClosure() {
} }
var self = this; var self = this;
function extractPageText(pageIndex) { function extractPageText(pageIndex) {
self.pdfViewer.getPageTextContent(pageIndex).then( self.pdfViewer.getPageTextContent(pageIndex).then(
function textContentResolved(textContent) { function textContentResolved(textContent) {
@ -1211,6 +1207,7 @@ var PDFFindController = (function PDFFindControllerClosure() {
} }
); );
} }
extractPageText(0); extractPageText(0);
}, },
@ -1532,6 +1529,7 @@ var PDFHistory = {
// since 'beforeunload' prevents Firefox from caching the document. // since 'beforeunload' prevents Firefox from caching the document.
window.removeEventListener('beforeunload', pdfHistoryBeforeUnload, false); window.removeEventListener('beforeunload', pdfHistoryBeforeUnload, false);
} }
window.addEventListener('beforeunload', pdfHistoryBeforeUnload, false); window.addEventListener('beforeunload', pdfHistoryBeforeUnload, false);
window.addEventListener('pageshow', function pdfHistoryPageShow(evt) { window.addEventListener('pageshow', function pdfHistoryPageShow(evt) {
@ -1815,8 +1813,10 @@ var SecondaryToolbar = {
{element: this.toggleButton, handler: this.toggle}, {element: this.toggleButton, handler: this.toggle},
// All items within the secondary toolbar // All items within the secondary toolbar
// (except for toggleHandTool, hand_tool.js is responsible for it): // (except for toggleHandTool, hand_tool.js is responsible for it):
{ element: this.presentationModeButton, {
handler: this.presentationModeClick }, element: this.presentationModeButton,
handler: this.presentationModeClick
},
{element: this.openFile, handler: this.openFileClick}, {element: this.openFile, handler: this.openFileClick},
{element: this.print, handler: this.printClick}, {element: this.print, handler: this.printClick},
{element: this.download, handler: this.downloadClick}, {element: this.download, handler: this.downloadClick},
@ -1825,8 +1825,10 @@ var SecondaryToolbar = {
{element: this.lastPage, handler: this.lastPageClick}, {element: this.lastPage, handler: this.lastPageClick},
{element: this.pageRotateCw, handler: this.pageRotateCwClick}, {element: this.pageRotateCw, handler: this.pageRotateCwClick},
{element: this.pageRotateCcw, handler: this.pageRotateCcwClick}, {element: this.pageRotateCcw, handler: this.pageRotateCcwClick},
{ element: this.documentPropertiesButton, {
handler: this.documentPropertiesClick } element: this.documentPropertiesButton,
handler: this.documentPropertiesClick
}
]; ];
for (var item in elements) { for (var item in elements) {
@ -1840,6 +1842,36 @@ var SecondaryToolbar = {
// Event handling functions. // Event handling functions.
presentationModeClick: function secondaryToolbarPresentationModeClick(evt) { presentationModeClick: function secondaryToolbarPresentationModeClick(evt) {
PDFViewerApplication.requestPresentationMode(); PDFViewerApplication.requestPresentationMode();
$("#viewer").append("<div id='fullScreamBtn' class='fullScreamBtn'><i class='fa fa-search-plus fa-lg' id='plus' title='放大(快捷键ctrl+↑)'></i><i class='fa fa-search-minus fa-lg' id='minus' title='缩小(快捷键ctrl+↓)'></i><i class='fa fa-lg fa-undo' id='undo' title='逆时针旋转(快捷键ctrl+→)'></i><i class='fa fa-repeat fa-lg' id='repeat' title='顺时针旋转(快捷键ctrl+←)'></i><i class='fa fa-hand-paper-o fa-lg' id='hand-paper' title='启用手形工具(键盘按下Tab键)'></i></div>")
//阻止外层div鼠标点击冒泡事件
document.getElementById("fullScreamBtn").addEventListener("mousedown", function (evt) {
evt.stopPropagation();
}, false);
//图片放大
document.getElementById("plus").addEventListener("click",
function () {
PDFViewerApplication.zoomIn();
},false);
//图片缩小
document.getElementById("minus").addEventListener("click",
function () {
PDFViewerApplication.zoomOut();
},false);
//顺时针旋转
document.getElementById("repeat").addEventListener("click",
function () {
PDFViewerApplication.rotatePages(90);
},false);
//逆时针旋转
document.getElementById("undo").addEventListener("click",
function () {
PDFViewerApplication.rotatePages(-90);
},false);
//启用手型选取
document.getElementById("hand-paper").addEventListener("click",
function () {
HandTool.toggle();
},false);
this.close(); this.close();
}, },
@ -2357,6 +2389,7 @@ var GrabToPan = (function GrabToPanClosure() {
var overlay = this.overlay = document.createElement('div'); var overlay = this.overlay = document.createElement('div');
overlay.className = 'grab-to-pan-grabbing'; overlay.className = 'grab-to-pan-grabbing';
} }
GrabToPan.prototype = { GrabToPan.prototype = {
/** /**
* Class name of element which can be grabbed * Class name of element which can be grabbed
@ -2560,7 +2593,8 @@ var HandTool = {
if (value) { if (value) {
this.handTool.activate(); this.handTool.activate();
} }
}.bind(this), function rejected(reason) {}); }.bind(this), function rejected(reason) {
});
}.bind(this)); }.bind(this));
window.addEventListener('presentationmodechanged', function (evt) { window.addEventListener('presentationmodechanged', function (evt) {
@ -2624,10 +2658,12 @@ var OverlayManager = {
} else if (this.overlays[name]) { } else if (this.overlays[name]) {
throw new Error('The overlay is already registered.'); throw new Error('The overlay is already registered.');
} }
this.overlays[name] = { element: element, this.overlays[name] = {
element: element,
container: container, container: container,
callerCloseMethod: (callerCloseMethod || null), callerCloseMethod: (callerCloseMethod || null),
canForceClose: (canForceClose || false) }; canForceClose: (canForceClose || false)
};
resolve(); resolve();
}.bind(this)); }.bind(this));
}, },
@ -3528,6 +3564,7 @@ var PDFPageView = (function PDFPageViewClosure() {
// Rendering area // Rendering area
var self = this; var self = this;
function pageViewDrawCallback(error) { function pageViewDrawCallback(error) {
// The renderTask may have been replaced by a new one, so only remove // 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 // the reference to the renderTask if it matches the one that is
@ -3620,8 +3657,7 @@ var PDFPageView = (function PDFPageViewClosure() {
if (this.annotationsLayerFactory) { if (this.annotationsLayerFactory) {
if (!this.annotationLayer) { if (!this.annotationLayer) {
this.annotationLayer = this.annotationsLayerFactory. this.annotationLayer = this.annotationsLayerFactory.createAnnotationsLayerBuilder(div, this.pdfPage);
createAnnotationsLayerBuilder(div, this.pdfPage);
} }
this.annotationLayer.setupAnnotations(this.viewport); this.annotationLayer.setupAnnotations(this.viewport);
} }
@ -4085,7 +4121,9 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
* @constructor * @constructor
* @implements IPDFTextLayerFactory * @implements IPDFTextLayerFactory
*/ */
function DefaultTextLayerFactory() {} function DefaultTextLayerFactory() {
}
DefaultTextLayerFactory.prototype = { DefaultTextLayerFactory.prototype = {
/** /**
* @param {HTMLDivElement} textLayerDiv * @param {HTMLDivElement} textLayerDiv
@ -4125,6 +4163,7 @@ var AnnotationsLayerBuilder = (function AnnotationsLayerBuilderClosure() {
this.div = null; this.div = null;
} }
AnnotationsLayerBuilder.prototype = AnnotationsLayerBuilder.prototype =
/** @lends AnnotationsLayerBuilder.prototype */ { /** @lends AnnotationsLayerBuilder.prototype */ {
@ -4246,7 +4285,9 @@ var AnnotationsLayerBuilder = (function AnnotationsLayerBuilderClosure() {
* @constructor * @constructor
* @implements IPDFAnnotationsLayerFactory * @implements IPDFAnnotationsLayerFactory
*/ */
function DefaultAnnotationsLayerFactory() {} function DefaultAnnotationsLayerFactory() {
}
DefaultAnnotationsLayerFactory.prototype = { DefaultAnnotationsLayerFactory.prototype = {
/** /**
* @param {HTMLDivElement} pageDiv * @param {HTMLDivElement} pageDiv
@ -4966,6 +5007,7 @@ var SimpleLinkService = (function SimpleLinkServiceClosure() {
function SimpleLinkService(pdfViewer) { function SimpleLinkService(pdfViewer) {
this.pdfViewer = pdfViewer; this.pdfViewer = pdfViewer;
} }
SimpleLinkService.prototype = { SimpleLinkService.prototype = {
/** /**
* @returns {number} * @returns {number}
@ -4982,7 +5024,8 @@ var SimpleLinkService = (function SimpleLinkServiceClosure() {
/** /**
* @param dest - The PDF destination object. * @param dest - The PDF destination object.
*/ */
navigateTo: function (dest) {}, navigateTo: function (dest) {
},
/** /**
* @param dest - The PDF destination object. * @param dest - The PDF destination object.
* @returns {string} The hyperlink to the PDF object. * @returns {string} The hyperlink to the PDF object.
@ -5000,11 +5043,13 @@ var SimpleLinkService = (function SimpleLinkServiceClosure() {
/** /**
* @param {string} hash * @param {string} hash
*/ */
setHash: function (hash) {}, setHash: function (hash) {
},
/** /**
* @param {string} action * @param {string} action
*/ */
executeNamedAction: function (action) {}, executeNamedAction: function (action) {
},
}; };
return SimpleLinkService; return SimpleLinkService;
})(); })();
@ -5214,6 +5259,7 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
}); });
var self = this; var self = this;
function thumbnailDrawCallback(error) { function thumbnailDrawCallback(error) {
// The renderTask may have been replaced by a new one, so only remove // 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 // the reference to the renderTask if it matches the one that is
@ -5802,14 +5848,22 @@ var PDFViewerApplication = {
viewer: viewer, viewer: viewer,
pdfThumbnailViewer: this.pdfThumbnailViewer, pdfThumbnailViewer: this.pdfThumbnailViewer,
contextMenuItems: [ contextMenuItems: [
{ element: document.getElementById('contextFirstPage'), {
handler: toolbar.firstPageClick.bind(toolbar) }, element: document.getElementById('contextFirstPage'),
{ element: document.getElementById('contextLastPage'), handler: toolbar.firstPageClick.bind(toolbar)
handler: toolbar.lastPageClick.bind(toolbar) }, },
{ element: document.getElementById('contextPageRotateCw'), {
handler: toolbar.pageRotateCwClick.bind(toolbar) }, element: document.getElementById('contextLastPage'),
{ element: document.getElementById('contextPageRotateCcw'), handler: toolbar.lastPageClick.bind(toolbar)
handler: toolbar.pageRotateCcwClick.bind(toolbar) } },
{
element: document.getElementById('contextPageRotateCw'),
handler: toolbar.pageRotateCwClick.bind(toolbar)
},
{
element: document.getElementById('contextPageRotateCcw'),
handler: toolbar.pageRotateCcwClick.bind(toolbar)
}
] ]
}); });
} }
@ -5864,7 +5918,8 @@ var PDFViewerApplication = {
PDFJS.useOnlyCssZoom = value; PDFJS.useOnlyCssZoom = value;
}) })
// TODO move more preferences and other async stuff here // TODO move more preferences and other async stuff here
]).catch(function (reason) { }); ]).catch(function (reason) {
});
return initializedPromise.then(function () { return initializedPromise.then(function () {
PDFViewerApplication.initialized = true; PDFViewerApplication.initialized = true;
@ -6483,7 +6538,6 @@ var PDFViewerApplication = {
self.metadata = metadata; self.metadata = metadata;
var pdfTitle; var pdfTitle;
if (metadata && metadata.has('dc:title')) { if (metadata && metadata.has('dc:title')) {
var title = metadata.get('dc:title'); var title = metadata.get('dc:title');
@ -6947,8 +7001,7 @@ function webViewerInitialized() {
if (!PDFViewerApplication.supportsFullscreen) { if (!PDFViewerApplication.supportsFullscreen) {
//document.getElementById('presentationMode').classList.add('hidden'); //document.getElementById('presentationMode').classList.add('hidden');
document.getElementById('secondaryPresentationMode'). document.getElementById('secondaryPresentationMode').classList.add('hidden');
classList.add('hidden');
} }
/* if (PDFViewerApplication.supportsIntegratedFind) { /* if (PDFViewerApplication.supportsIntegratedFind) {
@ -7085,8 +7138,7 @@ document.addEventListener('pagerendered', function (e) {
var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex); var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
if (PDFViewerApplication.sidebarOpen) { if (PDFViewerApplication.sidebarOpen) {
var thumbnailView = PDFViewerApplication.pdfThumbnailViewer. var thumbnailView = PDFViewerApplication.pdfThumbnailViewer.getThumbnail(pageIndex);
getThumbnail(pageIndex);
thumbnailView.setImage(pageView); thumbnailView.setImage(pageView);
} }
@ -7211,8 +7263,7 @@ window.addEventListener('change', function webViewerChange(evt) {
// URL does not reflect proper document location - hiding some icons. // URL does not reflect proper document location - hiding some icons.
document.getElementById('viewBookmark').setAttribute('hidden', 'true'); document.getElementById('viewBookmark').setAttribute('hidden', 'true');
document.getElementById('secondaryViewBookmark'). document.getElementById('secondaryViewBookmark').setAttribute('hidden', 'true');
setAttribute('hidden', 'true');
document.getElementById('download').setAttribute('hidden', 'true'); document.getElementById('download').setAttribute('hidden', 'true');
document.getElementById('secondaryDownload').setAttribute('hidden', 'true'); document.getElementById('secondaryDownload').setAttribute('hidden', 'true');
}, true); }, true);
@ -7332,7 +7383,7 @@ function handleMouseWheel(evt) {
var direction = (ticks < 0) ? 'zoomOut' : 'zoomIn'; var direction = (ticks < 0) ? 'zoomOut' : 'zoomIn';
if (PDFViewerApplication.pdfViewer.isInPresentationMode) { if (PDFViewerApplication.pdfViewer.isInPresentationMode) {
evt.preventDefault(); //evt.preventDefault();
PDFViewerApplication.scrollPresentationMode(ticks * PDFViewerApplication.scrollPresentationMode(ticks *
MOUSE_WHEEL_DELTA_FACTOR); MOUSE_WHEEL_DELTA_FACTOR);
} else if (evt.ctrlKey || evt.metaKey) { } else if (evt.ctrlKey || evt.metaKey) {
@ -7609,4 +7660,7 @@ window.addEventListener('afterprint', function afterPrint(evt) {
}); });
})(); })();
function fullScreamBtn() {
PDFViewerApplication.rotatePages(-90);
}

Loading…
Cancel
Save