How to Print Reports from Silverlight

Published: 25th February 2010
Views: N/A

This question is frequently found in forums, conference and in blogs. It seems like this is one issue which must be answered directly.



A frequent question being asked in the forums of Microsoft Silverlight is how one can print out reports with this application. Before this is answered, we must first determine what Silverlight is.



Microsoft Silverlight is one programmable plug-in found in web browsers which allow media to be played through the internet. The plug-in enables users to listen to audio as well as watch the animations and videos which are found in rich internet applications. To simplify this definition, it is the company's competing application to Adobe Flash Player.



Since Silverlight 2 is not capable of any APIs which are printer specific, it is your responsibility as a developer to determine how you can handle printing. If you will make use of Internet Explorer 7's print button, you will only get a simple portrayal of the page. If you try printing from Safari or Mozilla Firefox, you will receive nothing but just a plain blank page.



In several business applications, printing is one important requirement. This is why the issue must be addressed if you are planning to build an application through Silverlight 2. Because of this, there are some ways printing from this plug-in can be done through the use of HTML Bridge.



Generally, if you are printing in either Silverlight or any web application, there are two key options for the user. One is printing through a server side, the other is printing through the client side.



A common answer for printing business reports is to open the pop-up window which holds a server generated report which is ready for printing. Depending on your preference, the report is capable of being printed in any format such as an XPS or PDF document, plain HTML document or even a Word document. If server side options of reports are implemented, users are not given a limit to what is available from the browser. As such, any technology can be used.



If the user wants to produce an HTML file, he can use the plain ASP.NET. He can also make use of the more advanced printing solutions like the SQL Reporting Services in order to produce PDF documents. The negative thing about using server side report printing however is because the user needs to click separate print buttons from the application in order to open the report. If this is neglected and the print button is clicked, the available HTML code in the browser will be the one which is printed.



Meanwhile, the meaning of being able to print through the client side is that built-in functionalities of a browser are used in order to produce the printing of the report. This is usually the preferred option in printing content centered websites such as newspapers and blogs. This is because the whole HTML is readily available in the web browser.



Since there is a high chance that you would not want to have large headers or navigation elements to be included in the printed, you will need to use a separate CSS style sheet. Making use of this will let the developer modify the look of a page when it is printed. The CSS can be used in order to hide the large graphics, navigation elements and other aspects of a page which you do not want to be included in the printout. This does not add anything to the paper but will only let you waste ink as well as paper space.



Author Bio,



Here you will learn more about Print Reports From Silverlight and Silverlight

Report this article Ask About This Article


Loading...
More to Explore