Skip to main content
A newer version of this page is available. .

How to: Print a Document

The RichEditDocumentServer component allows you to print the document with the default settings or specify printing options.

Important

The Print method works only on Windows OS. The PlatformNotSupportedException is thrown on other operating systems.

Call the RichEditDocumentServer.Print method to print a document to the default system printer, as shown in the code snippet below:

server.LoadDocument("Grimm.docx");
server.Print();

Pass the PrinterSettings instance as the method’s printerSettings parameter to specify the printer settings (the page range, the number of copies, etc. ), as shown below:

Dim printerSettings As 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:
server.Print(printerSettings)

Note

PrinterSettings properties, such as PageSettings.Margins or PageSettings.Landscape (accessed using the PrinterSettings.DefaultPageSettings property), do not affect a printed document’s layout. Change a document section’s settings (accessed using the Section.Page property) to modify the document page’s layout properties before printing.