getPageCount method
Returns the number of pages of the PDF.
PDF must be opened with the open
method before.
Implementation
Future<int> getPageCount() async {
if (_id == null) throw StateError('Please open the PDF first!');
// Check page count cache.
if (_pageCount != null) return _pageCount!;
_pageCount = await PdfImageRenderer.getPDFPageCount(pdf: _id!);
return _pageCount!;
}