printing - Applescript: print first or other specific pages -


how can instruct application or printer print first page, page range or odd or pages of file? attempt of preview app, looks promising:

set thefile "[file-path/file]"" tell application "preview" activate print thefile properties {target printer:"printer", ending page:1} without «class pdlg» --these properties isn't available printer app, here limiting amount of printed pages quit end tell 

but i'm bitten sandboxd process tells me file can't opened printing , deny file-read-data result in log.

in cups suggestion adamh encounter issues umlauts , have other execution issues well, possibly because of sandbox rules. code works command line, not when called in automated fashion.

i tried useful examples of print command in reference, in books , tried searching online apple references, can't seem find many examples fitting present day situation sandbox, if any.

you script printing command line tool lp & lpr. these talk cups, common unix printing system

to target pages / ranges:

lp -o page-ranges=2-4 "my_great_document.pdf" 

to call applescript use do shell script

e.g,

do shell script "lp -o page-ranges=2-4 'my_great_document.pdf'" 

for more ideas see: http://www.cups.org/documentation.php/options.html


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -