• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re:Printing to PDF from Safari
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:Printing to PDF from Safari


  • Subject: Re:Printing to PDF from Safari
  • From: johnnylundy <email@hidden>
  • Date: Wed, 9 Aug 2006 07:24:03 -0400

I did this recently and could only do it with GUI scripting, as the "PDF" button seems to be nonstandard.
"Enable access for Assistive Devices" must be checked in Universal Access.


The document opens in Preview.

You could put a "delay 1" before the last "activate" line if your script is stopping in Preview.



activate application "Safari"
tell application "System Events"
	tell process "Safari"
		keystroke "p" using command down
		repeat until exists sheet 1 of window 1
		end repeat
		click button 4 of UI element 4 of sheet 1 of window 1
	end tell
end tell
activate application "Safari"

Regards,

Johnny



On Aug 8, 2006, at 3:16 PM, email@hidden wrote:

Can someone explain to me how to script Safari to create a PDF from
the print dialog

I.e. I have the page opened in Safari, and I want to save the page as
a PDF using a script
as if I had entered command-P and clicked the PDF button and entered
a file name in the
save as PDF dialog.

Jim Brandt

_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: A little help with a folder cleanup script
  • Next by Date: Re: Applescript-users Digest, Vol 3, Issue 398
  • Previous by thread: Re: Printing to PDF from Safari
  • Next by thread: changing the font size when printing
  • Index(es):
    • Date
    • Thread