getPageSize method

Future<PdfPageSize> getPageSize(
  1. int pageIndex
)

Returns the intrinsic size of a page in PDF user units (points).

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

Throws RangeError if pageIndex is out of range. Throws StateError if close has already been called.

Example

final size = await doc.getPageSize(0);
final px = size.sizeForDpi(150);
final result = await doc.renderPageToBytes(0, px.width.round(), px.height.round());

Implementation

Future<PdfPageSize> getPageSize(int pageIndex) =>
    _impl.getPageSize(pageIndex);