Working with Visio files in .NET often means navigating format differences: a legacy .vsd that needs modernizing, a .vsdx that a downstream system expects as .vdx, or a mix of both in a batch pipeline. Aspose.Diagram for .NET addresses this with DiagramConverter — a class in the Aspose.Diagram.LowCode namespace designed for exactly this task.

In this article:

Why DiagramConverter?

The traditional Aspose.Diagram API gives you complete control over every aspect of a diagram, but common conversion tasks don’t need that. DiagramConverter exposes a single Process() method with two overloads: one for simple file path pairs, and one for options objects when you need fine-grained control. That’s it.

Installation

Add Aspose.Diagram to your .NET project:

dotnet add package Aspose.Diagram

Or via Package Manager Console:

Install-Package Aspose.Diagram

Apply your metered license before calling Process():

using Aspose.Diagram;

Metered metered = new Metered();
metered.SetMeteredKey("publicKey", "privateKey");

For on-premise deployments, file-based licensing via License.SetLicense() is also supported.

Simple File Conversion

The simplest usage converts between any two supported Visio formats. The output format is determined by the destination file extension:

using Aspose.Diagram.LowCode;

// Convert VSDX to VDX format
DiagramConverter.Process("input.vsdx", "output.vdx");

// Modernize a legacy VSD file to VSDX
DiagramConverter.Process("legacy.vsd", "modernized.vsdx");

Supported input and output formats include VSDX, VSD, VDX, VSSX, VSTX, VSX, and more. For PDF output, use PdfConverter instead — see Export Visio Diagrams to PDF in .NET.

Advanced Conversion with Options

When you need control over load or save behavior, use LowCodeLoadOptions and LowCodeSaveOptions:

using Aspose.Diagram.LowCode;

var loadOptions = new LowCodeLoadOptions();
loadOptions.InputFile = "source.vsdx";

var saveOptions = new LowCodeSaveOptions();
saveOptions.OutputFile = "output.vdx";

DiagramConverter.Process(loadOptions, saveOptions);

Stream-Based Processing

For in-memory workflows — web APIs, pipeline processing, or cases where you’re not writing to disk — use input and output streams:

using System.IO;
using Aspose.Diagram.LowCode;

var loadOptions = new LowCodeLoadOptions();
using (var inputStream = File.OpenRead("source.vsdx"))
{
    loadOptions.InputStream = inputStream;

    var saveOptions = new LowCodeSaveOptions();
    using (var outputStream = new MemoryStream())
    {
        saveOptions.OutputStream = outputStream;
        DiagramConverter.Process(loadOptions, saveOptions);

        // Use outputStream.ToArray() — e.g., return from a web API
        byte[] converted = outputStream.ToArray();
    }
}

Batch Conversion

Converting a directory of files follows the same pattern with a loop:

using System.IO;
using Aspose.Diagram.LowCode;

string inputDir = "diagrams/input";
string outputDir = "diagrams/output";
Directory.CreateDirectory(outputDir);

foreach (var file in Directory.GetFiles(inputDir, "*.vsdx"))
{
    string output = Path.Combine(outputDir, Path.GetFileNameWithoutExtension(file) + ".vdx");
    DiagramConverter.Process(file, output);
    Console.WriteLine($"Converted: {Path.GetFileName(file)}");
}

Tips for Production Use

  • Apply licensing early. Call SetLicense or SetMeteredKey at application startup, before any diagram operations. Without a valid license, output includes evaluation watermarks.
  • Use try-catch per file in batch jobs. Wrap each Process() call so a single corrupt file doesn’t abort the whole batch.
  • Reuse options objects in loops. Create LowCodeLoadOptions and LowCodeSaveOptions once outside the loop and update only the paths.
  • Use streams for large files. File-based conversion buffers to disk; stream-based processing gives you more control over memory.

What’s Next?

More in this category