You enact this feature by executing command-P (or File > Print), pulling down the combo box in the lower left of the print dialog, and choosing Save PDF to Web Receipts Folder. This automatically saves a PDF file directly to your ~/Documents/Web Receipts folder. How cool is that!
In Mac OS 10.5 and 10.6, this is now a python script that you can customize. Below I show how to modify this file to change the default save location and prepend the date to the resulting filename.
- Navigate to /Library/PDF Services/Save PDF to Web Receipts Folder.pdfworkflow/Contents.
- Edit the file tool. It doesn't look like you need to be root to do this, but if you do use sudo -s from the command line.
- Towards the top of the file add another import statement import datetime
- In main modify destDirectory to be your desired save folder location. I used:
destDirectory = os.path.expanduser("~/PDFDocs/Receipts/") - Modify these lines from:
title = safeFilename(title)
destFile = title + ".pdf"
to:
title = safeFilename(title)
# Create a YYYYMMDD string
today = datetime.datetime.now().strftime("%Y%m%d_")
destFile = today + title + ".pdf" - Presto, you are done! At least until a major software update clobbers this file. Which is why I wrote this blog entry: to remind me how to do this again the next time.
No comments:
Post a Comment