Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Collapse]Build an Application
  [Expand]Choose Application UI
   Data Management Controls
  [Collapse]Printing and Exporting
    How to: Preview XtraGrid Control
    How to: Customize Print Appearances
    How to: Set Paper Format and Add Custom Information to the Report when Printing/Exporting a Control
    Printing Basics
    Printing Options
    Print Appearances
    Export a Control in Various Formats (PDF, HTML, BMP, etc.) Using the XtraPrinting Library
  [Expand]WinForms MVVM
  [Expand]Skins
  [Expand]Localization
  [Expand]Right-to-Left Layout
   Redistribution and Deployment
 [Expand]Controls and Libraries
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[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

Export a Control in Various Formats (PDF, HTML, BMP, etc.) Using the XtraPrinting Library

The XtraPrinting Library allows you to export DevExpress .NET controls to various document formats (PDF, HTML, MHT, TXT, CSV, XLS, RTF) and image formats (BMP, JPEG, GIF, TIFF, PNG, EMF). This topic demonstrates how to export a control to PDF format with the Print Preview window and via code.

Note

Note that the XtraPrinting Library cannot export certain controls to specific formats. All controls, however, can be exported to PDF or image format.

Expanded Export Using the Print Preview Window

You can use the Print Preview window to export a printable control to an available format.

Use the control's ShowPrintPreview method to display this window. The following image illustrates a Print Preview window for a Grid Control.

A toolbar at the top of the Print Preview form displays the Export Document... button. Click this button to show a drop-down menu that allows you to choose the required export file format.

To add page or report headers to the report, generate a report using printable link. This approach is described in the How to: Set Paper Format and Add Custom Information to the Report when Printing/Exporting a Control topic.

Expanded Export in Code

The following code demonstrates how to export a control to a PDF file in code using XtraPrinting Library methods without the Print Preview window. The control (XtraGrid) is exported to PDF via the PrintingSystemBase.ExportToPdf method. For more information on how to print and export controls, refer to the XtraPrinting Library documentation.

Expanded See Also

How would you rate this topic?​​​​​​​