DWG to EMF WMF csharp

DWG files are CAD drawings containing 2D or 3D data. In some cases, you may need to create WMF or EMF images to display the file contents in a picture. In accordance with such use cases, this article covers how to convert a DWG file to an EMF or WMF image programmatically in C#.

DWG to EMF or WMF Image Converter – C# API Installation

Aspose.CAD for .NET API supports converting DWG and many other file formats. Simply configure the API by downloading its DLL file from the Downloads section or with the following NuGet installation command:

PM> Install-Package Aspose.CAD

Convert DWG to EMF Image Programmatically in C#

You can convert a DWG file to an EMF image by following the steps below:

  1. Load the source DWG using the Image class.
  2. Create an instance of CadRasterizationOptions class.
  3. Set properties like size of the output image.
  4. Save the output EMF image.

The code snippet below explains how to convert a DWG file to an EMF image in C#:

Convert DWG to WMF Image Programmatically in C#

You can convert a DWG file to a WMF image with the following steps:

  1. Load the input DWG file with the Image class.
  2. Create an instance of CadRasterizationOptions class.
  3. Initialize an object of WmfOptions class.
  4. Save the output WMF image.

The following code snippet shows how to convert a DWG file to a WMF image programmatically in C#:

Get Free Temporary License

You can test all the features of the API without any evaluation limitations by requesting a free temporary license.

Conclusion

In this article, you have learned how to convert a DWG file to an EMF or WMF image. Moreover, you can explore several other features offered by the API by visiting the documentation section. In case of any concerns, please feel free to write to us at the forum.

See Also