renderPage method
Renders the page into a canvas and return image's byte information.
Implementation
Future<Uint8List> renderPage(PdfJsPage page, PdfJsViewport viewport,
int fullWidth, int fullHeight, String documentID) async {
final web.HTMLCanvasElement canvas = web.HTMLCanvasElement();
final _viewport = page.getViewport(_settings);
viewport =
page.getViewport(Settings()..scale = (fullWidth / _viewport.width));
canvas
..width = fullWidth
..height = fullHeight;
final renderSettings = Settings()
..canvasContext = canvas.context2D
..viewport = viewport
..annotationMode = 0;
await (page.render(renderSettings)).promise.toDart;
return canvas.context2D
.getImageData(0, 0, fullWidth.toInt(), fullHeight.toInt())
.data
.toDart
.buffer
.asUint8List();
}