Vector graphics for and MS-Word


I’d like to include vector graphics produced by ROOT to and MS-Word so that figures are visible in these word processors. I’ve found that both programs support WMF (Windows Metafile) and EMF (Enhanced Windows Metafile) formats.

There are several MS-Windows programs which can convert EPS to WMF or EMF. The only one which I’ve found for Linux is pstoedit It works relatively OK but some graphics objects are not displayed properly (for instance TPave). A commercial MS-Windows-only plugin for pstoedit is available and should work much better. So my question is: Could you recommend a converter which is usable for production work? Or is there any other way how to import vector graphics generated by ROOT into these word processors?

I prefer to use LaTeX and EPS or PDF graphics formats but my colleagues write everything in MS-Word which cannot display these formats and I need to collaborate with them.


Probably the best way of doing that is by retaining the original EPS file, which is not limited by resolutions, i.e. you can re-scale it, and it prints lines without blocks, adapting to the resolution of your printer. As far as I know this only works with PS printers, as Word simply sends the EPS file to the printer hoping that the printer understands what to do with it. You’ll need the Word EPS import filter for that.

But Word doesn’t display EPS files properly when editing text. What you need is a preview: a small bitmap image of what’s in the EPS file, which is included in the EPS file itself. Word reads this bitmap part and displays it. As it’s a bitmap it won’t scale nicely etc - but it’s really just the preview, the underlying EPS will print just fine.

Here’s how to generate the preview: download epstool (might already be in your Programs\Ghostgum\gsview folder), and run e.g. epstool -zbmp256 -r72 -t6p -o"image_with_preview.eps" "image.eps" You can obviously create a little batch script for this, which takes eps file names as arguments and which allows you to simply drag and drop several EPS files onto that batch script:

@echo off if "%~1"=="" echo Adds preview to EPS file. Usage: epspreview.bat epsfile1.eps epsfile2.eps... if "%~1"=="" exit /B 1 SET EPSTOOL="C:\Program Files\Ghostgum\gsview\epstool" :oncemore %EPSTOOL% -zbmp256 -r72 -t6p -o"%~1_pv" "%~1" IF NOT ERRORLEVEL 1 cp "%~1_pv" "%~1" IF EXIST "%~1_pv" del "%~1_pv" shift if NOT "%~1"=="" GOTO oncemore

I have an idea :slight_smile:

One can propvide just another WIN32 specific implementation of
"TVirtualPS" class to create WMF instead of Postscript.

This implementation can be done as the regular ROOT plugin and loaded via the ROOT resource file, they way it does Postscript:

Plugin.TVirtualPS: ps TPostScript Postscript “TPostScript()”

Just an idea :open_mouth:
Anybody interesting :question: