fix: 移除pdf.js中打开文件、打印、下载按钮

This commit is contained in:
zyd
2022-09-21 00:40:35 +08:00
parent b015299253
commit f8e77e9e9d
2 changed files with 25 additions and 4 deletions
+13 -1
View File
@@ -199,7 +199,6 @@ See https://github.com/adobe-type-tools/cmap-resources
<script src="compatibility.js"></script>
<script src="l10n.js"></script>
<script src="../build/pdf.js"></script>
<script src="viewer.js"></script>
</head>
@@ -343,6 +342,18 @@ See https://github.com/adobe-type-tools/cmap-resources
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button>
<button id="secondaryOpenFile" class="secondaryToolbarButton visibleLargeView" title="Open File" tabindex="52" data-l10n-id="open_file">
<span data-l10n-id="open_file_label">Open</span>
</button>
<button id="secondaryPrint" class="secondaryToolbarButton visibleMediumView" title="Print" tabindex="53" data-l10n-id="print">
<span data-l10n-id="print_label">Print</span>
</button>
<button id="secondaryDownload" class="secondaryToolbarButton visibleMediumView" title="Download" tabindex="54" data-l10n-id="download">
<span data-l10n-id="download_label">Download</span>
</button>
<a href="#" id="secondaryViewBookmark" class="secondaryToolbarButton visibleSmallView" title="Current view (copy or open in new window)" tabindex="55" data-l10n-id="bookmark">
<span data-l10n-id="bookmark_label">Current View</span>
</a>
@@ -657,6 +668,7 @@ See https://github.com/adobe-type-tools/cmap-resources
}
}
</script>
<input type="file" id="fileInput" class="hidden">
</body>
</html>
+12 -3
View File
@@ -3145,9 +3145,9 @@ const PDFViewerApplication = {
eventBus._on("switchannotationeditorparams", webViewerSwitchAnnotationEditorParams);
eventBus._on("print", webViewerPrint);
// eventBus._on("print", webViewerPrint);
eventBus._on("download", webViewerDownload);
// eventBus._on("download", webViewerDownload);
eventBus._on("firstpage", webViewerFirstPage);
@@ -3199,7 +3199,7 @@ const PDFViewerApplication = {
eventBus._on("fileinputchange", webViewerFileInputChange);
eventBus._on("openfile", webViewerOpenFile);
// eventBus._on("openfile", webViewerOpenFile);
},
bindWindowEvents() {
@@ -3494,6 +3494,15 @@ function webViewerInitialized() {
appConfig,
eventBus
} = PDFViewerApplication;
appConfig.toolbar.openFile.hidden = true;
appConfig.secondaryToolbar.openFileButton.hidden = true;
appConfig.toolbar.print.hidden = true;
appConfig.secondaryToolbar.printButton.hidden = true;
appConfig.toolbar.download.hidden = true;
appConfig.secondaryToolbar.downloadButton.hidden = true;
appConfig.toolbar.viewBookmark.hidden = true;
appConfig.secondaryToolbar.viewBookmarkButton.hidden = true;
let file;
const queryString = document.location.search.substring(1);
const params = (0, _ui_utils.parseQueryString)(queryString);