diff --git a/browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs b/browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs index 576a7d9e6a70..12a4a43a1b06 100644 --- a/browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs +++ b/browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs @@ -176,6 +176,26 @@ const DEFAULT_ACTIONS = { label: "quickactions-restart", onPick: restartBrowser, }, + savepdf: { + l10nCommands: ["quickactions-cmd-savepdf"], + label: "quickactions-savepdf", + icon: "chrome://global/skin/icons/print.svg", + onPick: () => { + // This writes over the users last used printer which we + // should not do. Refactor to launch the print preview with + // custom settings. + let win = lazy.BrowserWindowTracker.getTopWindow(); + Cc["@mozilla.org/gfx/printsettings-service;1"] + .getService(Ci.nsIPrintSettingsService) + .maybeSaveLastUsedPrinterNameToPrefs( + win.PrintUtils.SAVE_TO_PDF_PRINTER + ); + win.PrintUtils.startPrintWindow( + win.gBrowser.selectedBrowser.browsingContext, + {} + ); + }, + }, screenshot: { l10nCommands: ["quickactions-cmd-screenshot", "quickactions-screenshot3"], label: "quickactions-screenshot3", diff --git a/browser/locales/en-US/browser/browser.ftl b/browser/locales/en-US/browser/browser.ftl index d14be42f0d4e..89dfc2e6f200 100644 --- a/browser/locales/en-US/browser/browser.ftl +++ b/browser/locales/en-US/browser/browser.ftl @@ -295,6 +295,10 @@ quickactions-cmd-plugins = plugins quickactions-print2 = Print page quickactions-cmd-print = print +# Opens the print dialog at the save to PDF option +quickactions-savepdf = Save page as PDF +quickactions-cmd-savepdf = pdf + # Opens a new private browsing window quickactions-private2 = Open private window quickactions-cmd-private = private browsing