Printing Diagram - Footer

Hello all
I was wondering if there is a way to define the footer of a diagram being printed out. I’m using GoWpf 1.2.2.4.
Default Footer is ‘1,1 (1x1)’.
Thanks a lot for any help.
daprodigy23

Sure – just replace the PrintManager.ForegroundTemplate. I suggest you adapt the standard definition which is shown in the GenericWPF.xaml file in the docs subdirectory of the installation.

Read the documentation for PrintManager for more information.

Thanks for your hint!

Is it possible to print parts outside of the printed area of the diagram? I have Scale set to NaN, so the diagram contents are printed to fit a single page. Now, my footer textblocks are printed over some nwoods-parts whichs isn't that cool
I tried a lot, nothing works.
Do you have any suggestions to solve this problem?
Greets,
daprodigy23

I would try setting the PrintManager.Scale explicitly to a value that’s slightly smaller than needed.
You can calculate it by using the Diagram.Panel.DiagramBounds and the Diagram.PrintManager.DocumentPaginator.PageSize.

Thanks for your reply.

The X and Y Value of Diagram.PrintManager.DocumentPaginator.PageSize are both 0 ...
Greets

Sorry about that. That’s because the value of DocumentPaginator.PageSize actually comes from the PrintDialog.PrintableAreaWidth and .PrintableAreaHeight, and you must be looking at it before the PrintDialog has given the user a chance to choose a printer and its page size.

Hi walter.

Thanks for your reply.
No matter what the Scale is, the TextBlocks in the ForegroundTemplate always are printed over the diagram.
Here's what I'm doing:
PrintManager pManager = new PrintManager(); // calculate the scale
double scale_width = diag.PrintableAreaWidth / (designerSurface.WorkflowDesignerDiagram.Panel.DiagramBounds.Width + pManager.Margin.Left + pManager.Margin.Right);
double scale_height = diag.PrintableAreaHeight / (designerSurface.WorkflowDesignerDiagram.Panel.DiagramBounds.Height + pManager.Margin.Top + pManager.Margin.Bottom); // take the smaller one double effective_scale = scale_height < scale_width ? scale_height : scale_width; // take 90% of it --> because custom string in the footer pManager.Scale = 0.9 * effective_scale;

pManager.ForegroundTemplate = (DataTemplate)this.TryFindResource(“customPrintManagerForegroundTemplate”);
designerSurface.WorkflowDesignerDiagram.PrintManager = pManager;

// print
designerSurface.WorkflowDesignerDiagram.PrintManager.Print(diag);

Greets,
daprodigy23

Actually, upon reflection, I don’t understand why you are having this problem, because the normal behavior should be working for you – the default template places the text and the cut-marks outside of the printed diagram area. I think I may have misled you by recommending changing the scale.

If you don’t customize the PrintManager at all, do the page numbers and cut-marks get positioned correctly outside of the diagram contents? If so, then I would expect that to be the case when you do customize the PrintManager.ForegroundTemplate, if you provide a correct replacement DataTemplate. That’s true regardless of how many pages are printed and at what scale the diagram is being rendered.

So I’m wondering if there’s something wrong with your replacement template.

Alternatively, if you have a lot of stuff with which to decorate each page, maybe the problem is with the margins. If so, try increasing the size(s) of the PrintManager.Margin.

oh man …

I think I've found the problem. You were right, the problem was the ForegroundTemplate. I've set the go:SpotPanel.Aligment to Bottom instead of Top.
Thank you very much for your help!
I wish you a nice day.
daprodigy23

Good. So to be clear, you don’t need any code dealing with the PrintManager at all.
The only customization of the PrintManager that you are doing is in setting its ForegroundTemplate.

Yes, clear. I removed all Scale-Customization stuff and switched Aligment from Bottom to Top.

Now it works like a charm.