For the creation of 2D or 3D drawings, CAD software require DWG files. In particular, a DWG file may be used to develop and preserve plans for construction projects like roads, bridges, and buildings. In some circumstances, we might need to programmatically export drawings from DWG files to Jpeg2000 documents. These transformations enable the portable sharing of drawings. Learn how to convert a DWG file to a Jpeg2000 in C# in this post..
The following topics shall be covered in this article:
- C# DWG to Jpeg2000 Converter – Free Download
- Steps to Convert DWG File to Jpeg2000 Document
- Convert DWG to Jpeg2000 Programmatically
- Export DWG to Jpeg2000 with Options
C# DWG to Jpeg2000 Converter – Free Download
The Image class of the API is the base class for all types of drawings. The CadImage class represents a DWG image. We can set PageWidth and PageHeight properties using the CadRasterizationOptions class. The Jpeg2000Options class of the API allows specifying the Jpeg2000 options.
PM> Install-Package Aspose.CAD
How to Convert DWG File to Jpeg2000 using C#
We can easily convert a DWG file to a Jpeg2000 document using Aspose.CAD for .NET by following the steps given below:
- Load a DWG drawing file.
- Save DWG as Jpeg2000.
Now, let’s see how to perform these steps in C# to convert a DWG file to a Jpeg2000 document.
Convert DWG to Jpeg2000 Programmatically in C#
Please follow the steps given below to convert a DWG to a Jpeg2000:
- Use the Image class to load a DWG file as an input first.
- Next, make an instance of the class Jpeg2000Options.
- Call the Jpeg2000 Save() method to save it. It accepts two arguments: Jpeg2000Options and the output Jpeg2000 file path.
The following code sample shows how to convert a DWG file to a Jpeg2000 document using C#.
Export DWG to Jpeg2000 with Options in C#
We can specify Jpeg2000 save options while converting a DWG file to a Jpeg2000 document by following the steps given below:
- Use the Image class to import a DWG file as an input first.
- Next, make a new instance of the class CadRasterizationOptions.
- Next, enter the width and height of the page.
- After that, make an instance of the class Jpeg2000Options.
- Next, choose CadRasterizationOptions for the VectorRasterizationOptions property.
- Call the Jpeg2000 Save() function to save it. It accepts two arguments: Jpeg2000Options and the output Jpeg2000 file location.
The following code sample shows how to specify the page height and width while saving a DWG file as a Jpeg2000 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 DWG drawing file;
- specify page height and width;
- define save options;
- save DWG as a Jpeg2000 in C#.
Document sharing is a key part of most organisations’ day-to-day operation, and having the capacity to quickly and easily convert and combine file types ensures you can make secure file transfers without unknowingly creating problems. Besides converting a DWG to a Jpeg2000 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.