[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Collapse]Map Control
   [Expand]Getting Started
   [Expand]Coordinate Systems
   [Expand]Map Image Data
   [Expand]GIS Data
   [Expand]Vector Data
   [Expand]Visual Elements
   [Collapse]End-User Features
     Search Panel
     Map Editor
     Mini Map
     Printing and Exporting
   [Expand]Product Information
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
 [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]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Printing and Exporting

The Map control allows you to print and export a map and its vector layer items to multiple formats.

Make sure that your project references the DevExpress.XtraPrinting.18.2 and DevExpress.Printing.v18.2.Core assemblies to be capable to perform the following tasks.

Expanded Immediately Print a Map

To immediately print the Map control's content without invoking any print dialogs, use the MapControl.Print method.

Expanded Print a Map Using the Standard Print Dialog

You can show the standard print dialog before map printing as the following image demonstrates.

To show the default print dialog before printing, use the MapControl.ShowPrintDialog method.

Expanded Print/Export a Map Using the Print Preview

To show the Print Preview dialog with a toolbox or with a Ribbon, use one of the following methods.

MapControl.ShowPrintPreview Invokes the Print Preview with a toolbox.
MapControl.ShowRibbonPrintPreview Invokes the Print Preview with a Ribbon.

The code below shows how to invoke the Ribbon Print Preview.

To immediately print a map using the Print Preview, select the Quick Print item.

To invoke the standard print dialog before printing, select the Print item in the Print Preview.

To export a map using the Print Preview dialog, select the desired file format in the Export item's drop-down list.

Expanded Export a Map from Code

All the map data can be exported to numerous file formats. For this, use the appropriate method from the table below.

MapControl.ExportToImage Exports a map to an image.
MapControl.ExportToPdf Exports a map to a PDF file.
MapControl.ExportToMht Exports a map to an MHT file.
MapControl.ExportToRtf Exports a map to an RTF file.
MapControl.ExportToXls Exports a map to an XLS file.
MapControl.ExportToXlsx Exports a map to an XLSX file.

The following code shows how to export a map to the specified PDF file.

In addition, you can export a map vector layer's content to one of the supported formats using the following methods.

MapItemsLayerBase.ExportToKml Exports data from a vector layer using the KML file format.
MapItemsLayerBase.ExportToSvg Exports data from a vector layer using the SVG file format.
MapItemsLayerBase.ExportToShp Exports vector layer data to the specified shapefile.

Use the following code to export map vector data to the specified KML file.

Expanded Configure Print/Export Option

To configure printing/exporting options, you can use the following code example.

The code above uses the following API members.

MapControl.PrintOptions Provides access to map print/export options.
PrintOptions.PrintMiniMap Specifies a value indicating whether to print/export a mini map.
PrintOptions.PrintNavigationPanel Specifies a value indicating whether to print/export a navigation panel.
PrintOptions.PrintOverlays Specifies a value indicating whether to print/export map overlays.
PrintOptions.SizeMode Specifies a map size mode. To set this property, use the MapPrintSizeMode enumeration items.

Expanded See Also

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