whycxzp
2024-11-07 d3113b2a1c4c7a6c44cb0eeaf728c302cb899792
src/main/java/com/whyc/util/DwgToPngUtil.java
@@ -10,15 +10,20 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
@Slf4j
public class DwgToPngUtil {
    public static String dwg2png(File dwgFile) throws IOException {
    public static String dwg2png(File dwgFile){
        FileInputStream fileInputStream;
        //将dwg文件转换成InputStream输入流
        try {
        fileInputStream = new FileInputStream(dwgFile);
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
        Image objImage = Image.load(fileInputStream);
@@ -53,7 +58,11 @@
            e.printStackTrace();
            log.error("dwg转pdf失败{}",dwgFile.getName());
        } finally {
            try {
            fileInputStream.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        //log.info("文件转换成功{}",dwgFile.getName());
        return outputFile.getAbsolutePath();