Printing and Exporting
- 2 minutes to read
To invoke the standard Print dialog, select Print in the application menu. The Print dialog allows you to select the printer (if required), specify the range of pages to print, the number of copies, etc. To invoke the dialog in code, use the DiagramControl.Print method.
The Quick Print application menu item immediately sends the diagram to the default printer. The corresponding method is DiagramControl.QuickPrint.
The Print Preview application menu item invokes the Print Preview dialog. The corresponding method is DiagramControl.ShowPrintPreview.
The Print Preview dialog allows you to select the printed page size. If you do not modify this setting, the drawing page size specified in the Page Setup Dialog Window is used.
To specify a custom background for printed pages, use the DiagramControl.PrintPageBackgroundTemplate property.
Export
To export a diagram to a file, select Export As in the application menu. This command invokes the Export As dialog where you can specify the output format and file path.
Diagrams can be exported to the following formats: GIF, PNG, BMP, JPG, PDF, SVG.
The following export settings are available:
- DiagramControl.ExportDPI - the resolution (in dpi).
- DiagramControl.ExportMargin - the margin between diagram contents and page bounds.
- DiagramControl.PrintExportMode - allows you to export the diagram contents without padding (boundaries).
- DiagramControl.ExportScale - the scale factor.
You can override these settings in the parameters of the export methods.
Use the DiagramControl.ExportDiagram method to invoke the Export As dialog window. This window allows users to select any available file format.
Use the following methods to export the diagram to a specific format:
DiagramControl.ExportToImage - exports to GIF, PNG, BMP, and JPG formats.
DiagramControl.ExportToSvg - exports to vector (SVG) format.
DiagramControl.ExportToPdf - exports to a single-page PDF file.
DiagramControl.PrintToPdf - exports to a multi-page PDF document.
Print and Export Limitations
The Effect applied to diagram items is not taken into account.
SVG Export Limitations
The following diagram elements cannot be exported to SVG:
- DiagramContentItem
- Elements added by the overridden UIElement.OnRender(DrawingContext) method in custom DiagramItem descendants
- Custom DiagramItem.Template
- DiagramPageBackgroundTemplate and PrintPageBackgroundTemplate
- Custom container collapse buttons