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:
- [C# DGN to DWF or DWFX Converter – Free Download]
- Steps to Convert DGN File to DWF or DWFX Document
- Convert DGN to DWF or DWFX Programmatically
- Export DGN to DWF or DWFX with Options
C# DGN to DWF or DWFX Converter – Free Download
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.
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:
- Firstly, load an input DGN file using the Image class.
- After that, create an instance of the DwfOptions class.
- 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:
- Be using the Image class to load a DGN file as an input first.
- Next, make a new instance of the class CadRasterizationOptions.
- Then, set the width and height of the page.
- Then after, make an instance of the class DwfOptions.
- Next, choose CadRasterizationOptions for the VectorRasterizationOptions property.
- 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.
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.