getImage method

  1. @override
Future<Uint8List> getImage(
  1. int pageNumber,
  2. double scale,
  3. String documentID
)

Gets the image's bytes information of the specified page.

Implementation

@override
Future<Uint8List> getImage(
    int pageNumber, double scale, String documentID) async {
  if (_documentRepo[documentID] != null) {
    PdfJsPage page = await promiseToFuture<PdfJsPage>(
        _documentRepo[documentID]!.getPage(pageNumber));
    PdfJsViewport viewport = page.getViewport(_settings);
    return renderPage(page, viewport, scale, documentID);
  }
  return Uint8List.fromList(<int>[0]);
}