Hi. I would like to print PDF without opening the file, but with print options. Any idea?
Thanks in advance.
Hi. I would like to print PDF without opening the file, but with print options. Any idea?
Thanks in advance.
Hi,
printing from where?
If you’re talking to an application via AppleScript to print a file it’s not possible to print the file without opening it
printing from Terminal or AppleScript. Only one PDF file at a time with Print Options. the best would be not to display the PDF.
The UNIX command lpr can print files, you can specify print options with lpoptions
StefanK I know that, but I want that user see the Print Options dialog window. is it possible?
Actually no. You could display a couple of dialog boxes to let the user select the options
hm what about opening PDF in Apple Preview and select File->Print with AppleScript? I assume that there is no better solution.
The AppleScript support of Preview.app is very poor. You have to do this with GUI scripting
Can you help me with that? I would appreciate it a lot.
So…
Have you searched the OS X forum or Code Exchange for “Preview”? As far as I remember there are a few solutions
I’m searching for few minutes now… but still without any solution.
GUI scripting is not an option, bcs user need to enable assistive devices.
Any other solution?
The script may enable it if needed.
on activateGUIscripting()
(* to be sure than GUI scripting will be active *)
tell application "System Events"
if not (UI elements enabled) then set (UI elements enabled) to true
end tell
end activateGUIscripting
Example :
(*
Print selected pages in Preview
Yvan KOENIG (VALLAURIS, France)
2012/06/15
*)
my activateGUIscripting()
tell application "System Events" to tell application process "Preview"
set frontmost to true
(*
Trigger the Print menu item *)
click menu item -1 of menu 3 of menu bar 1
(*
Wait for the Print pane *)
repeat until sheet 1 of window 1 exists
--
end repeat
tell sheet 1 of window 1
(*
Click the radio button entitled "les pages sélectionnées dans la barre latérale" *)
tell radio group 4 to tell radio button 3
value
click
repeat
delay 0.1
if value = 1 then exit repeat
end repeat
end tell -- radio group.
(*
Click the button [ Print ] *)
click button 1
end tell -- sheet
end tell -- System Events
--=====
on activateGUIscripting()
(* to be sure than GUI scripting will be active *)
tell application "System Events"
if not (UI elements enabled) then set (UI elements enabled) to true
end tell
end activateGUIscripting
--=====
Yvan KOENIG (VALLAURIS, France) vendredi 15 juin 2012 18:25:32