You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How do I make Preview open in the center of the screen everytime

How to control where Preview opens PDF documents? Thanks.


iMac 27″, macOS 11.3

Posted on May 28, 2021 10:57 AM

Reply
Question marked as Top-ranking reply

Posted on May 28, 2021 12:01 PM

Preview has no configuration to redefine its opening location. But you can encourage it to position to the center of your screen…


You can use the following AppleScript after Preview has been opened with a document to shift the Preview window to the center of your screen. Compile the AppleScript as an application and drop it in the Dock where you click once to reposition the Preview window.


-- Automatically determine screen size, and center Preview appplication screen in
-- center of display.
-- Influenced by: https://apple.stackexchange.com/questions/9632/center-window-on-screen
-- VikingOSX, 2020-02-11, Apple Support Communities, No Warranties implied or otherwise.

tell application "Preview" to activate
tell application "Finder" to set {sw, sh} to {item 3, item 4} of (bounds of window of desktop as list)

if application "Preview" is running then
	# tell application "Finder" to set visible of process "Preview" to false
	tell application "Preview"
		tell its front window
			set winsize to (bounds of it) as list
		end tell
	end tell
	
	tell application "Finder" to set the position of application process "Preview"'s front window to {¬
		round ((sw - ((item 3 of winsize) - (item 1 of winsize))) / 2) rounding as taught in school, ¬
		round ((sh - ((item 4 of winsize) - (item 2 of winsize))) / 2) rounding as taught in school, ¬
		round ((sw + ((item 3 of winsize) - (item 1 of winsize))) / 2) rounding as taught in school, ¬
		round ((sh + ((item 4 of winsize) - (item 2 of winsize))) / 2) rounding as taught in school}
	activate application "Preview"
end if
return



The first time you invoke the compiled AppleScript from the Dock, you will be greeted by no less than five security prompts in Big Sur (and probably Catalina too). This is a crock… and fortunately, it is once:



Click the OK button, open System Preferences, unlock the Security & Privacy panel, Accessibility will likely be selected, and you select the name of your compiled application (e.g. preview_move_window) to grant permission and click OK on the final dialog.


The next time you launch Preview, you can click on the application in the Dock and move the Preview window dead center screen.

3 replies
Question marked as Top-ranking reply

May 28, 2021 12:01 PM in response to JohnnyDeLuxe

Preview has no configuration to redefine its opening location. But you can encourage it to position to the center of your screen…


You can use the following AppleScript after Preview has been opened with a document to shift the Preview window to the center of your screen. Compile the AppleScript as an application and drop it in the Dock where you click once to reposition the Preview window.


-- Automatically determine screen size, and center Preview appplication screen in
-- center of display.
-- Influenced by: https://apple.stackexchange.com/questions/9632/center-window-on-screen
-- VikingOSX, 2020-02-11, Apple Support Communities, No Warranties implied or otherwise.

tell application "Preview" to activate
tell application "Finder" to set {sw, sh} to {item 3, item 4} of (bounds of window of desktop as list)

if application "Preview" is running then
	# tell application "Finder" to set visible of process "Preview" to false
	tell application "Preview"
		tell its front window
			set winsize to (bounds of it) as list
		end tell
	end tell
	
	tell application "Finder" to set the position of application process "Preview"'s front window to {¬
		round ((sw - ((item 3 of winsize) - (item 1 of winsize))) / 2) rounding as taught in school, ¬
		round ((sh - ((item 4 of winsize) - (item 2 of winsize))) / 2) rounding as taught in school, ¬
		round ((sw + ((item 3 of winsize) - (item 1 of winsize))) / 2) rounding as taught in school, ¬
		round ((sh + ((item 4 of winsize) - (item 2 of winsize))) / 2) rounding as taught in school}
	activate application "Preview"
end if
return



The first time you invoke the compiled AppleScript from the Dock, you will be greeted by no less than five security prompts in Big Sur (and probably Catalina too). This is a crock… and fortunately, it is once:



Click the OK button, open System Preferences, unlock the Security & Privacy panel, Accessibility will likely be selected, and you select the name of your compiled application (e.g. preview_move_window) to grant permission and click OK on the final dialog.


The next time you launch Preview, you can click on the application in the Dock and move the Preview window dead center screen.

How do I make Preview open in the center of the screen everytime

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.