Convert DGN to DWF or DWFX in C#

DGN files are necessary for CAD software to create 2D or 3D drawings. To produce and save plans for construction projects like roads, bridges, and buildings in particular, use a DGN file. A programmed export of drawings from DGN files to DWF or DWFX documents may be necessary in certain situations. Drawing sharing on the go is made possible by these modifications. This tutorial will teach you how to convert a DGN file to a DWF or DWFX in C#.

The following topics shall be covered in this article:

  1. [C# DGN to DWF or DWFX Converter – Free Download][4]
  2. Steps to Convert DGN File to DWF or DWFX Document
  3. Convert DGN to DWF or DWFX Programmatically
  4. Export DGN to DWF or DWFX with Options

C# DGN to DWF or DWFX Converter – Free Download

The Aspose.CAD for.NET API will be used to transform a DGN file into a document. DGN files, as well as a few other file types, can be created, edited, and worked with.

The base class for all forms of drawings in the API is Image. A DGN picture is represented by the DgnImage class. Using the CadRasterizationOptions class, we may modify the PageWidth and PageHeight attributes. The API’s DwfOptions class provides for the specification of DWF or DWFX parameters.

Please either download the DLL of the API or install it using NuGet.

PM> Install-Package Aspose.CAD

How to Convert DGN File to DWF or DWFX using C#

We can easily convert a DGN file to a DWF or DWFX document using Aspose.CAD for .NET by following the steps given below:

  • Load a DGN drawing file.
  • Save DGN as DWF or DWFX.

Let’s now examine how to carry out these actions in C# to transform a DGN file into a DWF or DWFX document.

Convert DGN to DWF or DWFX Programmatically in C#

Please follow the steps given below to convert a DGN to a DWF or DWFX:

  1. Firstly, load an input DGN file using the Image class.
  2. After that, create an instance of the DwfOptions class.
  3. Finally, call Save() method to save it as a DWF or DWFX. It takes the output DWF or DWFX file path and DwfOptions as arguments.

The following code sample shows how to convert a DGN file to a DWF or DWFX document using C#.

Export DGN to DWF or DWFX with Options in C#

We can specify DWF or DWFX save options while converting a DGN file to a DWF or DWFX document by following the steps given below:

  1. Be using the Image class to load a DGN file as an input first.
  2. Next, make a new instance of the class CadRasterizationOptions.
  3. Then, set the width and height of the page.
  4. Then after, make an instance of the class DwfOptions.
  5. Next, choose CadRasterizationOptions for the VectorRasterizationOptions property.
  6. To save it as a DWF or DWFX, invoke the Save() method in the last step. It accepts DwfOptions and the output DWF or DWFX file path as parameters.

The following code sample shows how to specify the page height and width while saving a DGN file as a DWF or DWFX document using C#.

Get Free Temporary License

You can get a free temporary license to try the library without evaluation limitations.

Conclusion

In this article, we have learned how to:

  • load an existing DGN drawing file;
  • specify page height and width;
  • define save options;
  • save DGN as a DWF or DWFX in C#.

Aspose.CAD for .NET allows developers to convert AutoCAD DWG, DWF, DWT and DXF files to PDF and Raster images. It is a native API and does not require AutoCAD or any software to be installed. You can also convert the selected layers and layouts from the AutoCAD files. Besides converting a DGN to a DWF or DWFX in C#, you can learn more about Aspose.CAD for .NET API using the documentation. In case of any ambiguity, please feel free to contact us on our free support forum.

See Also