What is the reason why some dwg files cannot be opened with CAD after being converted to dxf format?
When converting a dwg file to jpeg, the conversion is slow. Is there any way to convert it faster
@ShaoNanFeng,
please attach the initial DWG file and conversion code, so we can debug and see what makes the export slow.
public static void main(String[] args) throws Exception {
File file = new File("D:\\test.dwg");
InputStream inputStream = new FileInputStream(file);
CADFileToImage(inputStream, "D:\\test.jpg");
}
public static void CADFileToImage(InputStream inputStream, String dataDir) throws IOException {
CadImage image = (CadImage) Image.load(inputStream);
// 设置输出格式为 JPEG
JpegOptions jpegOptions = new JpegOptions();
CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions();
cadRasterizationOptions.setPageWidth(4200);
cadRasterizationOptions.setPageHeight(2970);
jpegOptions.setVectorRasterizationOptions(cadRasterizationOptions);
image.save(dataDir, jpegOptions);
}
It takes 16 seconds for this code to convert a dwg file to a jpeg file. Please check if it works properly
@ShaoNanFeng,
I can confirm this issue, we will try to improve this performance in the scope of CADJAVA-11394.