PdfViewerControl.Print(PdfPrinterSettings, Boolean, Int32) Method
OBSOLETE
Use the Print method instead.
Prints the current document using the specified PDF print settings without invoking the Print dialog.
Namespace: DevExpress.Xpf.PdfViewer
Assembly:
DevExpress.Xpf.PdfViewer.v24.1.dll
NuGet Package:
DevExpress.Wpf.PdfViewer
Declaration
[Obsolete("Use the Print(PdfPrinterSettings printerSettings, bool showPrintStatus = true) overload of this method instead.")]
public virtual void Print(
PdfPrinterSettings printerSettings,
bool showPrintStatus,
int maxPrintingDpi
)
<Obsolete("Use the Print(PdfPrinterSettings printerSettings, bool showPrintStatus = true) overload of this method instead.")>
Public Overridable Sub Print(
printerSettings As PdfPrinterSettings,
showPrintStatus As Boolean,
maxPrintingDpi As Integer
)
Parameters
Name |
Type |
Description |
printerSettings |
PdfPrinterSettings |
A PdfPrinterSettings object, specifying the PDF printing options.
|
showPrintStatus |
Boolean |
true, to show the printing status; otherwise, false.
|
maxPrintingDpi |
Int32 |
An integer value that is the maximum printing DPI.
|
This example shows how to print a document with custom printer settings.
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxpdf="http://schemas.devexpress.com/winfx/2008/xaml/pdf"
x:Class="LoadPDFDocument.MainWindow"
Title="MainWindow" Height="350" Width="525">
<Grid>
<dxpdf:PdfViewerControl x:Name="Viewer" DocumentLoaded="Viewer_DocumentLoaded" />
</Grid>
</Window>
using DevExpress.Pdf;
using System.IO;
using System.Reflection;
using System.Windows;
namespace LoadPDFDocument {
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
Stream stream = GetResourceStream("LoadPDFDocument.Demo.pdf");
Viewer.DocumentSource = stream;
}
static Stream GetResourceStream(string resourceName) {
return Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName);
}
private void Viewer_DocumentLoaded(object sender, RoutedEventArgs e) {
PdfPrinterSettings settings = new PdfPrinterSettings();
settings.PageNumbers = new int[] { 2, 3, 4 };
settings.PageOrientation = PdfPrintPageOrientation.Landscape;
settings.PrintingDpi = 400;
settings.ScaleMode = PdfPrintScaleMode.ActualSize;
Viewer.Print(settings, false, 600);
}
}
}
Imports DevExpress.Pdf
Imports System.IO
Imports System.Reflection
Imports System.Windows
Namespace LoadPDFDocument
Public Partial Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
Dim stream As Stream = GetResourceStream("LoadPDFDocument.Demo.pdf")
Viewer.DocumentSource = stream
End Sub
Private Shared Function GetResourceStream(resourceName As String) As Stream
Return Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)
End Function
Private Sub Viewer_DocumentLoaded(sender As Object, e As RoutedEventArgs)
Dim settings As New PdfPrinterSettings()
settings.PageNumbers = New Integer() {2, 3, 4}
settings.PageOrientation = PdfPrintPageOrientation.Landscape
settings.PrintingDpi = 400
settings.ScaleMode = PdfPrintScaleMode.ActualSize
Viewer.Print(settings, False, 600)
End Sub
End Class
End Namespace
See Also