BSA – Printing – Part 4

WPF have a very simple way of printing what they call a “Visual”, basically it print what you see on the screen, so to use this you need a UserControl. I loadet the diagram below and tested the PrintVisual statement.

I have a Brother DCP-9015 color laser that also has it’s own preview system and the result from “PrintVisual” on a diagram can be seen below. Basically it prints the screen as is and just drops the parts I did not request. I probably canĀ  change that a bit and adjust background as well as scale it – not sure. But, I was happy to find that I hade a preview in the printer system to avoid too much paper usage as I test.

The more interesting function is “PrintDocument” that can print either a FixedDocument or a FlowDocument – actual tutorials and documentation on printing is a bit thin, so I will need to experiment a bit to learn the API. I want to start with paper printing because I like to make class diagrams and put them on the wall in front of me as I work. PrintVisual might just do the work if I can create copies in the background (not visual) and print them – we will see. The result is not exactly there yet, but this was a single line of code.

Categories: BSA

Leave a Reply