Need java program to convert WMF file to Graphics2D object and vice-versa
posted 7 years ago
Hi, I need a java program to convert a WMF file to Graphics2D object and another program to convert the Graphics2D object back to WMF file. This is because I already have another program (MANIPULATION CODE) which takes in Graphics2D as input and manipulates the data and returns back Graphics2D as output. Sequence is something like this:
I tried using the below code snippet to convert WMF to Graphics2D but it did not work. Line 1: InputStream in = new FileInputStream(file); Line 2: BufferedImageimage = ImageIO.read(in); Line 3: Graphics2D g2 = image.createGraphics();
It gives a null pointer exception on Line 3 because I believe .WMF is not one of the reader formats.
Is there any code which can convert my WMF to Graphics2D and vice-versa.