Convert DWF to PNG or JPG Image in C#

DWF to PNG JPG Image C#

DWF files are based on vectors that can consist of CAD drawings, text, images, etc. You may need to create a thumbnail or preview image of a DWF file. In accordance with that, the article covers how to convert a DWF file to a JPG or PNG image programmatically in C#.

DWF to JPG or PNG Image Converter – C# API Installation

Aspose.CAD for .NET API supports converting DWF and several other file formats. You can easily configure the API by downloading its DLL file from the New Releases section or using the following NuGet command:

PM> Install-Package Aspose.CAD

Convert DWF to JPG Image Programmatically in C#

You can convert a DWF file to a JPG image by following the steps:

  1. Load the input DWF with the Image class.
  2. Initialize an object of CadRasterizationOptions class.
  3. Create an instance of JpegOptions class.
  4. Set the VectorRasterizationOptions and save the output JPG image.

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

Convert DWF to PNG Image Programmatically in C#

You can convert a DWF file to a PNG image with the steps below:

  1. Load the input DWF file using the Image class.
  2. Create an instance of CadRasterizationOptions class.
  3. Create an object of PngOptions type.
  4. Specify the VectorRasterizationOptions and write the output PNG image.

The code snippet below explains how to convert a DWF file to a PNG image programmatically in C#:

Get Free Temporary License

You can evaluate the API features in their full capacity by requesting a free temporary license.

Conclusion

In this article, you have explored how to convert a DWF file to image formats like PNG or JPG. It explains all the steps and code snippets to perform the conversion programmatically in C#. Moreover, please take a look at the documentation for detailed information about the features supported by the API. Please feel free to reach out to us at the forum in case of any queries.

See Also

Convert DWG to DXF Programmatically in C#