ActiveReports 6 Online Help
Provide PDF Printing in the Silverlight Viewer (Pro Edition)

You can provide PDF printing in your Silverlight project, which allows to print 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.

Note: The PDF printing only works for reports that are loaded from a static RDF file (except RDF files saved on the client side) and an RPX handler. As for reports loaded from a document stream (aspx page) and WCF service, the PDFPrint property is ignored.

If PDF printing was set up in the Silverlight project, you will see this Print dialog by clicking Print in the Silverlight Viewer toolbar:

Note: 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 clicking Print in the Silverlight Viewer toolbar.

If your Web browser does not support JavaScript and Acrobat or Adobe Reader, the Silverlight Viewer will use its default printing instead of the pdf printing.

Note: PDF printing is not supported in the Silverlight Out-of-Browser applications.

Set up PDF printing in the Silverlight Viewer project

  1. Open your Silverlight project or create a new Silverlight project as described in Silverlight Viewer (Pro Edition).
  2. In Solution Explorer, open the Web.config file.
  3. Add the following code to the Web.config file:
    XML code. Paste in the XML view of the Web.config file inside the system.web section.
    Copy Code
    <httpHandlers>              
            <add verb="*" path="*.rpx" type="DataDynamics.ActiveReports.Web.Handlers.RpxHandler, ActiveReports.Web, Version=6.2.3118.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
            <add verb="*" path="*.ActiveReport" type="DataDynamics.ActiveReports.Web.Handlers.CompiledReportHandler, ActiveReports.Web, Version=6.2.3118.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
    <add verb="*" path="*.rdf.RdfItem" type="DataDynamics.ActiveReports.Web.Handlers.RdfHandler, ActiveReports.Web, Version=6.2.3118.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff"/> </httpHandlers>

    Note: You should 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:

    Paste to MainPage.xaml.cs to the viewer1_Loaded event

    Copy Code
    viewer1.ViewModel.PdfPrint = true;
    
See Also

Walkthroughs

Getting Started