ActiveReports 9 > ActiveReports User Guide > How To > Provide PDF Printing in the Silverlight Viewer (Pro Edition) |
You can set PDF printing in your Silverlight project to allow printing a document from Silverlight to the PDF format directly. This is a good alternative to the default Silverlight printing with its large print spool size issue.
If PDF printing is set up in the Silverlight project, you see a Print dialog appear on clicking the Print button in the SilverlightViewer toolbar:
When you print to PDF, the exceptions that occur at printing cannot be caught. Thus, if there is a printing exception, no Print dialog appears after you click the Print button.
Caution: If your Web browser does not support JavaScript and Adobe Reader, the Silverlight Viewer will use its default printing instead of the PDF printing. Also, PDF printing is not supported in the Silverlight Out-of-Browser applications. |
XML code. Handlers appear in the XML view of the Web.config file inside the system.web section. |
Copy Code
|
---|---|
<httpHandlers> |
Note: You might need to update the Version and PublicKeyToken values to reflect the current version of ActiveReports installed on your machine. You can find the Version and PublicKeyToken values in the Global Assembly Cache (GAC), C:\Windows\assembly. |
To write code in Visual Basic.NET
Visual Basic.NET Code. Paste to MainPage.xaml.vb to the Viewer1_Loaded event. |
Copy Code
|
---|---|
Viewer1.PdfPrint = True |
To write code in C#
C# Code. Paste to MainPage.xaml.cs to the viewer1_Loaded event. |
Copy Code
|
---|---|
viewer1.PdfPrint = true; |