# [OS X TeX] EPS to PDF conversion fails in graphicx (but not in preview)

Michael Sharpe msharpe at ucsd.edu
Thu Dec 2 11:21:01 EST 2010

On Dec 2, 2010, at 8:01 AM, Herbert Schulz wrote:

>
> On Dec 2, 2010, at 9:44 AM, Themis Matsoukas wrote:
>
>> I have run into a problem (again) with graphicx failing to convert an EPS created by Illustrator CS5 into pdf. In this case, the original eps was generated by igor (http://wavemetrics.com/). This file, igor.eps, is converted properly by graphicx, or when dropped on TS.  I then opened the igor.eps in AI CS% and saved it as eps without doing any sort of editing in illustrator. The resulting file (aics5.eps) fails to convert to pdf, whether in includegraphics, or when dropped on TS. Nonetheless, if I drop it on preview.app I get a perfectly fine pdf.
>>
>> Sometime ago I had reported a similar problem and Ross Moore was kind enough to look into the problematic file. However, I am not looking for fixes (I have a fix, I can drop the eps on preview) but for a solution. It simply breaks my workflow (just as I started to write a book with 100+ figures...)  if I have to go outside Latex/AI/igor to fix such problems when they appear. I don't know (and don't have the expertise to determine) whether the problem is with gs or with illustrator but fact that the offending file is converted by preview.app makes me think it is with gs.
>>
>> I am attaching the two eps files (igor.eps, aics5.eps), a small latex file that demonstrates the problem, and the pdf out put I get (test.pdf).
>>
>> Themis
>>
>>
>> \documentclass[11pt,article]{memoir}
>> \usepackage{graphicx}
>> \begin{document}
>>
>> \begin{center}
>> \includegraphics[width=3.25in]{igor}\\
>> EPS produced by IGOR
>> \end{center}
>>
>>
>> \begin{center}
>> \includegraphics[width=3.25in]{aics5}\\
>> EPS produced by AICS5.
>> \end{center}
>> \end{document}
>>
>
> Howdy,
>
> It appears that there is some sort of header'' before the %!PS line in the aics5.eps file. Maybe it's a UTF-8 BOM? In any case when I remove it everything works properly.
>

One way to filter out garbage like this is to

1. change the extension to .ps;
2. ps2eps -l aics5.ps

(The option in the last command is a lower case l, which makes a loose bounding box.)

The resulting eps works fine, and has any bounding box errors corrected.

Michael