What is the best way to print stuff from c#/.net?
The question is in regard to single pages as well as to reports containing lots of pages.
It would be great to get a list of the most common printing libs containing the main features and gotchas of each of them.
[Update] for standard windows clients (or servers), not for web apps, please.
For reports, I use the RDLC control.
For everything else, I use the inherent printing objects within .NET.
Edit The inherent printing objects are all found in the System.Drawing.Printing namespace. When you use the PrintDialog or the PrintPreviewDialog in a WinForms (or WPF) application, it is to these objects that you’re turning over control.
The fundamental concept is that you’re drawing to the printer. The simplest form of this is:
What’s happening here is that when my object (x) is sent the print command, it raises the ‘PRINT PAGE’ event (which is designed to print 1 page at a time). This event then uses the Graphics attribute of the PrintPageEventArgs to draw the relevant string directly to the print spooler.
Here’s one tutorial, and a quick Google search for ‘.NET printing tutorial’ returns a bit over 200K results.