Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.2.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
)

#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.

#Remarks

This example shows how to print a document with custom printer settings.

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);
        }
    }
}
See Also