Illustrator to EPS to PDF scripting

Hi there,
in my job i need to convert a lot of Adobe Illustrator files to EPS and then distill these EPS’s to PDF using the acrobat distiller. I wondered if it would be possible to automate this mind numbing job and Applescript semmed the answer. Problem is, I succeed in producing the EPS but distilling it doesnt work. I can’t find the correct instructions or combination of instructions for distiller. Saving the file as PDF using Illustrator is no option.

What the script needs to do is
Open all AI files in a folder in Illustrator
Save all these files as EPS in a (or the same) folder
Distill all EPS files using Acrobat Distiller with default joboptions.

Can anyone take a look at my script and help me out? It’s my second script ever after reading the tutorial PDf found ont this site

THX in advance
Floris

on run
	tell me to open {choose folder}
end run

on open droppedItems
	set destFolder to choose folder with prompt "Destination Folder?"
	repeat with anItem in droppedItems
		tell application "Finder"
			set filelist to (every file of anItem whose name extension is "ai")
		end tell
		SaveFilesasEPS(filelist, destFolder)
		tell application "Finder"
			set EPSList to (files of anItem whose name extension is "eps")
		end tell
		DistillPDF(EPSList, destFolder)
	end repeat
end open

on SaveFilesasEPS(filelist, destFolder)
	set destPath to destFolder as string
	repeat with aFile in filelist
		tell application "Finder" to set filename to name of aFile
		set newFilepath to destPath & filename & ".EPS"
		tell application "Adobe Illustrator"
			open aFile
			save current document in file newFilepath as eps with options {class:EPS save options, compatibility:Illustrator 11, preview:color Macintosh, PostScript:level 2}
			close current document saving no
		end tell
	end repeat
end SaveFilesasEPS

on DistillPDF(EPSList, destFolder)
	set destPath to destFolder as string
	repeat with aFile in EPSList
		tell application "Finder" to set filename to name of aFile
		set PDFFilepath to destPath & filename & ".PDF"
		tell application "Acrobat Distiller 7.0"
		end tell
	end repeat
end DistillPDF

Model: Mac G5
AppleScript: AppleScript N1-1.9.3
Browser: Safari 312.6
Operating System: Mac OS X (10.3.9)

Floris, distiller requires 3 paths as POSIX paths. Source, destination & adobePDFSettings.

tell application "Acrobat Distiller 6.0.2"
	activate
	Distill sourcePath POSIX path of (Your AS file path) destinationPath POSIX path of (Your AS file path) adobePDFSettingsPath POSIX path of (Your Settings Folder & "Your.joboptions")
end tell

I haven’t tried it with EPS files, but Distilling from a PostScript file is really simple:


tell application "Acrobat Distiller 7.0"
	open full_path
end tell

At least on mine, using “open” immediately distills the file.

A quick question though…are you using Illustrator CS or CS2 and any transparency effects? If so, EPS isn’t a good way to go…

Hi All,

Just adding to Floris’s post…

I’m currently also looking into ways of creating pdf files from eps files, i have been doing trials with various ways to create an ‘ideal’ pdf (live text, colour sepearations, transparancies, small size etc.) i have been looking at allsorts such as distiller, direct save from illustrator, converting through preview, using the convert to pdf applescript, automated workflows through nexus, but not one can create a pdf with all of the above qualities.

Could anybody point me in the general direction of another way of creating pdfs from eps because i’m running out of ideas!!!

is anybody else working on something similar?

Thanks

Kyle

What are you doing with it? What you are asking for is an Illustrator “Native” file (.ai) which is a PDF file format. Both Acrobat and Preview recognize this format, as does InDesign.

Technically that’s not true.

Adobe Illustrator file “are PDFs” only if the PDF preview option is selected at save. However, most graphics studios quickly learn to turn this option off since it can save 25-50% of file size and also reduces save time. Also these “PDFs” still have the “.ai” extension and don’t work cross-platform.

Without the PDF preview, even InDesign won’t touch them.

We’ve researched this to death here where I work. PDFs here (“here” being a top-10 consumer products company’s graphics department of 40+ Macs) have to meet these criteria:

–Be under 2 MB
–Be consistant from Illustrator and InDesign
–Be PC-compatible (you’d be surprised how cross-platform PDFs sometimes aren’t)
–Print on low-end PostScript office printers with limited RAM
–Properly render transparency
–Illustrator files must crop to artwork, not page size

There are four common ways to create a PDF:

  1. Output PostScript file from the native applications, use that PostScript file with Distiller
  2. Output EPS file from the native applications, use that EPS file (EPS is just a PS with a “wrapper”) with Distiller
  3. Save As or Export direct to PDF
  4. Print to PDF using the “virtual printer” (the “Adobe PDF” printer selection)

Option 3 and 4 do not handle transparency very well and the PDFs tend to be very Mac-centric and PC-unfriendly, so those got tossed early on in testing.

Option 2 is the way we did it for years with Illustrator 8. However, if you’ve ever exported an EPS manually from Illustrator CS that has transparency, you’ll see an error warning you about the pitfalls. Our testing shows that while EPS used to be handy because they “cropped” the PDF to the visible artwork, they cause wierd PDF/printing issues with transparency:

–Files look fine on screen, but won’t print on a Windows PC
–Files look fine on screen, but when printed, anything with transparency have black or white bounding-box backgrounds (PC or Mac)
–Files shows the bounding-box backgrounds and print with them too (PC or Mac)

So this too, despite using the technique for 5+ years, got tossed.

We actually used, and some here insist on keeping using, the Save/Export direct to PDF. Problem here is InDesign and Illustrator have different controls and not enough control over size and color options. We’ve also found that direct from these applications tends to essentially use Arobat 6 format, which is not 100% transparency compatible. They also have issues with PC sometimes.

Distiller turned out to be the only option to full support everything…size, transparency, consistancy, and control.

[queue Mission Impossible music]
Your mission, should you decide to accept it, is to automate the “export to PS and Distill” process for files so it is easy for the designers so they will stop doing it their own way, which is about a dozen different techniques, and driving Process & Technologies nuts trying to support them…
[end music]

Yeah, with some really lousy success:

http://bbs.applescript.net/viewtopic.php?id=18329
http://bbs.applescript.net/viewtopic.php?id=18357
http://bbs.applescript.net/viewtopic.php?id=18190 (starfox’s thread)
(not for lack of trying by the folks here mind you, it’s just messy)

PreTech, whom I can’t thank enough, and I have been going at trying to script it for what, couple of weeks? Adobe’s printing controls are little on the bizarre side if you try to do anything beyond standard page sizes, seems to ignore and contradict itself alot.

I’m so close on just UI-scripting around the issue, but have this transient “mystery menu” I can’t figure out how to get access to in a repeatable fashion. When/if I ever get it solved, I’m going to post the code back here for sure. But it could be weeks, since next week is not looking promising for working on it (higher priority things to deal with).

I’m taking some solice now though…any who thinks Adobe software is wierd to script should try making sense of scripting Lotus Notes. O.o

[EDIT: added link to starfox’s thread, which is also relevant]