For some reason when I press CMD + P or go to File>Print in Google Doc's instead of printing, the document is downloaded as a PDF. I then have to navigate to my downloads folder, open the PDF, and print it through Preview.

This only occurs in Safari. If I press CMD + P or File>Print in Chrome, the Chrome print dialog box comes up immediately and I am able to print directly from Chrome.

How can I get the print dialog to popup directly in Safari? Or if that can't be done is there a way to automatically identify that a document has been downloaded from Google Docs and print it? Maybe with an Apple Script?

1 Answer 1


I have not found a way to get the print dialog box to appear in Safari. Instead I have created a script that will check when something is downloaded and see if it is from Google Docs. If it is then the document will be opened in Preview with the print dialog box. Basically giving you similar functionality you have in Chrome. You can then print it as you normally would.

Here's the script. Save it to /Library/Scripts/Folder Actions Scripts/:

on adding folder items to this_folder after receiving added_items
    repeat with i in added_items
        set myPath to the POSIX path of i
        if myPath ends with ".pdf" then
            set myLocation to (do shell script "mdls -name kMDItemWhereFroms " & the quoted form of myPath)
            if myLocation contains ".google.com" then
                tell application "Preview"
                    print i with print dialog
                end tell
            end if
        end if
    end repeat
end adding folder items to

The script will need to be added as a Folder Action. Follow instructions below:

  1. Navigate to the Downloads folder

  2. Right click on the Downloads folder and select Services>Folder Actions Setup

  1. Select the script that saved and click Attach

  2. Make sure Enable Folder Actions is checked in the upper left

  3. Test a Google Doc

  • Two small suggestions: I would first check the file extension of each file before using do shell script. As the majority of files downloaded won't be PDFs, this provides an easy way to terminate the folder action script without the needless overhead of a shell process and an mdls call. For example, if (myPath ends with ".pdf") and (do shell script ...) contains "google.com" then.... Also, quoted form of myPath is safer than simply inserting quotes either side of it: if, for example, myPath contained quotes, your current expression would be problematic.
    – CJK
    Commented Jun 14, 2018 at 17:02
  • @CJK Great suggestions! Edited answer. Commented Jun 14, 2018 at 17:14
  • As you set myPath to its quoted form, the condition if myPath ends with ".pdf" will never be true. Perhaps revert set myPath to the POSIX path of i, and then set myLocation to do shell script "mdls -name kMDItemWhereFroms " & myPath's quoted form. 🙂
    – CJK
    Commented Jun 14, 2018 at 17:30
  • 1
    Have to vote up: for neat and attitude
    – Solar Mike
    Commented Jun 14, 2018 at 17:48
  • 1
    I just realised that you asked and answered your own question post. I have to +1 this effort too, for coming back when you had found a solution and providing a detailed workaround for others to benefit from. Thanks!
    – CJK
    Commented Jun 16, 2018 at 7:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .