Printing small graph centered

How do I center a small (or partial) graph on a single paper when printing?

You can set the region of printing by setting the GoView properties:

<span =“Apple-tab-span” style=“white-space:pre”> PrintDocumentTopLeft
<span =“Apple-tab-span” style=“white-space:pre”> PrintDocumentSize

Centering on the page? I don’t think we have an easy way to do that. You might be able to override GoView.PrintDocumentPage (called once per page) and play with PrintPageEventArgs.MarginBounds. But I don’t have a sample of that.

Thanks for the answer.
I’ve tried some various “trix” but so far no result.

An other question related to printing:
When printing a part of the graph (as the graph in the picture) I set the clip region to “cut” parts which should not be printed. This works fine when everything fits on only one paper, all links are cut as they should be at the clip region right margin. When printing a larger part of the graph which will occupy, lets say one and a half paper, the links are not cut but are drawn in their whole length, even the parts which is outside the clip reginon right margin.
Any idea about this?

how are you setting the clip region? (show me the relevant code)

I’m overriding the PaintObjects method as below.
usingPrintArea is a bool which indicates if the user have defined an area of the graph to print.
printAreaRect is a GoRectangle (the orange colored rectangle as in the picture above).

protected override void PaintObjects(bool doc, bool view, Graphics g, RectangleF clipRect)
{
  if (this.IsPrinting && usingPrintArea)
  {
    if (clipRect.Left + clipRect.Width > printAreaRect.Right)
      clipRect.Width = printAreaRect.Right - clipRect.Left;
    if (clipRect.Bottom + clipRect.Height > printAreaRect.Bottom)
      clipRect.Height = printAreaRect.Bottom - clipRect.Top;
  }
  base.PaintObjects(doc, view, g, clipRect);
}
/J

I think you’ll have better luck with the PrintDocumentTopLeft & PrintDocumentSize that I mentioned before. If you use those, you shouldn’t need the override of PaintObjects.

Hi again,
I’m using the PrintDocumentTopLeft and PrintDocumentSize to get needed point and size when printing
a specific part of the graph.
Tried both with and without override of PaintObjects. In fact the one with the override presented a “better” result. In the picture the override version is the picture to the right.
It feels that the non-override version checks if anything on the page is still inside the clipRect the page is printed.

This is not a “big deal” but it would be very nice if it could clip the graph as it does when everything fits on one paper.

You’re right… it looks like there is a problem here. I was able to reproduce that stuff gets clipped at the bottom of the region, but not the right hand side.

On our to-do list.