using System.IO;
using ImageGear.Formats;
using ImageGear.Formats.CAD;
publicstaticvoid CadToStackedSvg(string inFile, string outFile)
{
ImGearCADPage page = null;
// Load the file.
using (FileStream fileStream = new FileStream(inFile, FileMode.Open, FileAccess.Read))
{
page = (ImGearCADPage)ImGearFileFormats.LoadPage(fileStream);
}
// Save the CAD file to a Stacked SVG file.
page.SaveOptions["StackedSVG"] = true;
using (FileStream fileStream = new FileStream(outFile, FileMode.Create, FileAccess.Write))
{
ImGearFileFormats.SavePage(page, fileStream, ImGearSavingFormats.SVG);
}
}
VB.NET
Copy Code
Imports System.IO
Imports ImageGear.Formats
Imports ImageGear.Formats.CAD
Public Sub CadToStackedSvg(inPath As String, outPath As String)
Dim page As ImGearCADPage
' Load the file.
Using fileStream As New FileStream(inPath, FileMode.Open, FileAccess.Read)
page = ImGearFileFormats.LoadPage(fileStream)
End Using
' Save the CAD file as a Stacked SVG file
page.SaveOptions.Add("StackedSVG", True)
Using fileStream As New FileStream(outPath, FileMode.Create, FileAccess.Write)
ImGearFileFormats.SavePage(page, fileStream, ImGearSavingFormats.SVG)
End Using
End Sub