この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!
この記事を English (US) で読むこともできます。

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

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

Parameters

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.

Return value

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

  • "saved"
  • "replaced"
  • "canceled"
  • "not_saved"
  • "not_replaced"

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

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
saveAsPDFChrome No support NoEdge No support NoFirefox Full support 56
Notes
Full support 56
Notes
Notes This function does not work on macOS.
Opera No support NoFirefox Android No support No

Legend

Full support  
Full support
No support  
No support
See implementation notes.
See implementation notes.

ドキュメントのタグと貢献者

このページの貢献者: mdnwebdocs-bot, irenesmith, fscholz, wbamberg
最終更新者: mdnwebdocs-bot,