Skip to content

Commit

Permalink
Close #4484 Disable open, print, save handlers of pdf viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Yu committed Dec 12, 2024
1 parent cf028df commit 5969df1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion dev/editviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
.replace('''setRotation(this.initialRotation);''', '''// setRotation(this.initialRotation);''') \
.replace('''this.pdfLinkService.setHash(this.initialBookmark);''', '''// this.pdfLinkService.setHash(this.initialBookmark);''') \
.replace('''hPadding = vPadding = 0;''', '''if (this._scrollMode === ScrollMode.HORIZONTAL || this._spreadMode === SpreadMode.NONE) { hPadding = vPadding = 0; } else { hPadding = 10; vPadding = 0; }''') \
# .replace('''parent.document.dispatchEvent(event);''', '''parent.document.dispatchEvent(event); \n document.dispatchEvent(event);''')
.replace('''eventBus._on("openfile"''', '''// eventBus._on("openfile"''') \
.replace('''eventBus._on("print"''', '''// eventBus._on("print"''') \
.replace('''eventBus._on("download"''', '''// eventBus._on("download"''')
fout.write(line)

os.system(f'git diff --no-index {args.web}/viewer.html {args.viewer}/viewer.html > {args.viewer}/../dev/viewer/viewer.html.diff')
Expand Down
6 changes: 3 additions & 3 deletions viewer/viewer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14251,8 +14251,8 @@ const PDFViewerApplication = {
eventBus._on("presentationmodechanged", evt => pdfViewer.presentationModeState = evt.state, opts);
eventBus._on("presentationmode", this.requestPresentationMode.bind(this), opts);
eventBus._on("switchannotationeditormode", evt => pdfViewer.annotationEditorMode = evt, opts);
eventBus._on("print", this.triggerPrinting.bind(this), opts);
eventBus._on("download", this.downloadOrSave.bind(this), opts);
// eventBus._on("print", this.triggerPrinting.bind(this), opts);
// eventBus._on("download", this.downloadOrSave.bind(this), opts);
eventBus._on("firstpage", () => this.page = 1, opts);
eventBus._on("lastpage", () => this.page = this.pagesCount, opts);
eventBus._on("nextpage", () => pdfViewer.nextPage(), opts);
Expand All @@ -14275,7 +14275,7 @@ const PDFViewerApplication = {
eventBus._on("updatefindmatchescount", onUpdateFindMatchesCount.bind(this), opts);
eventBus._on("updatefindcontrolstate", onUpdateFindControlState.bind(this), opts);
eventBus._on("fileinputchange", onFileInputChange.bind(this), opts);
eventBus._on("openfile", onOpenFile.bind(this), opts);
// eventBus._on("openfile", onOpenFile.bind(this), opts);
},
bindWindowEvents() {
if (this._windowAbortController) {
Expand Down

0 comments on commit 5969df1

Please sign in to comment.