PdfViewerControl.Print(PdfPrinterSettings, Boolean) Method

Prints a document using the specified PDF print settings without invoking the Print dialog.

Namespace: DevExpress.Xpf.PdfViewer

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


public virtual void Print(
    PdfPrinterSettings printerSettings,
    bool showPrintStatus = true


Name Type Description
printerSettings PdfPrinterSettings

A PdfPrinterSettings value, specifying the PDF printing options.

Optional Parameters

Name Type Default Description
showPrintStatus Boolean


true, to show the printing status; otherwise, false.


View Example: https://github.com/DevExpress-Examples/how-to-use-pdf-printer-settings

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

using System.Drawing.Printing;
using System.Windows;
using DevExpress.Pdf;

namespace SpecifyPrinterSettings {
    public partial class MainWindow : Window {
        public MainWindow() {

            // Load a PDF document.

        private void pdfViewer_DocumentLoaded(object sender, RoutedEventArgs e) {
            // If required, declare and specify the system printer settings.
            PrinterSettings printerSettings = new PrinterSettings();
            printerSettings.PrinterName = "Microsoft XPS Document Writer";
            printerSettings.PrintToFile = true;
            printerSettings.PrintFileName = @"..\..\Demo.xps";

            // Declare the PDF printer settings.
            // If required, pass the system settings to the PDF printer settings constructor.
            PdfPrinterSettings pdfPrinterSettings = new PdfPrinterSettings(printerSettings);

            // Specify the PDF printer settings.
            pdfPrinterSettings.PageOrientation = PdfPrintPageOrientation.Auto;
            pdfPrinterSettings.PageNumbers = new int[] { 1, 3, 4, 5 };
            pdfPrinterSettings.ScaleMode = PdfPrintScaleMode.CustomScale;
            pdfPrinterSettings.Scale = 90;

            // Print the document using the specified printer settings and show print status parameter.            
            pdfViewer.Print(pdfPrinterSettings, true);
See Also