Applescript to save the foremost window in Safari as a PDF. Uses the window’s title for the file name, saves to ~/Desktop
Sponsored Links:
Save Current Safari Window as PDF
Update
See also: Improved Mail PDF from Safari Script for Mac OS X
Uses GUI Scripting, so might not work in future versions of Mac OS X or Safari (Developed with Mac OS X 10.4.8, Safari 2.0.4 (419.3))
tell application "Safari" activate set theWindow to the first item in windows -- set theTitle to the title of theWindow set theTitle to name of theWindow my p(theWindow, theTitle) end tellon p(winObj, theTitle) tell application "Safari" if get miniaturized of winObj = true then set miniaturized of winObj to false set index of winObj to 1 end if tell application "System Events" tell process "Safari" keystroke "p" using {command down} delay 1 keystroke "d" using {command down} keystroke tab keystroke tab keystroke tab keystroke tab keystroke tab keystroke (ASCII character 31) keystroke (ASCII character 31) keystroke return keystroke theTitle keystroke "s" using {command down} end tell end tell end tell end p