Readme_Printer Delivery Extension Sample

11/05/2008 21:36:06


This sample works only with SQL Server 2005 and SQL Server 2008. It will not work with any version of SQL Server earlier than SQL Server 2005.
The Printer Delivery Sample is a sample delivery extension that offers an introduction to Reporting Services delivery. The sample is a simple delivery extension for a printer. It uses the IMAGE rendering extension, along with the System.Drawing.Printing namespace in the Microsoft .NET Framework, to deliver a report to a printer. This sample is not supported on Itanium-based operating systems.

Important:
Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator..



Requirements

You should be familiar with Visual Studio and Microsoft Visual C#, and your system must meet the following requirements to use the Printer Delivery sample:
  • Microsoft Visual Studio 2005 or compatible environment.
  • Microsoft .NET Framework 2.0.
  • The Reporting Services samples.
  • A report server that you have permission to access on your network, if you plan to use the sample extension to add more data processing functionality to your server.
Important:
SQL Server samples and sample databases must be downloaded and installed before you can view or work with them. For more information, see Considerations for Installing SQL Server Samples and Sample Databases.



Location

By default, this sample is located in the following directory:
C:\Program Files\Microsoft SQL Server\100\Samples\Reporting Services\Extension Samples\PrinterDelivery Sample

Building the Sample

Follow these steps to build the sample.
If you have not already created a strong name key file, generate the key file using the following instructions.
To generate a strong name key file
  1. Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.-- or --Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.
  2. Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed. Note: To determine the folder where samples are located, click the Start* button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.*
  3. At the command prompt, run the following command to generate the key file: sn -k SampleKey.snk Important: For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.
To compile the sample using the .NET Framework SDK
  1. Copy Microsoft.ReportingServices.Interfaces.dll from the report server \bin directory into your sample folder. By default, Microsoft.ReportingServices.Interfaces.dll is located in the \Reporting Services\ReportServer\bin subdirectory for the installed instance of Reporting Services. The exact path may vary on your installation of Reporting Services. For example: * C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportManager\Bin *
  2. Issue the following command to create the sample delivery extension Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll. * csc /t:library /out:Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll *.cs /r:Microsoft.ReportingServices.Interfaces.dll *
To compile the sample using Visual Studio
  1. Open the sample solution file (PrinterDeliveryCS.sln) in Visual Studio.
  2. In Solution Explorer, select the PrinterDelivery project.
  3. On the Project menu, click Add Reference.
  4. On the Add References dialog box, click the .NET tab.
  5. Click Browse and find the Microsoft.ReportingServices.Interfaces.dll file on your local drive. By default, the assembly is located in C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin, then click OK. The selected reference is added to your project. Note: The reference may already be added to your project. If this is the case, you do not have to re-add a reference.
  6. On the Build menu, click Build Solution.

Deploying the Sample

After you have completed the previous steps, Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll can then be deployed to a report server and to Report Manager for use in delivering reports.
To deploy the sample
  1. Copy Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll to the report server. The default location for report server extensions is C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin.
  2. In the RSReportServer.config file, make the following entry under the Delivery element. * <Extension Name="Printer Delivery Sample" Type="Microsoft.Samples.ReportingServices.PrinterDelivery.PrinterDeliveryProvider,Microsoft.Samples.ReportingServices.PrinterDeliverySample">
    <Configuration>
    <Printers>
    <Printer>\\Server\MyNetworkPrinter1</Printer>
    <Printer>\\Server\MyNetworkPrinter2</Printer>
    <Printer>MyLocalPrinter</Printer>
    </Printers>
    </Configuration>
    </Extension> * Note: The Printers* element enables a fixed set of printer names to be available for the delivery extension Printer setting. This list is ultimately checked against the known list of available printers on the report server to which the delivery extension is installed. If a selected printer does not match the known list of installed printers on the report server, the delivery fails with status, "The printer {0} is currently not installed on the server." If the Windows Service account that is used by the report server does not have permission to print to a printer installed in Windows, the printer will not be included in the list of available printers.*
    1. In the RSReportServer.config file, make the following entry under the DeliveryUI element: * <Extension Name="Printer Delivery Sample" Type="Microsoft.Samples.ReportingServices.PrinterDelivery.PrinterDeliveryUIProvider,Microsoft.Samples.ReportingServices.PrinterDeliverySample"/> *
    2. Copy the assembly to Report Manager. The default location for extensions for Report Manager is C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportManager\bin.For more information about deploying delivery extensions, see Deploying a Delivery Extension.
    To configure code access security for the sample
    1. Open the report server policy configuration file (rssrvpolicy.config). The default location for this file is C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer.
    2. Delivery extensions must be granted full trust. To do this, add the following code group information under the <CodeGroup … Zone="MyComputer" /> element: * <CodeGroup class="UnionCodeGroup"
      version="1"
      PermissionSetName="FullTrust"
      Name="PrinterDeliveryCodeGroup"
      Description="Code group for my delivery extension">
      <IMembershipCondition class="UrlMembershipCondition"
      version="1"
      Url="C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll"
      />
      </CodeGroup> *
      1. If you are using the sample printer delivery extension in Report Manager, repeat steps 1 and 2 using the Report Manager policy configuration file (rsmgrpolicy.config) and the following code group: * <CodeGroup class="UnionCodeGroup"
        version="1"
        PermissionSetName="FullTrust"
        Name="PrinterDeliveryCodeGroup"
        Description="Code group for my delivery extension">
        <IMembershipCondition class="UrlMembershipCondition"
        version="1"
        Url="C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportManager\bin\Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll"
        />
        </CodeGroup> *The default location for the rsmgrpolicy.config file is C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportManager.
        1. When you are finished deploying the sample, reset Microsoft Internet Information Services (IIS) using the reset tool Iisreset.exe, and then restart the Reporting Services Windows service.For more information about .NET Framework security and Reporting Services, seeSecure Development (Reporting Services).

        See Also

        Tasks
        Compiling and Running Code Examples Reporting Services Samples
        Other Resources
        Using the RSClientPrint Control in Custom Applications Extension Samples (Reporting Services) Implementing a Delivery Extension RSReportServer Configuration File
        Help and Information
        • Getting SQL Server 2008 Assistance* © 2008 Microsoft Corporation. All rights reserved.

Last edited Aug 17, 2009 at 6:12 AM by leilu, version 11

Comments

No comments yet.