[OS X TeX] GhostScript assistance needed!

Bruno Voisin bvoisin at mac.com
Mon Apr 24 16:09:47 CEST 2006

Le 24 avr. 06 à 15:45, Piet van Oostrum a écrit :

> epstopdf extracts the bounding box from the EPS file and prefixes  
> the file
> with some additional Postscript code to shift the lower left corner to
> (0,0) and to set the pagesize to the size of the EPS. After that  
> the gs
> command is quite simple:
> gs -q -sDEVICE=pdfwrite -dAutoRotatePages=/None - 
> sOutputFile='$OutputFilename' '$InputFilename' -c quit

An alternative might be to use the script ps2pdf, part of the GS  
distribution and installed alongside it (in /usr/local/bin/ in case  
you used i-Installer). The command it (or rather ps2pdfwr, which it  
calls) contains:

sOutputFile=$outfile" $OPTIONS -c .setpdfwrite -f "$infile"

is similar to the above one (except for the AutoRotatePages option).

However, if you want to make your script robust enough to deal with  
most sorts of malformed .eps files produced by the various  
applications around (MATLAB in particular was notorious, some time  
ago, for producing malformed .eps files), you might simply end up  
rewriting epstopdf.

On Mac OS X >= 10.3 you've also Apple's own pstopdf (in /usr/bin/),  
but I imagine the audience you're targetting is cross-platform.

Peter Dyballa has also posted here, some time ago, a piece of code to  
add a bounding-box correction to the PDF output of ps2pdf. IIRC it  
required the external tool pdfcrop, available separately from CTAN  
<http://www.ctan.org/tex-archive/support/pdfcrop/>. However, since  
you're looking for a tool based on GS exclusively, I guess that might  
not be an option?

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

More information about the macostex-archives mailing list