From time to time we all need to print a document from our .NET programs. Let’s say a simple one page document with some text and image.
So far I know 2 ways to do it:
- Using standard PrintDocument class
- Generate a pdf/doc document using such tool like PdfSharp
First way I don’t like because it takes a lot of time to write all these routines for handling events and standard PrintPreviewDialog is just ugly. Beside that you need to generate and scale 2 different documents on print preview and actual printing.
Second way bothers me because these free components quite often are limited and poorly documented.
What other solutions for printing do you know?
I haven’t seen an elegant printing solution in .NET yet, except for WPF and XPS. In that case, you can just create a UI in Xaml and print it. But XPS isn’t often a viable option. I’ve worked with XSL-FO also (using NFop and later FO.Net – the latter is better because newer and it doesn’t require Visual J#), which works but has a moderately steep learning curve.