Skip to main content

Print Rich Text Documents

  • 4 minutes to read

This document outlines the following techniques used to print from RichEditControl.

Use the Default Printer to Print a Document

RichEditControl allows you to print a document with the default settings without end-user interaction. To do that, use the RichEditControl.Print method as shown below:

View Example

static void buttonCustomAction_ItemClick_PrintDocumentMethod(object sender, ItemClickEventArgs e) {
    RichEditControl richEdit = e.Item.Tag as RichEditControl;
    if(richEdit.IsPrintingAvailable) {

Change Print Settings

Call the RichEditControl.Print method with the passed PrinterSettings instance to specify the desired printer options (the range of pages to print, the number of copies, etc.) to print a document.

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: 


The Landscape, Margins, PaperSize properties (accessible by the PrinterSettings.DefaultPageSettings property) do not affect the printed document’s layout. Change a document section settings (accessible by the Section.Page property) to modify the page layout properties before printing.

Use the PrintingOptions class properties to specify additional printing settings (whether to print the comments’ background color or update document variables before printing).

PrintingOptions printOptions = richEditControl1.Options.Printing;
printOptions.EnableCommentBackgroundOnPrint = true;
printOptions.EnablePageBackgroundOnPrint = true;
printOptions.PrintPreviewFormKind = PrintPreviewFormKind.Bars;

All built-in printing commands are available on the File Ribbon tab. To learn how to provide your application with the Ribbon Command UI, refer to the How to: Create the RichEditControl with a Ribbon UI topic.



You can disable printing documents from the User Interface. Set the RichEditBehaviorOptions.Printing property to DocumentCapability.Hidden or DocumentCapability.Disabled to disable or hide the corresponding commands in the Ribbon UI and the pop-up menu.

DevExpress Printing Library

Use the DevExpress Printing Library to set options that are unavailable from RichEditControl directly. This library has the PrintableComponentLinkBase class, which allows you to change required printing settings (e.g., use the specific printer or disable showing error messages). For this, use the API from the table below as shown in the following code snippet.

Member Description
PrintableComponentLink Creates a new PrintableComponentLink instance with a given printing system.
PrintableComponentLinkBase.Component Sets user implementation represented by the IPrintable instance for the current component link.
PrintableComponentLink.PrintingSystem Obtains settings provided by the given PrintingSystem instance.
PrintableComponentLink.Print Prints the current document using the specified printer.
private static void PrintViaLink(IPrintable srv)
    PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem());
    link.Component = srv;
    // Disable warnings.
    link.PrintingSystem.ShowMarginsWarning = false;
    link.PrintingSystem.ShowPrintStatusDialog = false;
    // Find a printer containing Canon in its name
    PrinterSettings settings = new PrinterSettings();
    string printerName = String.Empty;
    for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++) {
        string pName = PrinterSettings.InstalledPrinters[i];
        if (pName.Contains("Canon")) {
            printerName = pName;
    // Print to the specified printer.


The Margins, PageHeaderFooter, PaperKind properties do not affect the printed document’s layout. Change a document section settings (accessible by the Section.Page property) to modify the page layout properties before printing.

See Also