script for Printing incl. printer preset etc.


I’d like to have an AppleScript that can tell Adobe Acrobat Pro to print a document and I want to be able to specify which printer to use, a specific printer preset as well as the number of copies and which pages to print.

Is this possible?

Hi, what version of acrobat do you have?



If you search this forum for author = Barbarpress, and topic = print, and goes back to around 2010 - summer, I think you shall find a script for controlling the print manager, that lets you specify printer.

hm, my search of author “Barbarpress” returns no hits…


Sorry, Barbarapress, I was too tired and the font to small when I wrote it. And by the way, is there anything that hinders you from using skim to read the pdf? Skim is very scriptable, not that you need much; you just need the document name, and then

tell application Acrobat Reader" to print "hfspath to document"


I have pdf file that I need to print using my Xerox 6180 printer, and I would like to automize choosing the printer, printer preset, number of copies and pages to print.

Are you suggesting that I use Skim instead of Adobe Acrobat Pro to print?


If Acrobat Reader should prove hard to script, yes, then I suggest you use Skim.

are you referring to this?:

Don’t know if I should go for LPR or not.

This is what I have so far:

-- set Printer:
tell application "Printer Setup Utility"
	set current printer to printer "Xerox Phaser 6180"
end tell

-- set Printer Preset:
do shell script "defaults write 'Etiketter'"

Should I use LPR?
or script Acrobat or Skim?
Or should I script Printer Setup Utility?


I don’t have toner at the moment, but I also think you should be able to print to a specific printer like this:

tell application "Acrobat Reader" to print "hfspath to document" with properties {target printer:"Xerox Phaser 6180"}

This should work for one specific job, so it is less setup.

I have never used presets, so I would not know anything about that. :slight_smile:

With regards to printing, if you are just going to print some pages, then you would use the Printer setup utility, I don’t think lpr work with bitmapped files, but you may find that it do by reading the manual page. Maybe it even can print a range of pdf pages, or that there is other shell utilities that can do that, but whether that will work or not, is dependent of how well the pdf document conforms to the standard the tool expects.

I really can’t help you more than this.

But I personally would have gone for a Skim solution, it is scriptable, and there are example scripts here, and people familiar with it.


As long as you got your printer setup right with presets and all that, I think you should be able to find the missing pieces on the net if you google for os x command line printing of pdf or similiar, maybe try latex instead of pdf.

You may also search for postcript, as there should be a phletora of utilites for converting pdf to postscript on your Mac.

I am sorry I have no time for this right now, but the pending projects has accumulated to an extent, where I just must prioritize, for the hope of getting them done.


Should you wonder how we do find unix commands suitable for a task, well here is the answer:

you enter man -k or apropos pdf in a terminal window, for instance, to find commands that does something with pdf, and so on. from there on you enter man «the command you wondered about». With the apropos or man -k command, the section of the manual where a command is described is often specified as a number within parenthesis. You should be interested in commands that appears in section 1 and 8, as that is the sections for user commands and administrative commands.

You can try man -s 1 pdfseparate, (-s1 tells what section to look in).


I have this little snippet for you that may be handy, should you want to script Skim, (though there should be numerous examples to find here, and elsewhere.)

tell application "Skim"
	tell its front document
		set a to (get its properties)
		tell current page
			set b to its properties
		end tell
	end tell
end tell
log a
log b

Räksmörgås to you McUsrII! :wink:

McItsUsrItsII :wink:


I know, I actully had that conversation in mind when I wrote it, but here I thought it was in its place for educational purposes. It clearify the relationship between the properties and It actually connect the dots. (Pun intended). :slight_smile: Though I haven’t been totally concise as it lack one its here, in front of current page.

Educational purpose is supposed to be as simple as possible and not as complicated as possible.
The hierarchy chain is clearly indicated by the line indent

btw : if not its what else ? :wink:


I admit to not thinking of the indentation as signifying the levels of scope. :slight_smile: Still, I think the “properties are objects that may have other properties paradigm” is a good one, when one isn’t that fluent with AppleScript.

I agree wholeheartedly to your positition on a general basis; that as less wordyness and englishness you put into AppleScript the better it is. That is: the less Englishness, the lesser the ambiguities. :slight_smile:

I don’t fully understand what you meant with your question at the end but I would answer:

set b to current page's properties


I got what you meant by your final question, to you, and me, the scope is obvious, but the scope is indeed an implicit entity, and that is why I used its in the first place. (I could also used possessive form) This is really more of a feature of AppleScript, than not, and is the most usable of the “superfluos” words like the. Especially for people not that used to programming, and the way things work, with respect to scope and such.