Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
    Supported Formats
   [Expand]Getting Started
   [Expand]RichEditControl Document
   [Expand]Fields
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    AutoCorrect
    Mail Merge
    Restrictions and Protection
    Syntax Highlighting
    Traversing the Document
   [Expand]Visual Elements
    Services
    Events
    Commands
    HTML Tag Support
   [Expand]Examples
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Printing

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

Expanded Commands

DXRichEdit provides the following built-in commands for printing documents.

Command Description
PrintCommand Invokes the Print dialog to print the current document.
QuickPrintCommand Prints the current document using the default printer. The command is executed without user intervention.
PrintPreviewCommand Displays the Print Preview window for the current document.

All built-in commands are available on the File ribbon tab. To learn how to provide an application with the Ribbon Command UI, check the Lesson 5 - Create Separate Ribbon Pages for a Rich Text Editor topic.

Expanded DevExpress Printing Library

To specify additional printing settings, use the DevExpress Printing Library and the RichEditDocumentServer instance. The API from the table below allows you to accomplish this task as shown in the following code example.

Member Description
RichEditDocumentServer.RichEditDocumentServer Initializes a new instance of the class with the default settings.
LegacyPrintableComponentLink.LegacyPrintableComponentLink Initializes a new instance of the LegacyPrintableComponentLink class with the specified settings.
LinkBase.CreateDocument Creates a document from the link, so it can be displayed or printed. Optionally, the document pages can be generated progressively and accessed as soon as they are created. Document creation is always synchronous and does not occur in a background thread.
LinkBase.PrintingSystem Gets the Printing System used to create and print a document for this link.
LinkBase.PrintDirect Prints the current document to a default printer.

Important

Such LegacyPrintableComponentLink properties as LinkBase.Landscape or LinkBase.PaperKind do not affect the layout of a printed document. To change the document page layout properties before printing, change the corresponding settings of the document section (can be accessed by the Section.Page property).

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T494735.

Expanded XpfRichEditPrinter class descendant

To use the FixedDocument instance in your custom printing logic, use the DevExpress.XtraRichEdit.Printing.XpfRichEditPrinter class. Declare a class descendant and implement the methods according to your current needs.
The code snippet below shows how to use this class to set a printer directly from code without showing the printer dialog.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E3842.

Is this topic helpful?​​​​​​​