Search:   Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

MetafileToEPSConverter

Categories: Windows, Linux, Tools
<< | Page list | >>

Metafile to EPS Converter

Last update: version 1.5 (November 9, 2008). Supports Windows 2000/XP/Vista/Linux+Wine. 64-bit Windows is now also supported.

Using the metafile to EPS Converter, LyX can automatically convert graphics from the Windows metafile format (EMF or WMF) to Encapsulated Postscript (EPS). EPS graphics can be included directly in Postscript files and can easily be converted to PDF graphics (LyX will do this automatically).

Windows

The Metafile to EPS Converter is included in the official Windows installer of LyX 1.5.5 and later and is automatically used by LyX. It is also available as a stand-alone application.

Linux

On Linux, this tool can be run under Wine and will use the built-in metafile support of Wine (tested with version 0.9.53). While it is a bit more difficult to setup than the standard wmf2eps converter, the results will be better and EMF files are also supported.

  • Download metafile2eps-linux.zip and extract it to a new folder 'metafile2eps' under the 'Program Files' folder of your Wine installation (usually '/home/<userid>/.wine/drive_c/Program Files').

A virtual printer needs to be installed that does the actual conversion. Using CUPS as printer spooler, this is the installation procedure: (There will be some differences if you are using other printer spoolers, or it might not work at all.)

  • As root, copy '/home/<userid>/.wine/drive_c/Program Files/metafile2eps/PSPrinter/Metafile to EPS Converter.ppd' to '/etc/cups/ppd/Metafile to EPS Converter.ppd'. The name 'Metafile to EPS Converter.ppd' is important, do not change.
  • As root, add the following lines to /etc/cups/printers.conf:
<Printer Metafile to EPS Converter>
Metafile to EPS Converter
Location Here
DeviceURI file:/dev/null
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
</Printer>
Again, do not change the name 'Metafile to EPS Converter'.
  • Restart CUPS
  • Create a shell script named 'metafile2eps' with the following contents somewehere in your path:
#! /bin/sh
wine /home/<userid>/.wine/drive_c/Program\ Files/metafile2eps/metafile2eps.exe "$@"
{ the above script didn't work. Try this one which takes care of absolute and relative file paths between *nix and wine and works both for inline preview and output }
 #!/bin/bash
 emf2eps="C:\\\\Program Files\\\\metafile2eps\\\\metafile2eps.exe"
 emf=$( echo Z:$([[ "${1:0:1}" != "/" ]] && echo $PWD/ )$1 | sed 's:/:\\\\:g' )
 eps=$( echo Z:$([[ "${2:0:1}" != "/" ]] && echo $PWD/ )$2 | sed 's:/:\\\\:g' )
 echo "$emf2eps" "$emf" "$eps"
 wine "$emf2eps" "$emf" "$eps" 2>/dev/null
 
Don't forget to make it executable.
  • If you do not want to use the default converter for on screen display of metafiles (this uses libwmf and may not work correctly as described above), create a converter for EPS->PNG conversion in LyX. The command is convert PS:$$i PNG:$$o. This command is identical with the default EPS->PNG converter, but LyX won't use the latter for a two step conversion xMF->EPS->PNG. Or equivalently, add the following line to the CONVERTERS SECTION of ~/.lyx/preferences (depends on ImageMagick):

\converter "ps" "png" "convert PS:$$i PNG:$$o" ""

Finally, start LyX and click Tools > Reconfigure.

Note: You may have to restart cups with:

$ sudo killall -HUP cupsd

The installation is now completed.

Source code

Source code (GPL license): metafile2eps-source.zip

Windows Linux Tools

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2013-10-26 03:29 UTC