.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

PdfDocumentProcessor.Print(PdfPrinterSettings) Method

Prints the document with custom printer settings.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v21.1.dll

Declaration

public void Print(
    PdfPrinterSettings printerSettings
)

Parameters

Name Type Description
printerSettings PdfPrinterSettings

An object providing printer settings.

Remarks

Use the PdfPrinterSettings object to specify custom printer settings (orientation, scale, dpi, etc.). Use the PdfPrinterSettings.Settings property to access .NET print options.

Important

The Print method uses GDI/GDI+ rendering and works only on Windows OS. The PlatformNotSupportedException is thrown on other operating systems.

Example

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

// Developer Express Code Central Example:
// How to use the PDF printer settings

using DevExpress.Pdf;

namespace PdfProcessorPrinterOptions
{
    class Program
    {

        static void Main(string[] args)
        {
            // Create a Pdf Document Processor instance and load a PDF into it.
            PdfDocumentProcessor documentProcessor = new PdfDocumentProcessor();
            documentProcessor.LoadDocument(@"..\..\Demo.pdf");

            // Declare the PDF printer settings.
            PdfPrinterSettings pdfPrinterSettings = new PdfPrinterSettings();

            // Specify the PDF printer settings.
            pdfPrinterSettings.PageOrientation = PdfPrintPageOrientation.Portrait;
            pdfPrinterSettings.PageNumbers = new int[] { 1, 3, 4, 5 };

            // Specify the custom scale number
            pdfPrinterSettings.ScaleMode = PdfPrintScaleMode.CustomScale;
            pdfPrinterSettings.Scale = 90;

            //Specify .NET printer settings
            PrinterSettings settings = printerSettings.Settings;
            settings.Duplex = Duplex.Vertical;
            settings.Copies = 3;


            // Print the document using the specified printer settings.
            documentProcessor.Print(pdfPrinterSettings);
        }
    }
}
See Also