I’m filing this post under the Apple/Mac category, but it really could apply to any OS.  If you are experiencing issues with PDFs automatically printing when opened/viewed, read on…

When you create a Mac Word document with hyperlinks, the links don’t work when you save/export the doc as PDF.  This is a long standing (and incredibly frustrating) bug that exists with the current Mac versions of both Word 2011 and 2016.  It amazes me that Microsoft has let this issue go on so long.

So if you are a Mac Word user that needs to create PDFs with links, you have to use one of many workarounds including:

  • Opening the doc using the Windows version of Word (via a VM or remote desktop session) then export as PDF
  • Converting the doc to PDF using Google Docs
  • Converting the doc to PDF using an open source Office alternative like LibreOffice for Mac or Apache OpenOffice for OS X
  • Converting the doc to PDF using Word Online

I personally was using Word online (via Dropbox) to open my Word docs and print as PDF.  While this seemed to work fine, many Windows users reporting that my PDFs would automatically attempt to print when opened (or viewed in a browser).  Curiously this wasn’t happening all of the time, and wasn’t something I could reproduce on my Mac.

After researching this I found that my PDFs all had a javascript embedded in them that contained this code:

this.print(true)

This javascript was added by Word Online, and apparently causes any PDF viewer app or plugin that supports javascript to auto print when opened.

My fix was was to open my PDFs in Adobe Acrobat Pro, go to View->Tools->Javascript, click Document Javascripts, then highlight and delete the script named 0.  Notice in the screenshot below that 0 contains the code this.print(true).

Screen Shot 2016-07-15 at 10.17.53 AM

After saving, my PDFs no longer attempt to auto print.  I’m sure there are other ways to remove this javascript, and I’ll likely start using another workaround to create PDFs out of Word in the future, but thought I’d share this info to maybe help anyone else faced with this issue.