Managing OLE Objects

Exporting Embedded OLE Objects

Aspose.CAD for .NET now supports exporting embedded OLE objects from DWG format. This article demonstrates how you can export embedded OLE objects from DWG format to PNG using Aspose.CAD.

The sample code is given below to achieve this feature.

// The path to the documents directory.
string MyDir = RunExamples.GetDataDir_DWGDrawings();
string[] files = new string[] { "D ZD junior D10m H2m.dwg", "ZD - Senior D6m H2m45.dwg" };
PngOptions pngOptions = new PngOptions { };
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
pngOptions.VectorRasterizationOptions = rasterizationOptions;
rasterizationOptions.Layouts = new string[] { "Layout1" };
foreach (string file in files)
{
using (CadImage cadImage = (CadImage)Image.Load(MyDir + file))
{
cadImage.Save(MyDir + file + "_out.png", pngOptions);
}
}