openPage method
Open a PDF page with given index.
Index is starting with 0.
PDF must be opened with the open
method before.
Implementation
Future<void> openPage({required int pageIndex}) async {
if (_id == null) throw StateError('Please open the PDF first!');
if (_pages.contains(pageIndex)) return;
if (Platform.isAndroid && _pages.isNotEmpty) {
throw StateError(
'The native Android PDF renderer only allows one open page for each PdfImageRendererPdf instance. Please close the open page first.');
}
await PdfImageRenderer.openPdfPage(pdf: _id!, page: pageIndex);
_pages.add(pageIndex);
}