RichEditDocumentServer.Print(PrinterSettings) Method
Prints the document with the given printer settings.
Namespace: DevExpress.XtraRichEdit
Assembly: DevExpress.RichEdit.v24.1.Core.dll
NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation
Declaration
Parameters
Name | Type | Description |
---|---|---|
printerSettings | PrinterSettings | A PrinterSettings instance containing printer settings. |
Remarks
Call the Print
method to specify the desired options (define the printer name, the number of copies, the paper size, enable double-sided printing, etc.) to print the document.
Note
PrinterSettings properties, such as PageSettings.Margins or PageSettings.Landscape (accessible by the PrinterSettings.DefaultPageSettings property), do not affect the layout of a printed document. Change the settings of a document section (accessed by the Section.Page property) to modify the document page layout properties before printing.
Warning
The Print(PrinterSettings)
method overload works only on Windows OS. The PlatformNotSupportedException
is thrown on other operating systems. Use the Print
method overloads with DXPrinterSettings printerSettings
parameter to print on other operating systems.
Example
using DevExpress.XtraRichEdit;
using System.Drawing.Printing;
using (var wordProcessor = new RichEditDocumentServer())
{
wordProcessor.LoadDocument("Grimm.docx");
PrinterSettings printerSettings = new PrinterSettings();
// Set the document pages to print:
printerSettings.FromPage = 2;
printerSettings.ToPage = 3;
// Specify the number of copies:
printerSettings.Copies = 2;
// Print the document:
wordProcessor.Print(printerSettings);
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Print(PrinterSettings) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.