PageMargins

class plutoprint.PageMargins(top: float = 0.0, right: float = 0.0, bottom: float = 0.0, left: float = 0.0)[source]

The PageMargins class represents the margins of a page in points (1 / 72 inch).

__init__(top: float = 0.0, right: float = 0.0, bottom: float = 0.0, left: float = 0.0) None[source]

Initializes a new instance of the PageMargins class.

Parameters:
  • top – The top margin of the page in points.

  • right – The right margin of the page in points.

  • bottom – The bottom margin of the page in points.

  • left – The left margin of the page in points.

__getitem__(index: int) float[source]

Allows access to the margins of the page using an index.

Parameters:

index – The index to access (0 for top, 1 for right, 2 for bottom, 3 for left).

Returns:

The top if index is 0, the right if index is 1, the bottom if index is 2, the left if index is 3.

Raises:

IndexError – If the index is out of range (not 0, 1, 2, or 3).

top: float = Ellipsis

The top margin of the page in points (1 / 72 inch).

right: float = Ellipsis

The right margin of the page in points (1 / 72 inch).

bottom: float = Ellipsis

The bottom margin of the page in points (1 / 72 inch).

left: float = Ellipsis

The left margin of the page in points (1 / 72 inch).

plutoprint.PAGE_MARGINS_NONE: PageMargins = Ellipsis

Represents page margins with zero dimensions on all sides.

plutoprint.PAGE_MARGINS_NORMAL: PageMargins = Ellipsis

Represents normal page margins (72 points or 1 inch on all sides).

  • Top: 72 points (1 inch)

  • Right: 72 points (1 inch)

  • Bottom: 72 points (1 inch)

  • Left: 72 points (1 inch)

plutoprint.PAGE_MARGINS_NARROW: PageMargins = Ellipsis

Represents narrow page margins (36 points or 0.5 inches on all sides).

  • Top: 36 points (0.5 inches)

  • Right: 36 points (0.5 inches)

  • Bottom: 36 points (0.5 inches)

  • Left: 36 points (0.5 inches)

plutoprint.PAGE_MARGINS_MODERATE: PageMargins = Ellipsis

Represents moderate page margins.

  • Top: 72 points (1 inch)

  • Right: 54 points (0.75 inches)

  • Bottom: 72 points (1 inch)

  • Left: 54 points (0.75 inches)

plutoprint.PAGE_MARGINS_WIDE: PageMargins = Ellipsis

Represents wide page margins.

  • Top: 72 points (1 inch)

  • Right: 144 points (2 inches)

  • Bottom: 72 points (1 inch)

  • Left: 144 points (2 inches)