Convert DGN to JPG in Java Programmatically

In this part, we will walk through a brief overview of Aspose.CAD for Java. In addition, we will also look at how to convert DGN to JPG in Java using this AutoCAD Java API.

This segment will take you to the installation of this Java library.

Here we will develop a DGN file converter by writing a piece of code that will make use of methods and classes exposed by Aspose.CAD for Java.

Similarly, we will see an online tool powered by Aspose.CAD for Java.

A few days ago, we published very useful articles that highlight some of the prominent features exposed by Aspose.CAD for Java. In this guide, we will see how to export DGN file format to a raster image file programmatically. Moreover, we will take you through all the steps needed to build a DGN to JPG converter in Java. So, this guide is a solution if you are looking to convert DGN to JPG in Java. Above all, this AutoCAD Java API is highly secure, robust and efficient for conversion and manipulation processes.

AutoCAD Java API Installation

Please download the JAR file here or follow the Maven configuration mentioned.

autocad java api installation

DGN to JPG Converter - Code Sample

So, you need a source DGN file to implement this feature. Now, follow the steps and a code snippet mentioned below:

  • Load an existing DGN file by invoking the load method.
  • Create an object of JpegOptions class as we are converting the DGN to JPG and assign DgnRasterizationOptions object to it
  • Instantiate an instance of the CadRasterizationOptions class.
  • Set the width of the page by calling the setPageWidth method.
  • The setPageHeight method will set the page height.
  • Enable scaling during export by calling the setNoScaling method.
  • Set a value indicating whether layouts should be automatically scaled by calling the setAutomaticLayoutsScaling method.
  • The setVectorRasterizationOptions method will set the vector rasterization options.
  • Call the save method of the CadImage class to save the JPG file on the disk.


dgn to jpg converter

DGN File Converter - Online Tool

In addition, Aspose.CAD for Java backed an enterprise-level online tool to convert DGN file format to other raster images. Above all, this DGN to JPG file converter is free and you can achieve conversion by dropping your source files in a drag & drop user interface.

dgn file converter

Get a Free License

You can get a free temporary license to try this AutoCAD Java API without evaluation limitations.

Summing up

This is the end of this blog post. Hopefully, you found this blog post a great help in developing a DGN to JPG converter as we have implemented how to convert DGN to JPG in Java programmatically. Further, this lightweight library has a lot more to offer which you can learn by visiting the documentation, API references and GitHub repository. Again, thanks for reading this blog post, we will come again with another article, so stay in touch with

Feel Free to Reach Out

You can let us know about your questions or queries on our forum.

See Also