print to PDF

I’m trying to get all open documents in TextEdit to print to PDF and be saved in a folder with their original filenames. So far I’ve got:

tell application “TextEdit”
set numberOfDocuments to (count documents)
repeat numberOfDocuments times
print front document with properties {color syntax:true, printing font:“Courier”, printing font size:10, printing tab width:4, printing font style:{plain}, time stamp:printing date, «class OSel»:false, starting page:1, ending page:2.147483647E+9, copies:1, collating:true} without print dialog
close active document of window 1
end repeat
end tell

It’s doing something, but I don’t know how to get it to save the PDF files.

Either you can try to GUI script the print dialog to click print to pdf or if you’re very adventurous, you can try to create a “virtual pdf printer” so when you want pdfs, you select it as your printer.

Instructions are here