close method
Closes the PDF.
Must be opened with the open method before.
Implementation
Future<void> close() async {
if (_id == null) throw StateError('PDF is not open!');
// Close all open PDF pages.
final pages = [..._pages];
for (final page in pages) {
await closePage(pageIndex: page);
}
await PdfImageRenderer.closePdf(pdf: _id!);
_id = null;
_pages.clear();
_pageCount = null;
_pageSizes.clear();
}