Convert DWG to Jpeg2000 in C#

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:

  1. C# DWG to Jpeg2000 Converter – Free Download
  2. Steps to Convert DWG File to Jpeg2000 Document
  3. Convert DWG to Jpeg2000 Programmatically
  4. Export DWG to Jpeg2000 with Options

C# DWG to Jpeg2000 Converter – Free Download

We’ll use the Aspose.CAD for.NET API to convert a DWG file to a Jpeg2000 document. The ability to create, edit, and manipulate DWG files as well as a number of other file types is provided.

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.

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

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:

  1. Use the Image class to load a DWG file as an input first.
  2. Next, make an instance of the class Jpeg2000Options.
  3. 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:

  1. Use the Image class to import a DWG file as an input first.
  2. Next, make a new instance of the class CadRasterizationOptions.
  3. Next, enter the width and height of the page.
  4. After that, make an instance of the class Jpeg2000Options.
  5. Next, choose CadRasterizationOptions for the VectorRasterizationOptions property.
  6. 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.

Conclusion

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.

See Also