[OS X TeX] trim pdf figures
Alan Curtis
acurtis at ieee.org
Tue Jun 22 12:53:58 EDT 2004
On Jun 22, 2004, at 10:06 AM, Edward Thome wrote:
>
>>> 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
>
>
Ed
Isn't there problem with your script in that you get bitmapped fonts?
I had come across two other potential solutions, although I tend to use
'save as eps and drop it on TeXShop'.
1. http://www.cds.caltech.edu/~ross/Adobe/AdobeBugs.pdf suggest putting
\expandafter\ifx\csname pdfoptionalwaysusepdfpagebox\endcsname\relax
\pdfoptionalwaysusepdfpagebox 5 %
\fi
in your preamble, but it didn't work for me.
2. A perl script from Hans Hagen at www.pragma-ade.com, which I can no
longer find, which changed /ArtBox to /MediaBox in the text of the pdf
file.
Alan
-----------------------------------------------------
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 MacOSX-TeX
mailing list