|
Article relates to
|
Telerik Reporting v2
|
|
Created by
|
Steve, Telerik
|
|
Last modified
|
October 29, 2008
|
|
Last modified by
|
October 29, 2008
|
| To convert code |
Telerik online converter
|
|
HOW-TO
Print a report straight to printer
DESCRIPTION
The ability to print a report is widely used feature that a Reporting product cannot go without. The ReportViewers we provide for viewing the reports, come with a Print button that takes care of this automatically. However in case one might want to be in control over the printing - use the exposed methods.
SOLUTION
Printing from a
web application and
win application is different.
Web ReportViewer
To print a report through the Web ReportViewer you need to
use the built-in print functionality. It depends on the Adobe
Acrobat Reader PDF plugin (you need it installed to take advantage
of true print and not the browsers' printing capabilities) and you
have all the options to select a printer from a list.
On the
client side you can invoke the print through the ReportViewer client
object's PrintReport() method like in the code snipped below:
| <form id="form1" runat="server"> |
| <telerik:ReportViewer runat="server" id="ReportViewer1"></telerik:ReportViewer> |
| <script type="text/javascript"> |
| <%=ReportViewer1.ClientID %>.PrintReport(); |
| </script> |
| </form> |
This
is the only possible thing you can do on the client side - there is no way to list the available printers, etc.
Win ReportViewer
To print a report through the Win ReportViewer you need to use the ReportProcessor.PrintReport() method. It accepts two parameters - the report to print and the PrinterSettings that should be used:
The most common printer setting is
PrinterName, which specifies the printer to print to.
To learn more about PrinterSettings class please refer to this topic.
For your convenience, we've attached a sample application using both approaches.
Please
Sign In
to rate this article.