PdfPageSize class

The intrinsic size of a PDF page, measured in PDF user units (points).

One PDF user unit equals 1/72 inch. This is a storage-level measurement independent of any rendering resolution. Use sizeForDpi to convert to pixel dimensions at a target DPI for rendering.

Example

final size = await doc.getPageSize(0);
// Convert to pixels at 150 DPI:
final pixelSize = size.sizeForDpi(150);
final image = await doc.renderPageToBytes(
  0,
  pixelSize.width.round(),
  pixelSize.height.round(),
);

Constructors

PdfPageSize({required double widthPt, required double heightPt})
Creates a PdfPageSize with the given widthPt and heightPt in points.
const

Properties

aspectRatio double
The aspect ratio of the page (width / height).
no setter
hashCode int
The hash code for this object.
no setteroverride
heightPt double
The page height in PDF user units (points, 1/72 inch).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
widthPt double
The page width in PDF user units (points, 1/72 inch).
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sizeForDpi(double dpi) → ({double height, double width})
Returns the page size in pixels at the given dpi as a named record.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override