You can print Diagram documents like VSDX, DWG, VDW, VSTX programmatically using C#. Aspose.Diagram for .NET API can be integrated into your .NET-based applications to work with Microsoft Visio files. Please refer to the following use cases for printing diagram documents:

Visio Document VSD, VSDX, DWG, etc., Printer – C# API Installation

You can print Visio shapes and diagrams in VSD, VSDX, DWG, and many other supported file formats using Aspose.Diagram for .NET. Simply configure the API by downloading the DLL file from the New Releases, or quickly install it from NuGet Package Manager with the following installation command:

PM> Install-Package Aspose.Diagram

Print a Visio Document with XpsPrint Programmatically using C#

XpsPrint class is really helpful for printing Diagram files on a server-side application because using .NET Framework printing classes is not supported by a service. The following steps explain how to print a Visio Document with XpsPrint programmatically with C#:

  1. Use Aspose.Diagram to convert the document to XPS and store it in a memory stream.
  2. Send a Diagram document to a printer using the XpsPrint API.

The following code shows how to print a Visio document by sending it to a printer with XpsPrint API:

Print a Visio Diagram to the Default Printer Programmatically in C#

You can print a Visio Diagram file such as VSDX, DWG, VST, etc. programmatically using C#. Please follow the steps below:

  1. Create an instance of the Diagram class to load a diagram for printing.
  2. Call the Print method without any parameters or arguments.

The code below explains how to print Microsoft Diagram files to default printer programmatically with C#:

Print a Visio Diagram to a Specific Printer Programmatically with C#

You can print a Visio diagram containing different shapes to a specific printer with the below steps:

  1. Load the input diagram file with the Diagram class.
  2. Specify the printer name and Job name and call the Print() method.

The following code elaborates how to print a Diagram file to a specific printer in C#:

Get Free API License

You can request a Free Temporary License to evaluate the API without any limitations.

Conclusion

In this article, you have learned how to print Microsoft Visio Diagrams and shapes in VSDX, VSD, DWG, and other file formats programmatically using C#. You can set different options like default or specific printer or job name, etc. as per your requirements. Furthermore, you can go through the Documentation to explore other features. In case of any concerns, please feel free to contact us at the Free Support Forum.

See Also