Re: Word 2 PDF
Re: Word 2 PDF
- Subject: Re: Word 2 PDF
- From: bill <email@hidden>
- Date: Tue, 15 Nov 2005 20:37:50 +0800
I need to convert truckloads of Microsoft Word documents into PDF
documents on an ongoing basis.
For testing, I'm using Tiger (10.4.3) with Word X (service release 1,
couple versions back) on a Ti PowerBook (one of the greatest
computers ever built).
Richard,
In Tiger, there're two shell scripts that can do the job.
Use "/usr/bin/textutil" to convert *.doc to *.rtf, then use "/System/
Library/Printers/Libraries/convert" *.rtf to *.pdf.
You may look at the example script file "/Library/Scripts/Printing
Scripts/Convert To PDF.scpt".
Try the script below:
-- script starts
----------------
-- step 1: choose *.doc, then get the directory name and file name
set sourceDOC to (choose file)
-- you may need a more robust way to get the file name
set fileName to text 1 thru -5 of (name of (info for sourceDOC))
set filePOSIX to (quoted form of POSIX path of sourceDOC)
set dirName to do shell script "/usr/bin/dirname " & filePOSIX
-- step 2: convert convert *.doc to *.rtf
set cmd to ("/usr/bin/textutil -convert rtf " as Unicode text) &
(quoted form of POSIX path of sourceDOC)
do shell script cmd
-- step 3: then convert *.rtf to *.pdf
set sourceRTF to quoted form of (dirName & "/" & fileName & ".rtf")
set PDFname to quoted form of (dirName & "/" & fileName & ".pdf")
set cmd to ("/System/Library/Printers/Libraries/convert -f " as
Unicode text) & sourceRTF & " -o " & PDFname & " -j 'application/pdf'"
do shell script cmd
say "done"
----------------
-- script ends
Also, you may need to check the effect, header and footer in *.doc
would be lost in *.pdf.
Though file name is quoted; however, in my experience, if *.doc name
is not ASCII, the converted PDF file would be corrupted.
bill
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden