Fix PDF file printing
This commit is contained in:
parent
17deb16779
commit
3c08604770
3 changed files with 25 additions and 2 deletions
|
@ -161,6 +161,28 @@ class ReaderInstance {
|
|||
|
||||
await this._waitForReader();
|
||||
|
||||
// A custom print function to work around Zotero 7 printing issues
|
||||
this._iframeWindow.wrappedJSObject.zoteroPrint = async () => {
|
||||
let win = Zotero.getMainWindow();
|
||||
if (win) {
|
||||
let { PrintUtils } = win;
|
||||
let settings = PrintUtils.getPrintSettings("", false);
|
||||
let doPrint = await PrintUtils.handleSystemPrintDialog(
|
||||
this._iframeWindow.browsingContext.topChromeWindow, false, settings
|
||||
);
|
||||
if (doPrint) {
|
||||
this._iframeWindow.browsingContext.print(settings);
|
||||
// An ugly hack to close the browser window that has a static clone
|
||||
// of the content that is being printed. Without this, the window
|
||||
// will be open while transferring the content into system print queue,
|
||||
// which can take time for large PDF files
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
if (win?.document?.getElementById('statuspanel')) {
|
||||
win.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
this._internalReader = this._iframeWindow.wrappedJSObject.createReader(Components.utils.cloneInto({
|
||||
|
|
|
@ -74,7 +74,8 @@
|
|||
if (Zotero.isMac) {
|
||||
Services.scriptloader.loadSubScript("chrome://global/content/macWindowMenu.js", this);
|
||||
}
|
||||
|
||||
Services.scriptloader.loadSubScript("chrome://global/content/printUtils.js", this);
|
||||
|
||||
// Custom elements
|
||||
Services.scriptloader.loadSubScript("chrome://zotero/content/customElements.js", this);
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit a2b7548a84e267f7d50e05b3103ef430bc8f27d1
|
||||
Subproject commit 0b1731ff35078cbea1dd67458d72dc5890d9b385
|
Loading…
Add table
Reference in a new issue