Last Updated: February 25, 2016
·
979
· insomniacsoftware

Display a PDF zoomed full screen, 2 pages

When I open a PDF with Preview, the default setting is in a small, continuous scrolling window. I read a lot of user manuals and this is not a good way to present them.

I have a 27" Thunderbolt display so I prefer to have the PDF set to show the Table of Contents, 2 pages at the same time, and zoomed out to full screen

It isn't possible (that I've been able to figure out) to change the default settings of Preview when opening a PDF. Previously I had to choose 3 menu items to set my preferred viewing format. Instead, I made an Applescript to do it for me.

Installation

Copy/Paste the following into Applescript Editor and save it (as a script) into your ~/Library/Scripts folder.

clickMenuItem("Preview", "View", "Table of Contents")
clickMenuItem("Preview", "View", "Two Pages")
clickMenuItem("Preview", "Go", "Down")
clickMenuItem("Preview", "Window", "Zoom")
clickMenuItem("Preview", "Go", "Up")

on clickMenuItem(applicationName, menuBarItem, menuItem)
  try
    tell application applicationName to activate
    tell application "System Events"
      tell process applicationName
        tell menu bar 1
          tell menu bar item menuBarItem
            tell menu menuBarItem
              click menu item menuItem
            end tell
          end tell
        end tell
      end tell
    end tell
    return true
  on error error_message
    return false
  end try
end clickMenuItem

Configuration

In the Applescript Editor > General Preferences screen, enable the 'Show Script menu in menu bar' checkbox.

Execution

Select the script from the Script menu in the System Status menu bar (right-hand side)

Notes

I made the script to be very generic so it can be used with any application/menu. Simply change the top clickMenuItem entries to call the application and menu you wish

If the menu you want to select is a submenu, you will need to include the following to the script.

on clickSubMenuItem(applicationName, menuBarItem, menuItem, subMenuItem)
  try
    tell application applicationName to activate
    tell application "System Events"
      tell process applicationName
        tell menu bar 1
          tell menu bar item menuBarItem
            tell menu menuBarItem
              tell menu item menuItem
                tell menu menuItem
                  click menu item subMenuItem
                end tell
              end tell
            end tell
          end tell
        end tell
      end tell
    end tell
    return true
  on error error_message
    return false
  end try
end clickSubMenuItem

Sample usage

...
clickMenuItem("Preview", "Go", "Up")
clickSubMenuItem("Preview","Edit","Spelling and Grammer","Show Spelling and Grammer")

I hope you find this as useful as I do.