selenium.webdriver.common.print_page_options

Classes

PrintOptions()

class selenium.webdriver.common.print_page_options.PrintOptions[source]
page_height

Gets and Sets page_height:

Usage:
  • Get: self.page_height

  • Set: self.page_height = value

Args:

value: float value for page height.

Returns:
  • Get: Optional[float]

  • Set: None

page_width

Gets and Sets page_width:

Usage:
  • Get: self.page_width

  • Set: self.page_width = value

Args:

value: float value for page width.

Returns:
  • Get: Optional[float]

  • Set: None

margin_top

Gets and Sets margin_top:

Usage:
  • Get: self.margin_top

  • Set: self.margin_top = value

Args:

value: float value for top margin.

Returns:
  • Get: Optional[float]

  • Set: None

margin_bottom

Gets and Sets margin_bottom:

Usage:
  • Get: self.margin_bottom

  • Set: self.margin_bottom = value

Args:

value: float value for bottom margin.

Returns:
  • Get: Optional[float]

  • Set: None

margin_left

Gets and Sets margin_left:

Usage:
  • Get: self.margin_left

  • Set: self.margin_left = value

Args:

value: float value for left margin.

Returns:
  • Get: Optional[float]

  • Set: None

margin_right

Gets and Sets margin_right:

Usage:
  • Get: self.margin_right

  • Set: self.margin_right = value

Args:

value: float value for right margin.

Returns:
  • Get: Optional[float]

  • Set: None

scale

Gets and Sets scale:

Usage:
  • Get: self.scale

  • Set: self.scale = value

Args:

value: float value for scale (between 0.1 and 2).

Returns:
  • Get: Optional[float]

  • Set: None

orientation

Gets and Sets orientation:

Usage:
  • Get: self.orientation

  • Set: self.orientation = value

Args:

value: Orientation value (“portrait” or “landscape”).

Returns:
  • Get: Optional[Orientation]

  • Set: None

background

Gets and Sets background:

Usage:
  • Get: self.background

  • Set: self.background = value

Args:

value: bool value for background printing.

Returns:
  • Get: Optional[bool]

  • Set: None

shrink_to_fit

Gets and Sets shrink_to_fit:

Usage:
  • Get: self.shrink_to_fit

  • Set: self.shrink_to_fit = value

Args:

value: bool value for shrink to fit.

Returns:
  • Get: Optional[bool]

  • Set: None

page_ranges

Gets and Sets page_ranges:

Usage:
  • Get: self.page_ranges

  • Set: self.page_ranges = value

Args:

value: list of page range strings.

Returns:
  • Get: Optional[List[str]]

  • Set: None

A4 = {'height': 29.7, 'width': 21.0}
LEGAL = {'height': 35.56, 'width': 21.59}
LETTER = {'height': 27.94, 'width': 21.59}
TABLOID = {'height': 43.18, 'width': 27.94}
to_dict() dict[str, Any][source]

Returns a hash of print options configured.

set_page_size(page_size: dict) None[source]

Sets the page size to predefined or custom dimensions.

Args:
page_size: A dictionary containing ‘height’ and ‘width’ keys with

respective values in cm.

Example:

self.set_page_size(PageSize.A4) # A4 predefined size self.set_page_size({“height”: 15.0, “width”: 20.0}) # Custom size