Adobe Acrobat Pro 9 - specify number of copies to print

Hi,

as far as I can see there’s no way to control the number of copies to print with Adobe Acrobat 9 with AppleScript (unless you use UI scripting which I guess I should keep away from if I can).

I can specify the first page and last page but not the number of copies - am I right?

(BTW, one reason for me not to use Skim or Preview is that not every image shows up right in those programs, in Acrobat it displays correct)

Hi,

I while back I had the same problem, in that I was able to print from Acrobat but couldn’t find any options in the Acrobat Dictionary for copies. Eventually after exhausting all of the resources known to me I put the print in a repeat x times loop which did the job but meant the pdf had to be ripped x times and took a while!!! I’ve moved on a bit since then but I thought that this maybe possible by embedding JavaScript inside the applescript. After a bit of digging I managed to get it to work using this:

set NumCopies to text returned of (display dialog "Copies:" default answer "1")

tell application "Adobe Acrobat Pro"
	do script "
	var pp = this.getPrintParams();
	var iCopies = " & NumCopies & ";
	pp.NumCopies = iCopies;
	pp.interactive = pp.constants.interactionLevel.silent;
	this.print(pp);"
end tell

This is very basic and there are more options that you can specify but hopefully it’ll point you in the right direction.

One thing I’ve still not been able to work out is how to see the JavaScript equivalent of an Applescript dictionary. If anybody else knows of a resource to see what commands are available then please post a link.

Hope this helps,
Nik

Hey blend3,

that looks promising! Thanks a lot!

For me to make the script compete I need to be able to specify the first and last page - anyone knows how to do this with JavaScript?

Summary: At this point I have one script that can specify first and last page but not the number of copies:

tell application "Adobe Acrobat Pro"
	print pages active doc PS Level 3 first 2 last 2 without binary output and shrink to fit
end tell

And then yours above, blend3, that can specify the number of copies, but not specify the first and last page - yet…

I found this file http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/javascript/AcroJS.pdf - which at page 507 describes the properties of the PrintParams object.

This is my current script, yet to be tested

set NumCopies to text returned of (display dialog "Copies:" default answer "1")

tell application "Adobe Acrobat Pro"
	do script "
   var pp = this.getPrintParams();
   var iCopies = " & NumCopies & ";
   pp.NumCopies = iCopies;
   pp.firstPage = 2;
   pp.lastpage = 2;
   pp.interactive = pp.constants.interactionLevel.silent;
   this.print(pp);"
end tell

Looks like you’re on the right track and thanks for the link.

Nik

what might me stay away from this method anyway is that it seems I cannot control the which printer to use and what printer reset to use with JavaScript.

Hi,

If you want to control different printers then you could always script the ‘Printer Setup Utility’. By relaunching Acrobat after change the printer if should just use the one you set as a default.

set defaultPrinter to "the_name_of_the_printer_you_want_to_use"

set currPrinter to ""
tell application "Printer Setup Utility"
	if current printer is not defaultPrinter then
		set currPrinter to current printer
		set current printer to printer defaultPrinter
	end if
end tell

set NumCopies to text returned of (display dialog "Copies:" default answer "1")

tell application "Adobe Acrobat Pro"
	activate
	do script "
var pp = this.getPrintParams();
var iCopies = " & NumCopies & ";
pp.NumCopies = iCopies;
pp.firstPage = 2;
pp.lastpage = 2;
pp.interactive = pp.constants.interactionLevel.silent;
this.print(pp);"
	quit
end tell

if currPrinter is not "" then tell application "Printer Setup Utility" to set current printer to printer currPrinter

Thanks,
Nik