toPdfRect method

PdfRect toPdfRect(
  1. PdfPage page
)

Converts the bounds to a PDF-space rectangle for a given page.

Implementation

PdfRect toPdfRect(PdfPage page) {
  if (coordinateSystem == PdfCoordinateSystem.pdf && rect != null) {
    return rect!;
  }
  final tl = topLeft;
  if (tl == null) {
    throw StateError('Bounds top-left nao informados.');
  }
  final pageHeight = page.pageFormat.height;
  final bottom = pageHeight - tl.top - tl.height;
  return PdfRect(tl.left, bottom, tl.width, tl.height);
}