print webpage to pdf

Hi, how can i open a url, and create a PDF or JPG of the page with the file name being the current date? I’m basically going to use it to take a snapshot of my site every day.

Thanks a lot!

Hi There,
The script below requires cups-pdf to be installed. It prints your web page to a virtual printer which produces a PDF in a folder on your desktop. If this does what you want then we can work on dating the PDF file name.

tell application "Finder"
	if name of processes contains "Safari" then --> If Safari is open then close any open docs
		tell application "Safari"
			activate
			close every document
		end tell
	end if
end tell

tell application "Printer Setup Utility"
	set Current_Printer to name of current printer --> set a variable for the name of your current/default printer
	set current printer to printer "Virtual Printer"
end tell

set my_URL to "http://bbs.applescript.net/viewtopic.php?id=23217"

tell application "Safari"
	activate
	make new document with properties {URL:my_URL}
end tell

delay 10 --> wait for page to load

tell application "Safari"
	print document 1
	close every document
end tell

tell application "Printer Setup Utility"
	set current printer to printer Current_Printer --> restore your current/default printer
end tell

Thanks,
Nik