Print large diagram

Hi Walter,
I have a large tree, what is the best way to print it / save to document?


The “Print” section of the GoXamIntro.pdf document talks about printing and about the PrintManager, GoXam for WPF 2.2.4.

Thanks for your quick answer,
I have another, more complicated issue,
for example, I want to print the following tree (please notice the “A” rectangle):

to be printed on two pages:

The tree can be very deep.
How should I achieve such functionality?

You’ll need to do your own pagination and break up the graph into multiple independent collections of Nodes and Links, one per page. Each new root would need to get a new “label” TextBlock; it’s placeholder as a “non-leaf” leaf node would need to be replaced by a “Continued on…” node.

Note the in-place print preview support demonstrated in the EntityRelationship Diagram sample in GoWpfDemo. You would need to do additional work to split up the tree into subtrees – one per page.

If you are willing to compromise on the routing of the links to placeholder nodes, you might be able to avoid having to split up the tree into subtrees. If you have seen the in-place “page” rectangles shown in the ER Diagram demo when that option is turned on, you can imagine shifting nodes toward the side and downwards so as to avoid having any node cross a page boundary. If you shifted the nodes, then you would only have to detect all links that crossed page boundaries and added matching labels on each link on each side of the boundary.

Thank you for your advice, I have a logic that seperate the tree to individual sub trees, but is it possible to print each sub-tree without render it to diagram UI?

If you really want to guarantee that users never see what will be printed, then I suggest that you create a second Diagram that is in the visual tree and visible but cannot be seen by the user. You could cover it with something opaque or you could place it outside of the window’s viewport.

Thank you, I understand, but is it possible to stream nodes and links directly to printer/file without showing the nodes on Diagram control? The performance issue is important for me.

No – WPF’s printing architecture depends on rendering FrameworkElements that have been measured and arranged.