Re: Creating PDFs with Ghostscript
Re: Creating PDFs with Ghostscript
- Subject: Re: Creating PDFs with Ghostscript
- From: Suksiri Vichasri Grams <email@hidden>
- Date: Sat, 1 Feb 2003 17:00:08 +0700
The answer is given in:
On Tuesday, Jan 28, 2003, at 11:02 Asia/Bangkok, Christopher Nebel
wrote:
Sort of apropos of everone's favorite thread of the past few days...
Technical Note TN2065, "do shell script in AppleScript" is now
available at > <http://developer.apple.com/technotes/tn2002/tn2065.html>.
Shortly, "do shell script" makes use of the sh shell. The sh shell does
not read your csh.login file. To get ghostscript working you will have
to export your PATH inside the "do shell script" like - do shell
script "export
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/
X11R6/bin; ps2pdf13 '/Users/simontop/Desktop/test.ps'
'/Users/simontop/Desktop/test.pdf'".
Second part, why does your stuff not work when you put the full path in
front of ps2pdf13? This is due to the fact that ps2pdf13 and the other
ps2pdf filter are only small scripts that tell the ghostscript binary
(gs) what to do with your files. As the sh shell does not have the full
path for gs available your script will fail. Again, exporting the PATH
as indicated above will solve this problem for any binary that is in
the PATH. If you issue a second "do shell script" you will have to
export the PATH again.
Good luck,
Rudi Grams
On Friday, Jan 31, 2003, at 23:13 Asia/Bangkok, Simon Topliss wrote:
Hi,
I'm trying to create PDFs using AppleScript and Ghostscript. I have
Ghostscript all installed correctly and I'm now able to create a PDF
in the
Terminal with the following (all 1 line):
% ps2pdf13 '/Users/simontop/Desktop/test.ps'
'/Users/simontop/Desktop/test.pdf'
In order to get that working though, I had to edit the setenv PATH in
csh.login (as described at:
<http://www.macwrite.com/criticalmass/mac-os-x-jag-tweaks-part-1.php>)
to:
setenv PATH
"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/
X11R6/bin
:"
if (! $?DISPLAY) then # added for sake of X11 displays in Terminal by
DMG
setenv DISPLAY :0.0
endif
#EOF
However, if I run the ps2pdf13 command above with a 'do shell script'
I get
an error (similar to what I was getting before I edited the PATH):
--> sh: ps2pdf13: command not found
If I try to specify the full path to it:
do shell script "/usr/local/bin/ps2pdf13
'/Users/simontop/Desktop/test.ps'
'/Users/simontop/Desktop/test.pdf'" -- all 1 line
I get a different error:
--> /usr/local/bin/ps2pdf13: exec: ps2pdfwr: not found
So now I'm stuck. I guess it's something to do with the shell
AppleScript is
using, but I don't know enough unix to fix it.
Does anyone have Ghostscript working with AppleScript? If so how?
Thanks to anyone who can help,
simon
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.