getPagesWidth method

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

Gets the width of all pages in the document.

Implementation

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