RadPdfViewer allows printing of the document shown in it. The following article describes the available printing methods, as well as how to use the respective for the feature API.

Using UI

RadPdfViewer's sample UI allows you to print the currently shown PDF document with a simple button click. Rad Pdf Viewer Printing 03

The button shown in the above picture is actually bound to the PrintPdfDocumentCommand with the help of the PrintCommandDescriptor, so you can modify the UI to fit your needs.

      <telerik:RadButton Command="{Binding PrintCommandDescriptor.Command}" Visibility="{Binding PrintCommandDescriptor.IsEnabled, Converter={StaticResource BoolToVisibilityConverter}}" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="2" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsBackgroundVisible="False"> 
          <TextBlock Text="Print" /> 
        <Image Source="/Telerik.Windows.Controls.FixedDocumentViewers;component/Images/printer.png" Stretch="None" /> 

More about command descriptors you can find here.

Printing Programmatically

Additionally, to using the UI, you can print by taking advantage of the Print() and Print(PrintSettings printSettings) methods of RadPdfViewer.

The PrintSettings class holds all possible customization options when invoking printing:

  • DocumentName: Specifies the name of the document.

  • PageMargins: Specifies the page margin of the document.

  • UseDefaultPrinter: Forces silent printing to the default printer. Can only be used in OOB application with elevated trust.

  • ForceVector: Forces vector printing in Silverlight 5. Its default value is true. If set to false, tries to execute vector printing and in case it fails the "old" bitmap printing is executed.

  • OpacityThreshold: Gets or sets the opacity value of visual elements at which Silverlight 5 will round the opacity to 1.0 to support vector printing on PostScript printers or drivers.

    PrintSettings settings = new PrintSettings() 
        DocumentName = "My document", 
        PageMargins = new Thickness(50), 
        ForceVector = true, 
        OpacityThreshold = 0.5 

See Also

In this article