clientSize property

Size clientSize

Gets the size of the canvas reduced by margins and page templates.

//Creates a new PDF document.
PdfDocument doc = PdfDocument();
//Create PDF graphics for the page
PdfGraphics graphics = doc.pages.add().graphics;
//Draw rectangle to PDF page graphics.
graphics.drawRectangle(
    brush: PdfBrushes.red,
    //Get the graphics client size.
    bounds: Rect.fromLTWH(
        0, 0, graphics.clientSize.width, graphics.clientSize.height));
//Saves the document.
List<int> bytes = doc.save();
//Dispose the document.
doc.dispose();

Implementation

Size get clientSize =>
    Size(_helper.clipBounds.width, _helper.clipBounds.height);