[OS X TeX] OT: looking for a public-domain EPS file editor

Bruno Voisin bvoisin at mac.com
Wed Apr 25 20:08:13 EDT 2007

Le 25 avr. 07 à 22:30, Chris Goedde a écrit :

> On Apr 25, 2007, at 2:37 PM, I wrote:
>> The problem is the line:
>> initmatrix
>> in the original file. The redbook says the following: "There are  
>> few situations in which a PostScript language program should  
>> execute initmatrix explicitly. A page description that executes  
>> initmatrix usually produces incorrect results if it is embedded  
>> within another, composite page."
>> If I comment out that line (i.e. put a % at the front), then run
>> gs -sDEVICE=bbox -dNOPAUSE -dBATCH bulle-orig.eps
>> ghostscript gives me the right bounding box. If I then paste that  
>> bounding box into bulle-orig.eps in place of the existing bounding  
>> box, then
>> epstopdf bulle-orig.eps
>> produces a correctly cropped figure.
> Actually, it's simpler than that. All you have to do is comment out  
> (or remove) the 'initmatrix' line and then epstopdf will produce a  
> correct pdf file.

To summarize various trials I did:

Manual solution

- Edit bulle-orig.eps manually, to comment out the initmatrix line,  
and save the result as bulle-chris.eps.

- Use epstopdf (from TeX) to convert to pdf:

	epstopdf --outfile=bulle-chris-epstopdf.pdf bulle-chris.eps

The file bulle-chris-epstopdf.pdf has the correct bounding box. If  
one attempts to use instead pstopdf (from OS X), Preview (from OS X)  
or ps2pdf (from GhostScript), the bounding box remains incorrect (it  
is the same as in bulle-orig.eps).

"Automated" solution

- Use ps2pdf (from GhostScript) or pstopdf (from OS X) to convert to  

	ps2pdf bulle-orig.eps bulle-orig-ps2pdf.pdf
	pstopdf bulle-orig.eps -o bulle-orig-pstopdf.pdf

Using esptopdf (from TeX) instead produces incorrect output (nothing  
but blank space).

- Apply pdfcrop (from TeX):

	pdfcrop bulle-orig-ps2pdf.pdf
	pdfcrop bulle-orig-pstopdf.pdf

- Use pdf2ps (from GhostScript) to convert back to eps:

	pdf2ps bulle-orig-ps2pdf-crop.pdf bulle-orig-ps2pdf-crop-pdf2ps.eps
	pdf2ps bulle-orig-pstopdf-crop.pdf bulle-orig-pstopdf-crop-pdf2ps.eps

The bounding box is now correct, but the fonts have been bitmapped,  
apparently because they were not embedded in the PDF file or because  
they were embedded by pstopdf in TrueType format. Using pdftops (from  
xpdf) rather than pdf2ps results in the pdf output to have the same  
incorrect bounding box as the original eps file.

Pre-processing bulle-orig.eps using Siep Kroonenberg's epspdf (based  
on xpdf) does not seem to provide any benefit for this particular file.

All in all I can but agree with your sentiment:

> BTW, whoever wrote the driver that created that postscript code is  
> truly twisted.
> Also, if you need to actually get rid of the white rectangle for  
> some reason, I think it is sufficient to comment out the line:
> 1 432 4032 30240 20160 er
> You can verify that this produced the rectangle by replacing the  
> initial '1' with, e.g., '0.5':
> 0.5 432 4032 30240 20160 er

The who here is the commercial and truly expensive Tecplot software  
<http://www.tecplot.com/>. So much for the supposed superior quality  
of commercial software!

I must admit I am very glad that there exists Adobe Illustrator on  
Mac OS or Windows, which makes all that sort of things much easier,  
and that university pricing makes Illustrator affordable.

In any case, thanks to all of you for your kindness and expertise.  
That list is amazing!

Bruno Voisin
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/

More information about the MacOSX-TeX mailing list