Printing
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.
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">
<ToolTipService.ToolTip>
<TextBlock Text="Print" />
</ToolTipService.ToolTip>
<Image Source="/Telerik.Windows.Controls.FixedDocumentViewers;component/Images/printer.png" Stretch="None" />
</telerik:RadButton>
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.
PrintSettings settings = new PrintSettings()
{
DocumentName = "My document",
PageMargins = new Thickness(50),
UseDefaultPrinter = true
};
this.pdfViewer.Print(settings);
You can download a runnable project showing how you can customize the printing functionality from our online SDK repository on GitHub.