Skip to content

Commit

Permalink
Bug 1803576 - Add Save page as PDF Quickaction. r=daisuke,fluent-revi…
Browse files Browse the repository at this point in the history
…ewers,kpatenio

Differential Revision: https://phabricator.services.mozilla.com/D193757
  • Loading branch information
daleharvey committed Nov 20, 2023
1 parent 7901299 commit 9de2479
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions browser/locales/en-US/browser/browser.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9de2479

Please sign in to comment.