PageSize

class plutoprint.PageSize(width: float = 0.0, height: float = 0.0)[source]

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

__init__(width: float = 0.0, height: float = 0.0) None[source]

Initializes a new instance of the PageSize class.

Parameters:
  • width – The width of the page in points.

  • height – The height of the page in points.

__getitem__(index: int) float[source]

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

Parameters:

index – The index to access (0 for width, 1 for height).

Returns:

The width if index is 0, the height if index is 1.

Raises:

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

landscape() PageSize[source]

Returns a PageSize instance with width and height swapped if the current orientation is portrait (width < height).

Returns:

A PageSize instance with swapped dimensions if in portrait mode, otherwise the original dimensions.

portrait() PageSize[source]

Returns a PageSize instance with width and height swapped if the current orientation is landscape (width > height).

Returns:

A PageSize instance with swapped dimensions if in landscape mode, otherwise the original dimensions.

width: float = Ellipsis

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

height: float = Ellipsis

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

plutoprint.PAGE_SIZE_NONE: PageSize = Ellipsis

Represents a page size with zero dimensions on all sides.

plutoprint.PAGE_SIZE_LETTER: PageSize = Ellipsis

Represents the Letter page size (8.5 x 11 inches).

Represents the Legal page size (8.5 x 14 inches).

plutoprint.PAGE_SIZE_LEDGER: PageSize = Ellipsis

Represents the Ledger page size (11 x 17 inches).

plutoprint.PAGE_SIZE_A3: PageSize = Ellipsis

Represents the A3 page size (297 x 420 mm).

plutoprint.PAGE_SIZE_A4: PageSize = Ellipsis

Represents the A4 page size (210 x 297 mm).

plutoprint.PAGE_SIZE_A5: PageSize = Ellipsis

Represents the A5 page size (148 x 210 mm).

plutoprint.PAGE_SIZE_B4: PageSize = Ellipsis

Represents the B4 page size (250 x 353 mm).

plutoprint.PAGE_SIZE_B5: PageSize = Ellipsis

Represents the B5 page size (176 x 250 mm).