getTileImage method

Future<Uint8List?> getTileImage(
  1. int pageNumber,
  2. double scale,
  3. double x,
  4. double y,
  5. double width,
  6. double height,
  7. String documentID,
)

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

Implementation

Future<Uint8List?> getTileImage(
  int pageNumber,
  double scale,
  double x,
  double y,
  double width,
  double height,
  String documentID,
) async {
  if (_documentRepo[documentID] != null) {
    PdfJsPage page =
        await (_documentRepo[documentID]!.getPage(pageNumber)).toDart;
    PdfJsViewport viewport = page.getViewport(_settings);
    return _renderPageTile(page, viewport, scale, x, y, width, height);
  }
  return Uint8List.fromList(<int>[0]);
}