docs.rodeo

MDN Web Docs mirror

tabs.saveAsPDF()

{{AddonSidebar}} 

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.

Syntax

let saving = browser.tabs.saveAsPDF(
  pageSettings   // object
)

Parameters

Return value

A Promise that will be fulfilled with a status string when the dialog has closed. The string may be any of:

Examples

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);
  });
});

Browser compatibility

{{Compat}} 

In this article

View on MDN