DWG files contain vector image data and metadata written with binary coding and are widely used for designing purposes. In particular scenarios, you may want to convert DWG to image format. Considering such requirements, this article covers how to convert a DWG file to an EMF or WMF image programmatically in Java.
- DWG to EMF or WMF Image Converter – Java API Installation
- Convert DWG to EMF Image Programmatically in Java
- Convert DWG to WMF Image Programmatically in Java
DWG to EMF or WMF Image Converter – Java API Installation
Aspose.CAD for Java API is a standalone solution to create, edit, or manipulate CAD drawings without needing to configure any CAD application. You can easily configure the API by downloading its JAR file from the Downloads section or with the following Maven configurations:
<repositories> <repository> <id>AsposeJavaAPI</id> <name>Aspose Java API</name> <url>http://repository.aspose.com/repo/</url> </repository> </repositories>
<dependencies> <dependency> <groupId>com.aspose</groupId> <artifactId>aspose-cad</artifactId> <version>21.11</version> </dependency> </dependencies>
Convert DWG to EMF Image Programmatically in Java
You can convert a DWG file to an EMF image by following the steps below:
- Load the input DWG file using the Image class constructor.
- Instantiate an object of CadRasterizationOptions class.
- Set different properties for output image.
- Save the output EMF image.
The following code sample explains how to convert a DWG file to an EMF image programmatically in Java:
Convert DWG to WMF Image Programmatically in Java
You can convert a DWG file to a WMF image with the steps below:
- Firstly, load the input DWG file with the Image class.
- Initialize an instance of CadRasterizationOptions class.
- Initialize WmfOptions class object.
- Save the output WMF image.
The following code sample elaborates how to convert a DWG file to a WMF image programmatically in Java:
Get Free Temporary License
You can evaluate the API features in their full capacity, without any limitations by requesting a free temporary license.
In this article, you have inspected how to convert a DWG file to an EMF or WMF image file programmatically in Java. Furthermore, please take a look at the documentation section to take a look at other features of the API. Please feel free to contact us at the forum in case of any inquiries.