Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Summary: docx4j can convert WMF files to SVG using pure Java approach. Note regarding options for converting WMF files to SVG and/or PNG (as at Feb 2010): - - wmf2svg - batik - freehep - imagemagick - openoffice wmf2tosvg is a good solution for WMF (although it has no EMF support). For WMF, we'll use it. This can be revisited if/when improves. (EMF is the real problem - see note in MetafileEmfPart) Batik has WMFTranscoder, but not EMFTranscoder! Even if it did, Batik is best avoided as it is no good on appengine since it uses awt, and spawns threads. imagemagick does a nice job with WMF, but has no support for EMF at all (other than on Windows). So given that we are stuck with a partial solution, its best to use pure Java. For completeness, a note that openoffice can be used to convert EMF and WMF; I found it worked well.
public class MetafileWmfPart extends MetafilePart {
	public MetafileWmfPart(PartName partNamethrows InvalidFormatException {
	public MetafileWmfPart(ExternalTarget externalTarget) {
	public void init() {
		// Used if this Part is added to [Content_Types].xml 
		// Used when this Part is added to a rels 
	public SvgDocument toSVG() throws Exception {
		InputStream is = BufferUtil.newInputStream(this.getBuffer() );
		return new SvgDocument(is);
		// net.arnx.wmf2svg.Main.output(doc, out);
	public static class SvgDocument {
		Document doc = null;
		public Document getDomDocument() {
			return ;
		public SvgDocument(InputStream wmfStreamthrows Exception {
			WmfParser parser = new WmfParser();
			SvgGdi gdi = new SvgGdi();
			 = gdi.getDocument();
New to GrepCode? Check out our FAQ X