PageSize

Overview

PageSize is a class in Aspose.PDF FOSS for Python.

A page’s width and height in PDF points.

This class declares 11 methods for PageSize objects in Python programs. Available methods include: __eq__, __hash__, __post_init__, as_rect, by_name, from_inches, from_mm, landscape, portrait, rotated, scaled. Public members are accessible to any Python application after installing the Aspose.PDF FOSS for Python package. Properties: height, width.

Properties

NameTypeAccessDescription
widthfloatReadGets the width.
heightfloatReadGets the height.

Methods

SignatureDescription
__post_init__()Calls post_init on this PageSize instance.
from_mm(width: float, height: float) → PageSizeA size given in millimetres, converted to points.
from_inches(width: float, height: float) → PageSizeA size given in inches, converted to points.
by_name(name: str) → PageSizeThe named size name (“A4”, “letter”, “half letter”, …).
landscape() → PageSizeThis size with its longer side across: width >= height.
portrait() → PageSizeThis size with its longer side up: width <= height.
rotated() → PageSizeThis size with the two sides swapped, whichever way round it is.
scaled(factor: float) → PageSizeThis size with both sides multiplied by factor.
__eq__(other: object) → boolTwo sizes are equal when they write the same numbers into a file.
__hash__() → intCalls hash on this PageSize instance.
as_rect(x: float, y: float) → tuple[float, float, float, float]This size as a rectangle (x, y, x + width, y + height).

See Also