Saving Web Receipts Files on Mac OS X

Mac OS X has a handy feature that allows you to, via the print dialog, save PDF files directly to a web receipts folder. This is particularly useful when making online purchases in a browser.

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.

  1. Navigate to /Library/PDF Services/Save PDF to Web Receipts Folder.pdfworkflow/Contents.
  2. 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.
  3. Towards the top of the file add another import statement import datetime
  4. In main modify destDirectory to be your desired save folder location. I used:
    destDirectory = os.path.expanduser(“~/PDFDocs/Receipts/”)
  5. 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”
  6. 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.

Comments