feat: 通过配置控制PDF.js viewer toolbar & secondaryToolbar功能按钮
This commit is contained in:
@ -2089,11 +2089,19 @@ function loadAndEnablePDFBug(enabledTabs) {
|
||||
function webViewerInitialized() {
|
||||
var appConfig = PDFViewerApplication.appConfig;
|
||||
var file;
|
||||
var disablePresentationMode;
|
||||
var disableOpenFile;
|
||||
var disablePrint;
|
||||
var disableDownload;
|
||||
var disableBookmark;
|
||||
var queryString = document.location.search.substring(1);
|
||||
var params = (0, _ui_utils.parseQueryString)(queryString);
|
||||
file = "file" in params ? params.file : _app_options.AppOptions.get("defaultUrl");
|
||||
disablePresentationMode = 'disablepresentationmode' in params ? params.disablepresentationmode : 'false';
|
||||
disableOpenFile = 'disableopenfile' in params ? params.disableopenfile : 'false';
|
||||
disablePrint = 'disableprint' in params ? params.disableprint : 'false';
|
||||
disableDownload = 'disabledownload' in params ? params.disabledownload : 'false';
|
||||
disableBookmark = 'disablebookmark' in params ? params.disablebookmark : 'false';
|
||||
validateFileURL(file);
|
||||
var fileInput = document.createElement("input");
|
||||
fileInput.id = appConfig.openFileInputName;
|
||||
@ -2176,8 +2184,30 @@ function webViewerInitialized() {
|
||||
PDFViewerApplication.error(msg, reason);
|
||||
});
|
||||
}
|
||||
|
||||
if ('true' === disablePresentationMode) {
|
||||
document.getElementById("presentationMode").style.display='none';
|
||||
document.getElementById("secondaryPresentationMode").style.display='none';
|
||||
}
|
||||
|
||||
if ('true' === disableOpenFile) {
|
||||
document.getElementById("openFile").style.display='none';
|
||||
document.getElementById("secondaryOpenFile").style.display='none';
|
||||
}
|
||||
|
||||
if ('true' === disablePrint) {
|
||||
document.getElementById("print").style.display='none';
|
||||
document.getElementById("secondaryPrint").style.display='none';
|
||||
}
|
||||
|
||||
if ('true' === disableDownload) {
|
||||
document.getElementById("download").style.display='none';
|
||||
document.getElementById("secondaryDownload").style.display='none';
|
||||
}
|
||||
|
||||
if ('true' === disableBookmark) {
|
||||
document.getElementById("viewBookmark").style.display='none';
|
||||
document.getElementById("secondaryViewBookmark").style.display='none';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
if (!url.startsWith(baseUrl)) {
|
||||
url = baseUrl + 'getCorsFile?urlPath=' + encodeURIComponent(url);
|
||||
}
|
||||
document.getElementsByTagName('iframe')[0].src = "${baseUrl}pdfjs/web/viewer.html?file=" + encodeURIComponent(url) + "&disabledownload=${pdfDownloadDisable}";
|
||||
document.getElementsByTagName('iframe')[0].src = "${baseUrl}pdfjs/web/viewer.html?file=" + encodeURIComponent(url) + "&disablepresentationmode=${pdfPresentationModeDisable}&disableopenfile=${pdfOpenFileDisable}&disableprint=${pdfPrintDisable}&disabledownload=${pdfDownloadDisable}&disablebookmark=${pdfBookmarkDisable}";
|
||||
document.getElementsByTagName('iframe')[0].height = document.documentElement.clientHeight - 10;
|
||||
/**
|
||||
* 页面变化调整高度
|
||||
|
||||
Reference in New Issue
Block a user