You can create a bitmap image representing the current diagram using the CreateImage method. The method returns a Microsoft.Maui.Graphics.IImage instance. The following example shows how to export a diagram to a Png image file :
C# Copy Code |
---|
var image = diagram.CreateImage(); |
The MindFusion.Diagramming.Export Namespace contains classes for exporting to Dxf, Pdf, Svg and Visio formats.
Add a reference to the MindFusion.Diagramming.Export.dll to your project. Create a DxfExporter instance and call its Export method, specifying a Diagram object and a file path as arguments. Raster images can be used in DXF by referencing external image files. To export the images displayed in diagram elements, enable the ExportImages property. If your application supports the multiple-line text DXF entity - MTEXT, use the ExportTextAsMultiline property. The following example shows how to create a DxfExporter instance and export a diagram by calling the Export method passing the Diagram object and an output stream.
C# Copy Code |
---|
var dxfExporter = new MindFusion.Diagramming.Export.DxfExporter(); |
Add references to the MindFusion.Diagramming.Export.dll to your project. Create a PdfExporter instance and call its Export method. Margins specifies the page margins for all pages in the document. If you need to set the page size and orientation, use the PageSize, and PageOrientation properties. The AutoScale property allows scaling the diagram to fit in one or more PDF pages. If invisible items should be displayed in the PDF, enable the InvisibleItems property. The following example shows how to export a diagram to a PDF file:
C# Copy Code |
---|
var pdfExporter = new MindFusion.Diagramming.Export.PdfExporter(); |
Add references to the MindFusion.Diagramming.Export.dll to your project. Create an SvgExporter instance and call its Export method, passing a Diagram object and either a file path or stream as parameters.
C# Copy Code |
---|
var svgExporter = new MindFusion.Diagramming.Export.SvgExporter(); |
Add a reference to the MindFusion.Diagramming.Export.dll to your project. The MindFusion.Diagramming ShapeNode objects are mapped to their closest Visio counterparts and TableNode objects are exported as groups of Visio shapes. MindFusion.Diagramming DiagramLink instances are exported as Visio connectors of a similar style. In addition, most of the attributes of diagram items such as text, text formatting, fill and line colors and styles are preserved.
The exporter object requires the VisioExport.vxt file to be present in the application's directory. This file contains an XML template data used by the component to generate Visio documents.
Create a new instance of the VisioExporter class. Call the Export method passing a Diagram object and the full path to the exported Visio .vdx file as parameters. The Visio page dimension and items size measure unit is set to the diagram's MeasureUnit.
To create Visio groups from the MindFusion.Diagramming groups, enable the CreateVisioGroups property. If a shape node that contains an image should be exported as a Visio group of a shape, picture and text objects, use the ExportImagesAsGroups property set to true by default. ExportInvisibleItems allows exporting of invisible items. If MindFusion.Diagramming TableNode objects should be exported as groups of Visio rectangular shapes, enable the ExportTablesAsGroups property.
The following example shows how to export a diagram to a Visio file in response to choosing a File > Export to > Visio menu item and using the SaveFileDialog control where the location is selected and the name of the Visio file is entered:
C# Copy Code |
---|
var visioExporter = new VisioExporter(); |