I was wondering if there is a way to define the footer of a diagram being printed out. I’m using GoWpf 18.104.22.168.
Default Footer is ‘1,1 (1x1)’.
Thanks a lot for any help.
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!
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.
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.
pManager.ForegroundTemplate = (DataTemplate)this.TryFindResource(“customPrintManagerForegroundTemplate”);
designerSurface.WorkflowDesignerDiagram.PrintManager = pManager;
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 …
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.