SvgToDxf 1.0.1

dotnet add package SvgToDxf --version 1.0.1
                    
NuGet\Install-Package SvgToDxf -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SvgToDxf" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SvgToDxf" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="SvgToDxf" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SvgToDxf --version 1.0.1
                    
#r "nuget: SvgToDxf, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SvgToDxf@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SvgToDxf&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=SvgToDxf&version=1.0.1
                    
Install as a Cake Tool

SvgToDxf

A .NET library for converting SVG files to DXF format using native Inkscape dxf_outlines extension.

NuGet License: MIT

Features

  • Convert SVG to DXF format
  • Cross-platform: Linux (glibc/musl), macOS (Intel/Apple Silicon), Windows (x64/ARM64)
  • Self-contained native binaries - no Python or Inkscape installation required
  • Supports .NET 8.0, 9.0, and 10.0
  • Optional logging support via Microsoft.Extensions.Logging

Installation

dotnet add package SvgToDxf

Usage

Basic Usage

using SvgToDxf;

// Create converter
var converter = new SvgToDxfConverter();

// Convert SVG bytes to DXF bytes
byte[] svgBytes = File.ReadAllBytes("input.svg");
byte[] dxfBytes = await converter.ConvertAsync(svgBytes);
File.WriteAllBytes("output.dxf", dxfBytes);

With Options

var options = new DxfConversionOptions
{
    UsePolyline = true,      // Use LWPOLYLINE instead of LINE
    UseLegacyPolyline = false,
    UseRobo = false,
    Units = "mm"             // Output units: mm, cm, in, pt, px
};

byte[] dxfBytes = await converter.ConvertAsync(svgBytes, options);

With Stream Input

using var svgStream = File.OpenRead("input.svg");
byte[] dxfBytes = await converter.ConvertAsync(svgStream);

With Logging

using Microsoft.Extensions.Logging;

var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
var logger = loggerFactory.CreateLogger<SvgToDxfConverter>();

var converter = new SvgToDxfConverter(logger);
byte[] dxfBytes = await converter.ConvertAsync(svgBytes);

With Cancellation

using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
byte[] dxfBytes = await converter.ConvertAsync(svgBytes, cts.Token);

Supported Platforms

Platform Architecture RID
Linux (glibc) x64 linux-x64
Linux (glibc) arm64 linux-arm64
Linux (musl/Alpine) x64 linux-musl-x64
Linux (musl/Alpine) arm64 linux-musl-arm64
macOS Intel osx-x64
macOS Apple Silicon osx-arm64
Windows x64 win-x64
Windows ARM64 win-arm64

Error Handling

try
{
    byte[] dxfBytes = await converter.ConvertAsync(svgBytes);
}
catch (DxfConversionException ex)
{
    Console.WriteLine($"Conversion failed: {ex.Message}");
    Console.WriteLine($"Exit code: {ex.ExitCode}");
    Console.WriteLine($"Error output: {ex.ErrorOutput}");
}

License

MIT License - see LICENSE for details.

Credits

This library uses the dxf_outlines extension from Inkscape Extensions, compiled to native binaries using Nuitka.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 2,409 1/18/2026
1.0.0 88 1/18/2026