How to display EMF (MS Enhanced Meta File) image in browser?

Viewed 1706

I'm looking for any way to display EMF files in (modern) browser.

  • use case: opening vsdx (MS Visio) files directly in browser
  • it's possible: there are many solutions server-side (php ImageMagic, java, c, c#)
  • I found some client side, but not working for emf files: https://github.com/g21589/wmf2canvas

(don't care about IE, Google Chrome for now)

example source and expected (emf, png): resources

1 Answers

Edit 20210304:

See Lucero's comment; The author of UDOC.js has removed the code from github. Lucero has since uploaded the files as a gist here. Since the files were originally provided under a MIT license, I don't see a problem with this.

Original Answer:

I don't really have a good answer for you. But I notice in the issues page of the wmf2canvas github repository there is a discussion about EMF.

Where the developer points to UDOC.js for WMF/EMF/PDF/PS conversion.

Udoc.js is MIT licensed, and has both a fromEMF.js and a ToContext2D.js, so it seems between the two you should be able to achieve your goal.

It looks like it is all done inbrowser, without external apis, but I haven't been able to try, since I don't have any EMF files.

There is also a link to an online demo, but I can't figure out for sure if they enabled EMF/WMF for the demo, or only pdf/ps.

Related