| | |
| | | |
| | | 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); |
| | | |
| | |
| | | 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(); |