getPageSize method

Future<Size> getPageSize(
  1. int pageIndex
)

Gets the size of the specified page in the document. This method retrieves the dimensions of a page at the given index. Parameters:

  • pageIndex The index of the page for which the size is requested. example:
Size pageSize = await document.getPageSize(0);

Implementation

Future<Size> getPageSize(int pageIndex) async {
  final result = await _channel.invokeMethod<Map>('get_page_size', {
    'page_index': pageIndex,
  });

  if (result == null || result['width'] == null || result['height'] == null) {
    throw Exception('Invalid page size result');
  }

  return Size(
    (result['width'] as num).toDouble(),
    (result['height'] as num).toDouble(),
  );
}