Fit to Page for printing

Is there a way to fit a diagram to a single page for printing? Even a simple one block diagram at 100% comes out as an 8 page document! The AutoPage property does not seem to do anything and I can't see any other likely candidates among the functions and properties.

I saw that someone asked a similar question 8 years ago and the answer at the time was no, not possible. I am hoping that some improvement has been made to the code or you have a work-around by now.

I found a solution. I used

  atDiagram.Background.Visible := false;
  atDiagram.CopyBitmapToClipboard(esNetto);  // esNetto gets the Whole diagram
  atDiagram.Background.Visible := true;
  with Printer do
    MyRect.Left := Margin;
    MyRect.Top := Margin;
    scale := (Printer.PageWidth - (Margin*2)) / BMP.Width;
    scale :=  min(scale,(Printer.PageHeight - (Margin*2)) / BMP.Height);
    MyRect.Right := trunc(BMP.Width * scale);
    MyRect.Bottom := trunc(BMP.Height * scale);
    Printer.Canvas.StretchDraw(MyRect, BMP);

I tried using

atDiagram.PrintToCanvas(printer.Canvas,1,Margin, Margin,round(Printer.PageWidth - (Margin*2)),round(Printer.PageHeight - (Margin*2)),true);

But that does not print the whole diagram

1 Like

Indeed, that's one fine solution. Just export do bitmap and print the bitmap as a single page.