Saves the current page as a PDF file. This will open a dialog, supplied by the underlying operating system, asking the user where they want to save the PDF file.
This is an asynchronous function that returns a Promise
.
var saving = browser.tabs.saveAsPDF( pageSettings // object )
pageSettings
object
. Settings for the saved page, as a tabs.PageSettings
object. This object must be given, but all its properties are optional. Any properties not specified here will get the default values listed in the PageSettings
documentation.A Promise
that will be fulfilled with a status string when the dialog has closed. The string may be any of:
In this example a background script listens for a click on a browser action, then tries to save the currently active tab as a PDF file, then logs the result:
browser.browserAction.onClicked.addListener(() => { browser.tabs.saveAsPDF({}) .then((status) => { console.log(status); }); });
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
saveAsPDF |
No |
No |
81
56-81
This function does not work on macOS.
|
? |
No |
No |
? |
? |
No |
? |
? |
? |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/saveAsPDF