ARTICLE

Printing in Silverlight

Posted by Diptimaya Patra Articles | Silverlight with C# June 22, 2010
In this article we will see how to print documents and controls in Silverlight 4.
Reader Level:
Download Files:
 

Introduction

In this article we will see how the Print API can be used in Silverlight 4.

Create Silverlight Application

Fire up Visual Studio 20102010 and create a Silverlight Application and name the solution as PrintAPISample.

1.gif
 
Let's have some control's that would signify the printing.

2.gif 

As you see in the above image, we have a Tab control and it consits of two Items, which contains an image each. Then we have a Hyperlink "Print Page", which will print when we click on it.

Let's write the code for printing.

We need the following Namespace to use the Printing classes.

3.gif

4.gif
 
Now let's run the application and click to Print Page.

5.gif 

When we click on print the Print Dialog box would open.

Unfortunately the Printer driver is not supported in Windows 7 and I haven't updated so let's print it as a PDF file.

6.gif 

And when the print is completed the file would look like following.

7.gif 


Hope this article helps.

Recommended Readings

erver'>
COMMENT USING