getPagesHeight method

  1. @override
Future<Int32List?> getPagesHeight(
  1. String documentID
)

Gets the height of all pages in the document.

Implementation

@override
Future<Int32List?> getPagesHeight(String documentID) async {
  int pageCount = _documentRepo[documentID]?.numPages ?? 0;
  Int32List pagesHeight = new Int32List(pageCount);
  for (int pageNumber = 1; pageNumber <= pageCount; pageNumber++) {
    PdfJsPage page = await promiseToFuture<PdfJsPage>(
        _documentRepo[documentID]!.getPage(pageNumber));
    PdfJsViewport viewport = page.getViewport(_settings);
    pagesHeight[pageNumber - 1] = viewport.height.toInt();
  }
  return pagesHeight;
}