purifyeps --version
purifyeps [--fontmap=.fmp file] [.eps input file [.eps output file]]
purifyeps --make-man [=filename] [--section=section]
purifyeps --make-ps-man [=filename] [--section=section]
The insight behind purifyeps is that there are only a few, small differences between MPS and EPS and that a file can be converted into a format that matches both the MPS and EPS specifications simultaneously. purifyeps inputs an EPS file, uses pstoedit's "mpost" filter to convert the file to MetaPost (.mp), runs mpost on the file to convert it to MPS, and finally performs some touchups on the result to convert the file back to EPS, while preserving its ability to be parsed by pdflatex.
In normal operation (i.e., when not run with "--help", "--make-man", or "--make-ps-man"), purifyeps takes the name of an input file and output file. The same filename can safely be used for both files. If the output filename is omitted, output will go to the standard output device. If the input filename is omitted, purifyeps will read from the standard input device.
purifyeps --make-ps-man=happydoc.ps
Create a Unix man page for purifyeps (in the usual roff format), but indicate that it belongs in section "LOCAL" instead of the default of section 1:
purifyeps --make-man --section=LOCAL
Purify sample.eps (mpost.fmp is in the current directory):
purifyeps sample.eps sample.eps
Purify sample.eps (mpost.fmp is in a different location):
purifyeps --fontmap=/usr/share/pstoedit/mpost.fmp sample.eps sample.eps
Rename the purified version while purifying:
purifyeps sample.eps sample-pure.eps
Do the same, but in a Unix pipeline:
cat sample.eps | purifyeps > sample-pure.eps
When you run purifyeps, you should see the output from both pstoedit and mpost, followed by a success message from purifyeps:
% cat sample.eps | purifyeps > sample-pure.eps
pstoedit: version 3.30 / DLL interface 107 (build Mar 14 2002) :
Copyright (C) 1993 - 2001 Wolfgang Glunz
Interpreter finished. Return status 0
This is MetaPost, Version 0.641 (Web2C 7.3.1)
(/tmp/purifyeps-jdeGPkh9.mp [1] )
1 output file written: purifyeps-jdeGPkh9.1
Transcript written on purifyeps-jdeGPkh9.log.
File seems to have been purified successfully.
purifyeps is subject to all of the limitations that affect pstoedit and especially the "mpost" backend to pstoedit. As a result, purifyeps ignores certain PostScript constructs, such as nonuniformly scaled text.
% This is a sample font map for purifyeps.
Times-Bold ptmb
Times-Italic ptmri
Times-Roman ptmr
Helvetica phvr
Helvetica-Bold phvb
Helvetica-Oblique phvro
Courier pcrr
Courier-Bold pcrb
Courier-Oblique pcrro
Note that this is exactly the same format that pstoedit uses. By default, purifyeps looks in the current directory for a font map called mpost.fmp. The "--fontmap" command-line option tells purifyeps to use a different font map, which will typically be the mpost.fmp file that comes with pstoedit.
Once you create purified EPS files with purifyeps, you need to instruct pdflatex to use them. The pdfLaTeX configuration of the "graphics" and "graphicx" packages (pdftex.def) normally ignores .eps files. Putting the following LaTeX code in your document's preamble tells pdflatex that all .eps files are in MPS format:
% Tell pdfLaTeX that all .eps files were produced by MetaPost.
\usepackage{graphicx} % or graphics
\usepackage{ifpdf}
\ifpdf
\DeclareGraphicsRule{.eps}{mps}{*}{}
\makeatletter
\g@addto@macro\Gin@extensions{,.eps}
\makeatother
\fi