[OS X TeX] trim pdf figures

Edward Thome ed.thome at murraystate.edu
Tue Jun 22 16:06:09 CEST 2004


>> No request for permission needed.
>>
>> a) Gerben planned on putting pdfcrop.pl in i-Installer on 1 Mar 2003 
>> but must have forgotten (a rare Gerben oversight), but pdfcrop.pl is 
>> on ctan anyway.
>>
>> b) Carr's post on the list is from 31 Mar 2003 and includes his 
>> script.
>>
>> See 
>> http://www.esm.psu.edu/mac-tex/MacOSX-TeX-Digests/2003/default.html
>
> Apart from the fact that the original post was in html, and the copy 
> in the archives is heavily mangled, many =20 and =2E replacements have 
> been inserted. If someone could post a copy -- and make sure they post 
> it in a plain text email -- at least we then have a known good copy in 
> the archives.
>
> Maarten
>
Here is what I've been using:
-------------------
  #!/bin/sh
#\
exec tclsh "$0" "$@"

# croppdf.tcl -- crop a PDF file to give a correct bounding box
# Author: Dr A. J. Carr <alun DOT j DOT carr AT ucd DOT ie>
# Version 0.3 ar3103
# This program is not warranted for suitability of purpose.
# Use at your own risk.

if {$argc == 0} {
     puts "usage: $argv0 file1.pdf [file2.pdf...]"
} else {
     foreach f $argv {
         if {[string compare -nocase [file extension $f] ".pdf"] == 0} {
             set rootname [file rootname $f]
             exec pdf2ps "$f" "${rootname}.ps"
             exec eps2eps "${rootname}.ps" "${rootname}-new.eps"
             file delete "${rootname}.ps"
             exec epstopdf "${rootname}-new.eps"
             file delete "${rootname}-new.eps"
         } else {
             puts stderr "error: not a PDF file: $f"
         }
     }
}
--------------------

Ed

-----------------------------------------------------
Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
Please see <http://www.esm.psu.edu/mac-tex/> for list
guidelines, information, and LaTeX/TeX resources.





More information about the macostex-archives mailing list