Applescript to convert PDF's to EPS's

Hi,

I received PDF’s that I then have to convert to EPS’s in Acrobat 4.0, I get hundreds of these a week and it is annoying to have to manually do it.

I know this can be done automatically in Acrobat 5.0, but I don’t have the option of getting that at the moment.

I know I should be able to write an Applescript that can do this but I can’t figure out how to do it. When I use the menu or menu item commands they don’t work properly.

Can someone please help??

How do you intend to use the resulting EPS? There is a really easy way to convert PDFs to PostScript but this will not be the same as an EPSF. To convert to PostScript you can use the Desktop Printer Utility to create a Translator desktop printer and have Acrobat print the PDFs to the Translator. To do this: Create a new desktop printer using the Desktop Printer Utility. Select AdobePS as the driver, select Translator (PostScript) as the type of printer, and select Acrobat Distiller as the PPD (printer description file). Then you will simply need to write an AppleScript to print the files. The code for this is really simple:


tell application "Acrobat™ 4.0"
	try
		print pages document 1 PS Level 1 without binary output -- Use whatever postscript level is needed
	on error errmsg number errnum
		display dialog "Error #" & errnum & return & errmsg
	end try
end tell

However, if you need to use the EPS file for placement in something like QuarkXPress this won’t work. You may be able to find a relatively inexpensive product that does what you need to do. If the above solution doesn’t work for you, try http://www.tucows.com.

Thanks for the reply.

The applicationI am using requires that the files need to be EPS’s. I have looked around the net for an application that will do this but cannot find anything that will run on a MAC (I found a PC one but it doesn’t create Mac previews).

I know that Acrobat 5 can do this with batch processing but that is not an option at this time.

I have found a script that can select menu items but I can quite get it to select the option I want (Script below).

tell application “Acrobat 4.0”
Activate
Select Menu Item menu title “File” menu item text “Print…”
end tell

Obviously you need Menu Events available ([url=http://Http://osaxen.com/menu_events.html]Http://osaxen.com/menu_events.html[/url]), I need to get the code to select File - Export - Postscript or EPS…

I see. I found the same version for PC and assumed there should be a MAC version as well. You would think, but maybe not. You are not by chance using GraphicConverter, are you?

Anyway, check out http://www.planetpdf.com and http://www.artage.com. They may have something that will help.

I know this is a serious work around, but you may be able to use something from http://www.artage.com to add a MAC preview to the PostScript file, then use it in the target app. It may be a circuitous route, but if it is faster in the end than doing this manually, it may be worth it.

Sorry I couldn’t be more helpful. Good luck. I’ll keep watching this post to see what others post or what you come up with.

Scott

Spoon

Do you have Adobe Illustrator?

If so, thought of using that?

lewiscot has the right idea. this assumes you are using a relatively new version of laserwriter 8 or adobePS 8

make a new desktop printer as a postscript translator, use a postscript printer ppd, such as acrobat ppd

open a file in acrobat and choose print.

pick the new postscript translator printer you just created from the “Printer:” list

pull down the joboptions menu in the printe window and select “Save as File”

pull down the format window and choose “EPS Mac Standard Preview”

pick the Postscript Level that you need to comply with usually 2 and 3

Include your fonts if you need to.

click save settings

click cancel

now use the script that lewiscot supplied earlier in the thread.


set PDFSource to "Path:To:PDF:folder:here" -- replace this string with the path to your pdfs
set PDFList to list folder PDFSource without invisibles
repeat with thePDF in PDFList
 tell application "Acrobat™ 4.0" 
   try 
      open file (PDFSource & thePDF)
      print pages document 1 PS Level 1 without binary output -- Use whatever postscript level is needed 
   on error errmsg number errnum 
      display dialog "Error #" & errnum & return & errmsg 
   end try 
      close document 1 saving no
 end tell 
end repeat