ActiveReports 9
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.

To set up PDF printing in the Silverlight Viewer project

  1. Open your Silverlight project or create a new Silverlight project as described in Using the SilverlightViewer.
  2. In Solution Explorer, open the Web.config file.
  3. Make sure that the http handlers have been added to the Web.config file. The http handlers are added to the Web config automatically when you add ActiveReports 9 Web Service - see Using the Silverlight Viewer for details:
    XML code. Handlers appear in the XML view of the Web.config file inside the system.web section.
    Copy Code
    <httpHandlers>
    <add verb="*" path="*.AR9" type="GrapeCity.ActiveReports.Web.Handlers.ReportBinariesStreamer, GrapeCity.ActiveReports.Web.v9, Version=8.0.xxxx.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
    <add verb="*" path="*.AR9Web" type="GrapeCity.ActiveReports.Web.Handlers.WebCacheAccessHandler, GrapeCity.ActiveReports.Web.v9, Version=8.0.xxxx.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
    <add verb="*" path="*.ActiveReport" type="GrapeCity.ActiveReports.Web.Handlers.CompiledReportHandler, GrapeCity.ActiveReports.Web.v9, Version=8.0.xxxx.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
    <add verb="*" path="*.rpx" type="GrapeCity.ActiveReports.Web.Handlers.RpxHandler, GrapeCity.ActiveReports.Web.v9, Version=8.0.xxxx.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
    <add verb="*" path="*.RDL,*.rdlx" type="GrapeCity.ActiveReports.Web.Handlers.RdlxHandler, GrapeCity.ActiveReports.Web.v9, Version=8.0.xxxx.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
    <remove verb="*" path="*.asmx" />
    <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </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.
  4. On MainPage.xaml, go to the Properties window and then to the Events view.
  5. In the list of events, double-click the viewer1_Loaded event.
  6. On MainPage.xaml.cs/vb that opens, add the following code to the viewer1_Loaded event:

    To write code in Visual Basic.NET

    To write code in C#

See Also

Getting Started

 

 


Copyright © 2016 GrapeCity, inc. All rights reserved

Support Forum