Sometimes I have the misfortune of having to write conference papers in Microsoft Word, instead of a more civilised environment like LaTeX. Usefully, Word will refuse to import any kind of vector image format except for their own proprietary and crippled format, WMF/EMF. So, when it comes to diagrams, most people tend to throw their arms up and resort to bitmap formats like PNG. This, however, makes for large file sizes, or fuzzy printouts, so it’s a sub-optimal solution.
Although there are plenty of hoops to jump through, it is however possible to generate reasonable EMF files from other vector formats, which Word will accept. There are a large number of pitfalls, not least because of poor standards-adhesion when it comes to rendering of said formats. Mac OS X’s PDF renderer is no exception, unfortunately, so frequently one will have to resort to various bizarre conversion pipelines to have something readable at the other end.
That said, sometimes it works.
So, this is the procedure I’ve been following, to generate EMF figures from artwork created in a variety of applications, including XFig (which I personally don’t use, but my PhD supervisor Carlo enjoys), Inkscape, and OmniGraffle.
- Install pstoedit, a tool which will take a variety of formats (PDF/EPS, for example) and convert them to another – EMF, in particular.
- Make sure the installed version supports EMF output – in Terminal, pstoedit -help | grep emf. If it doesn’t, you’ll need to find an other version elsewhere.
- If your diagram isn’t already in PDF or EPS format already, export it to one or the other.
- Try converting the PDF/EPS, as-is, as a first step. Some commands to try (open in Word/Powerpoint to see the result each time):
- pstoedit -f emf diagram.pdf/eps output.emf
- pstoedit -f emf -pta diagram.pdf/eps output.emf (Place letters individually, if text looks odd)
- pstoedit -f "emf:-m" diagram.pdf/eps output.emf (Use Arial as font, if font looks wrong)
- pstoedit -f emf -drawbb diagram.pdf/eps output.emf (Force drawing of bounding box – try this if you get cropping)
- pstoedit -f emf -xscale 2 -yscale 2 diagram.pdf/eps output.emf (Scale up – use this if lines look blocky; experiment with larger values than 2)
- pstoedit -f "emf:-m" -pta -drawbb diagram.pdf/eps output.emf (A combination of some of above)
- If your EMF version looks wrong, try exporting to EPS if you were using PDF, or PDF if you were using EPS – different renderers perform differently. Try above steps again on this new exported version.
- If this still doesn’t produce reasonable output, you’ll want to try another application that exports better-behaved PDF/EPS. You’ll need to import your diagram into such an application, make any cosmetic changes required to counteract any funny business as a result of the import, then export as PDF/EPS.
- For a while, I was using Inkscape for this purpose, but I was still getting funny output sometimes.
- I discovered a native OS X application called Intaglio, which seems to produce very good PDF output (not so much with EPS).
- For either application, export your diagram in a format they can understand, to subsequently import.
- Inkscape will basically only take SVG, from what I can remember. You can try converting the PDF/EPS to SVG using pstoedit again: pstoedit -f svg diagram.pdf/eps output.svg
- Intaglio will happily take PDF and let you convert it to an editable format, which will work some of the time, with a reasonably well-behaved PDF. Drag the PDF onto the canvas, select it, then use Object, Convert, PDF for Editing.
- Fix any visual problems caused by the import, using the application’s editing tools.
- Export your diagram in PDF/EPS (try both, if necessary)
- Intaglio seems to work best with PDF: Select the figure, then File, Save Selection As, select PDF and Crop to Content Size.
- Once you’ve exported PDF/EPS, repeat step 4 to try to generate reasonable output.
The whole process is undoubtedly an ordeal, and requires serious dedication, but it would appear to be required if you want to generate vector graphics in a Word document. Lets hope the geniuses at Microsoft remember to add a PDF/etc importer into their next Office.