W3cubDocs

/Web Extensions

tabs.PageSettings

The type tabs.PageSettings is used to control how a tab is rendered as a PDF by the tabs.saveAsPDF() method.

All its properties are optional.

For setting headers and footers, you can include certain special characters in the strings you supply. These will be replaced in the rendered output as follows:

  • "&P": the page number, like "2"
  • "&PT": the page number and the total number of pages, like "2 of 3"
  • "&D": the current date/time
  • "&T": the page title
  • "&U": the page URL

Type

Values of this type are objects. They contain the following properties:

edgeBottomOptional
number. The spacing between the bottom of the footers and the bottom edge of the paper (inches). Default: 0.
edgeLeftOptional
number. The spacing between the left header/footer and the left edge of the paper (inches). Default: 0.
edgeRightOptional
number. The spacing between the right header/footer and the left edge of the paper (inches). Default: 0.
edgeTopOptional
number. The spacing between the top of the headers and the top edge of the paper (inches). Default: 0
footerCenter Optional
string. The text for the page's center footer. Default: ''.
footerLeft Optional
string. The text for the page's left footer. Default: '&PT'.
footerRight Optional
string. The text for the page's right footer. Default: '&D'.
headerCenter Optional
string. The text for the page's center header. Default: ''.
headerLeft Optional
string. The text for the page's left header. Default: '&T'.
headerRight Optional
string. The text for the page's right header. Default: '&U'.
marginBottomOptional
number. The margin between the page content and the bottom edge of the paper (inches). Default: 0.5.
marginLeftOptional
number. The margin between the page content and the left edge of the paper (inches). Default: 0.5.
marginRightOptional
number. The margin between the page content and the right edge of the paper (inches). Default: 0.5.
marginTopOptional
number. The margin between the page content and the top edge of the paper (inches). Default: 0.5.
orientation Optional
integer. Page orientation: 0 means "portrait", 1 means "landscape". Default: 0.
paperHeightOptional
number. The paper height in paper size units. Default: 11.0.
paperSizeUnit Optional
integer. The paper size unit: 0 = inches, 1 = millimeters. Default: 0.
paperWidth Optional
number. The paper width in paper size units. Default: 8.5.
scaling Optional
number. Page content scaling factor. 1 means 100% or normal size. Default: 1.
showBackgroundColors Optional
boolean. Whether the page background colors should be shown. Default: false.
showBackgroundImages Optional
boolean. Whether the page background images should be shown. Default: false.
shrinkToFit Optional
boolean. Whether the page content should shrink to fit the page width (overrides scaling). Default: true.
toFileName Optional
string. The name of the file the PDF is saved in, with or without the .pdf extension.

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
PageSettings
No
No
56
?
No
No
?
?
No
?
?
?
edgeBottom
No
No
59
?
No
No
?
?
No
?
?
?
edgeLeft
No
No
59
?
No
No
?
?
No
?
?
?
edgeRight
No
No
59
?
No
No
?
?
No
?
?
?
edgeTop
No
No
59
?
No
No
?
?
No
?
?
?
fileName
No
No
75
?
No
No
?
?
No
?
?
?
footerCenter
No
No
56
?
No
No
?
?
No
?
?
?
footerLeft
No
No
56
?
No
No
?
?
No
?
?
?
footerRight
No
No
56
?
No
No
?
?
No
?
?
?
headerCenter
No
No
56
?
No
No
?
?
No
?
?
?
headerLeft
No
No
56
?
No
No
?
?
No
?
?
?
headerRight
No
No
56
?
No
No
?
?
No
?
?
?
marginBottom
No
No
56
?
No
No
?
?
No
?
?
?
marginLeft
No
No
56
?
No
No
?
?
No
?
?
?
marginRight
No
No
56
?
No
No
?
?
No
?
?
?
marginTop
No
No
56
?
No
No
?
?
No
?
?
?
orientation
No
No
56
?
No
No
?
?
No
?
?
?
paperHeight
No
No
56
?
No
No
?
?
No
?
?
?
paperSizeUnit
No
No
56
?
No
No
?
?
No
?
?
?
paperWidth
No
No
56
?
No
No
?
?
No
?
?
?
scaling
No
No
56
?
No
No
?
?
No
?
?
?
showBackgroundColors
No
No
56
?
No
No
?
?
No
?
?
?
showBackgroundImages
No
No
56
?
No
No
?
?
No
?
?
?
shrinkToFit
No
No
56
?
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/PageSettings