customPainter property

PdfLinkCustomPagePainter? customPainter
final

Custom link painter for the page.

The custom painter completely overrides the default link painter. The following fragment is an example to draw a red rectangle on the link area:

customPainter: (canvas, pageRect, page, links) {
  final paint = Paint()
    ..color = Colors.red.withOpacity(0.2)
    ..style = PaintingStyle.fill;
  for (final link in links) {
    final rect = link.rect.toRectInPageRect(page: page, pageRect: pageRect);
    canvas.drawRect(rect, paint);
  }
}

Implementation

final PdfLinkCustomPagePainter? customPainter;