Printing multiple PDF documents

I have a script that opens several PDF files, but I can not figure out how to make it print all of the open documents. It only prints the 1st one open.


display dialog "Do you want to print? " buttons {"Cancel", "Ok"} default button 2 with icon 1
tell application "Finder"
activate
select every item of container window of folder "path_to_folder"
open selection
end tell
tell application "Acrobat 5.0"
print pages
close all docs
tell application "Finder"
activate
select every item of container window of folder "path_to_folder"
move selection to folder " path_to_folder"
end tell

Thanks in advance.

Herbie

I can now get more than one document to print. However, I need to be able to repeat the folowing until all documents are closed…everything Ive tired is not working.



print pages
close document
print page 
close document

Please help

Herbie

Hi,

I don’t have Acrobat, but something like the following should work:


display dialog "Do you want to print? " buttons {"Cancel", "Ok"} default button 2 with icon 1 
tell application "Finder" to open (every file of folder "path_to_folder") 
tell application "Acrobat 5.0" to repeat with thisDoc in (get every document) 
print pages thisDoc
close thisDoc saving no
end
tell application "Finder" to move (every item of folder "path_to_folder") to folder "path_to_folder"

Let me know how that works out. I’m typing from a PC so everything looks funny.

Theoretically, once you’ve got the files open, this should work, too:

tell application “Acrobat™ 5.0” to tell every document to {print pages, close saving no}

… but I’m not necessarily confident that it will.

Can you give an update on this?

Do you have a script that works?

Another option is to use a shell script. Mac OS X 10.2 and later will print pdf files directly from the command line. The basic form of the command is:
“lpr <filename.pdf>”
Note that filename.pdf is actually a path. the lpr command has a ton of options, but if nothign is specified it prints the file to whatever your default printer is. Use the -P switch to choose a specific printer. To get a list of printer names that are command-line accessible, use “lpstat -a”.

Our secretary commonly would convert a bunch of word files to pdf in OS 9 using printtopdf as a print driver, selecting the word documents and then selecting print. Thus, a one stop operation to pdf a pile of documents.

This can not be done easily with OS X (as it must be done individually).

I am going to play around with the scripts noted above and was just wondering if anyone else had the same problem (and a solution).

Compiling PDF’s actually isn’t that hard. If you turn all of your individual documents into PDF’s, then you can use AppleScript to do successive “insert pages” commands to get all the files into a single one.

Yes I have a scirpt that will work


display dialog "Create Black and White Proof? " buttons {"Cancel", "Ok"} default button 2 with icon 1
tell application "Finder"
	activate
	set PDF_L to every item of container window of folder "path_to_folder	select PDF_L
	open selection
end tell
tell application "Acrobat 5.0" to repeat with thisDoc in PDF_L
	if PDF_L = 0 then exit repeat
	print pages
	close document
end repeat
tell application "Finder"
	activate
	select PDF_L
	move selection to folder " path_to_folder" end tell


Hope this helps Herbie

Thanks.

I’ll give it a try.

(guess I may have to buy Acrobat for everyone? Preview doesn’t appear to be scriptable!)