Created
February 1, 2022 08:13
-
-
Save aspose-com-gists/3c3b7cc7aac450ec575551b623dd4172 to your computer and use it in GitHub Desktop.
Convert DWF to PNG or JPG JPEG Image Programmatically 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
String inputFile = "blocks_and_tables.dwf"; | |
// Load the input DWF file | |
Image image = Image.load(inputFile); | |
// Initialize JpegOptions class object | |
JpegOptions jpgOptions = new JpegOptions(); | |
CadRasterizationOptions dwfRasterizationOptions = new CadRasterizationOptions(); | |
jpgOptions.setVectorRasterizationOptions(dwfRasterizationOptions); | |
dwfRasterizationOptions.setPageHeight(500); | |
dwfRasterizationOptions.setPageWidth(500); | |
// Export DWF to JPG image | |
String outPath = "blocks_and_tables.jpg"; | |
image.save(outPath, jpgOptions); |
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
String inputFile = "blocks_and_tables.dwf"; | |
// Load the input DWF file | |
Image image = Image.load(inputFile); | |
// Initialize PngOptions class object | |
PngOptions pngOptions = new PngOptions(); | |
CadRasterizationOptions dwfRasterizationOptions = new CadRasterizationOptions(); | |
pngOptions.setVectorRasterizationOptions(dwfRasterizationOptions); | |
dwfRasterizationOptions.setPageHeight(500); | |
dwfRasterizationOptions.setPageWidth(500); | |
// Export DWF to PNG image | |
String outPath = "blocks_and_tables.png"; | |
image.save(outPath, pngOptions); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment