closePage method

Future<void> closePage({
  1. required int pageIndex,
})

Close an open PDF page with given index. Index is starting with 0. PDF and PDF page must be opened before, by using the open and openPage methods.

Implementation

Future<void> closePage({required int pageIndex}) async {
  if (_id == null) throw StateError('Please open the PDF first!');

  if (!_pages.contains(pageIndex)) throw StateError('PDF page $pageIndex is not open!');

  await PdfImageRenderer.closePdfPage(pdf: _id!, page: pageIndex);

  _pages.remove(pageIndex);
}