[OS X TeX] epstopdf

Peter Dyballa Peter_Dyballa at Web.DE
Tue Sep 27 22:07:50 CEST 2005


Am 27.09.2005 um 20:37 schrieb Chris Goedde:

> Is it really impossible to use epstopdf to batch convert eps to pdf 
> when the path names contain spaces?

Yes, it is!

I tried it here and looked too into the Perl code: it does *not* spaces 
in names! It's UNIX from before the war.

A workaround would be to cd to the file's directory:

	Dir=`dirname "$1"`
	pushd "$Dir"
	epstopdf `basename "$1"`
	popd

pushd and popd allows the script to change its working directory for 
the temporary work and to return afterwards to were it started.

Put the four lines with an extra header like '#!/bin/bash' into a file 
(~/bin/<file>), invoke 'chmod 755 <file>' to make it executable and 
invoke find à la:

	find . -type f -name '*.eps' -exec <file> {} \;

It will fail when the EPS file name contains spaces. You can rename 
such files like this:

	BasName=`basename "$1" .eps`
	NewName=`echo "$BasName" | tr ' ' '+'`
	ln -s "$1" ${NewName}.eps
	epstopdf ${NewName}.eps
	mv ${NewName}.pdf "${BasName}.pdf"
	rm ${NewName}.eps

The first line "saves" the original name, without extension.
The second line translates spaces into +.
The next line creates a symlink to the original spicy file with the new 
name.
epstopdf gets invoked on the new name and creates <new+name+less 
.eps>.pdf
Next the PDF file name without spaces is renamed to one with spaces.
Finally the temporary symlink is removed.

Notice I that in the first line the directory path gets already 
stripped off the file name!

Both 'scriptlets' can be combined to one script that handles all cases 
...

--
Greetings

   Pete

$ sumascii BILL GATES
   B   I   L   L   G   A   T   E   S
  66+ 73+ 76+ 76+ 71+ 65+ 84+ 69+ 83 = 663

  and add 3 because he's Bill Gates the third.

------------------------- 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