Created
October 22, 2024 21:32
-
-
Save conholdate-gists/f67b73529e63e96e8fb594cfbe76dbbe to your computer and use it in GitHub Desktop.
Convert DXF to PNG JPG Image in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the input file | |
String srcFile = dataDir + "conic.dxf"; | |
com.aspose.cad.Image image = com.aspose.cad.Image.load(srcFile); | |
// Create an instance of CadRasterizationOptions | |
com.aspose.cad.imageoptions.CadRasterizationOptions rasterizationOptions = new com.aspose.cad.imageoptions.CadRasterizationOptions(); | |
// Set page width & height | |
rasterizationOptions.setPageWidth(1200); | |
rasterizationOptions.setPageHeight(1200); | |
// Create an instance of PngOptions for the resultant image | |
com.aspose.cad.ImageOptionsBase options = new com.aspose.cad.imageoptions.PngOptions(); | |
//Set rasterization options | |
options.setVectorRasterizationOptions(rasterizationOptions); | |
// Save resultant image | |
image.save(dataDir + "image.png", options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment