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

Siep Kroonenberg siepo at cybercomm.nl
Fri Dec 3 15:00:10 CET 2010


On Thu, Dec 02, 2010 at 08:21:01AM -0800, Michael Sharpe wrote:
> 
> On Dec 2, 2010, at 8:01 AM, Herbert Schulz wrote:
> 
> > 
> > On Dec 2, 2010, at 9:44 AM, Themis Matsoukas wrote:
> > 
> 
> 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

The garbage is an eps preview header. This is defined in Adobe's
official eps documentation. You can remove the preview with a script
based on Adobe's specification:

#!/usr/bin/perl
undef $/;
$ALL = <>;

if (substr ($ALL, 0, 2) eq "%!") {
  print $ALL;
} else {
  @toc = unpack "VV", substr ($ALL, 4, 8); # offset, l. of PS part
  print substr ($ALL, $toc[0], $toc[1]);
}

Theis script reads the table of contents included in the eps and
copies just the PostScript part.

Name the script e.g. nopreview and use it as follows:

nopreview <in.eps >out.eps

-- 
Siep Kroonenberg



More information about the macostex-archives mailing list