Back to Devexpress

PdfViewerControl.ShowPrintPageSetupDialog() Method

wpf-devexpress-dot-xpf-dot-pdfviewer-dot-pdfviewercontrol-f2e770fc.md

latest2.6 KB
Original Source

PdfViewerControl.ShowPrintPageSetupDialog() Method

Opens the Page Setup dialog.

Namespace : DevExpress.Xpf.PdfViewer

Assembly : DevExpress.Xpf.PdfViewer.v25.2.dll

NuGet Package : DevExpress.Wpf.PdfViewer

Declaration

csharp
public PdfPrinterSettings ShowPrintPageSetupDialog()
vb
Public Function ShowPrintPageSetupDialog As PdfPrinterSettings

Returns

TypeDescription
PdfPrinterSettings

An object that contains printer settings selected in the Page Setup dialog.

|

Exceptions

TypeDescription
InvalidOperationException

Occurs if the ShowPrintPageSetupDialog method is called before any window is displayed.

|

Remarks

If a user clicks Cancel or closed the Page Setup dialog, the ShowPrintPageSetupDialog method returns null.

The code sample below shows how to obtain printer settings selected in the Page Setup dialog:

csharp
using System.Windows;
using DevExpress.Pdf;
using DevExpress.Xpf.PdfViewer;

private void Button_Click(object sender, RoutedEventArgs e)
{
    PdfViewerControl pdfViewer = new PdfViewerControl();
    pdfViewer.AsyncDocumentLoad = false;
    pdfViewer.OpenDocument("Demo.pdf");

    PdfPrinterSettings printerSettings = pdfViewer.ShowPrintPageSetupDialog();
    if (printerSettings != null)
    {
        // add your code here
    }
}
vb
Imports System.Windows
Imports DevExpress.Pdf
Imports DevExpress.Xpf.PdfViewer

Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim pdfViewer As New PdfViewerControl()
    pdfViewer.AsyncDocumentLoad = False
    pdfViewer.OpenDocument("Demo.pdf")

    Dim printerSettings As PdfPrinterSettings = pdfViewer.ShowPrintPageSetupDialog()
    If printerSettings IsNot Nothing Then
      ' add your code here
    End If
End Sub

See Also

PdfViewerControl Class

PdfViewerControl Members

DevExpress.Xpf.PdfViewer Namespace