PdfViewerPagePaintCallback typedef

PdfViewerPagePaintCallback = void Function(Canvas canvas, Rect pageRect, PdfPage page)

Function to paint things on page.

canvas is the canvas to paint on. pageRect is the rectangle of the page in the viewer. page is the page.

If you have some PdfRect that describes something on the page, you can use PdfRect.toRect to convert it to Rect and draw the rect on the canvas:

PdfRect pdfRect = ...;
canvas.drawRect(
  pdfRect.toRectInPageRect(page: page, pageRect: pageRect),
  Paint()..color = Colors.red);

Implementation

typedef PdfViewerPagePaintCallback = void Function(
    ui.Canvas canvas, Rect pageRect, PdfPage page);