private static void emfToPng(String emfPath, String pngPath) throws IOException {
EMFInputStream inputStream = new EMFInputStream(new FileInputStream(emfPath), EMFInputStream.DEFAULT_VERSION);
EMFRenderer emfRenderer = new EMFRenderer(inputStream);
int width = (int) inputStream.readHeader().getBounds().getWidth();
int height = (int) inputStream.readHeader().getBounds().getHeight();
BufferedImage result = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = result.createGraphics();
//设置背景色
g2.setBackground(Color.WHITE);
//通过使用当前绘图表面的背景色进行填充来清除指定的矩形。
g2.clearRect(0, 0, width, height);
emfRenderer.paint(g2);
ImageIO.write(result, "png", new File(pngPath + File.separator + StringUtils.getRandomNumber() + ".png"));
g2.dispose();
}