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
| Name | Type | Access | Description |
|---|---|---|---|
width | float | Read | Gets the width. |
height | float | Read | Gets the height. |
Methods
| Signature | Description |
|---|---|
__post_init__() | Calls post_init on this PageSize instance. |
from_mm(width: float, height: float) → PageSize | A size given in millimetres, converted to points. |
from_inches(width: float, height: float) → PageSize | A size given in inches, converted to points. |
by_name(name: str) → PageSize | The named size name (“A4”, “letter”, “half letter”, …). |
landscape() → PageSize | This size with its longer side across: width >= height. |
portrait() → PageSize | This size with its longer side up: width <= height. |
rotated() → PageSize | This size with the two sides swapped, whichever way round it is. |
scaled(factor: float) → PageSize | This size with both sides multiplied by factor. |
__eq__(other: object) → bool | Two sizes are equal when they write the same numbers into a file. |
__hash__() → int | Calls 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). |