Unzoom 'Spotlighted' PDFs

As many of you know by now, I have some issues with the way Spotlight “version 1.0” works. A recent hint on macosxhints.com reminded me of yet another quirk in Spotlight; one that I didn’t even mention in the original write-up.

Assume you’re looking for a PDF with a certain phrase in it—for example, recently I looked for a story I wrote last year that talked about Unix maintenance scripts . When Spotlight finds your document, you can open it in the default PDF viewer by simply clicking on the document’s name in Spotlight’s results list. On my Mac, Preview is my default PDF viewer, as it opens more quickly than Adobe Acrobat Reader or the Acrobat Professional.

Click your results and the document opens in Preview with your search term highlighted, which is quite useful. (Note that you’ll only see the highlighting if your exact phrase exists in the body of the document, or if you searched for only one word—Spotlight won’t highlight matches otherwise.) But here’s the annoying part—unfortunately, Preview is set to a ridiculously high level of zoom around your highlighted term. Sure, you can see see the matched search terms very well, but not a whole lot else. For instance, here’s the default view of the PDF I found with my search terms above:


Holy zoom, Batman! Look at that magnification! While I appreciate Apple’s desire to show me that Spotlight has, in fact, matched my search terms, this is a bit much. The zoom level is so high that there’s not a ton of context—the document has scrolled slightly to the right (“REVENT” instead of “PREVENT”), I can’t even see the full width of the text block, nor can I see how this block relates to the rest of the document.

Thankfully, some enterprising individual discovered the secret to toning this down—a key in Preview’s preference (.plist) file called PVPDFSpotlightSelectionSize controls the zoom level. By default, this value is set to 28, or a 280 percent zoom. That’s the bad news. The good news is that, since it’s a preference value, it’s easily changed. If you’ve installed Apple’s Developer Tools from the OS X installation CD, you can modify this value using the utility Property List Editor (/Developer/Applications/Utilities). However, since today’s a “virtual Geeky Friday,” given the Thanksgiving holiday, I’m just going to share the fastest, easiest, and yet most geeky method of changing this value—using Terminal.

First, make sure Preview isn’t running; the changes you’re going to make won’t stick if it is. Next, go to the Applications: Utilities folder, and double-click Terminal. When it launches, copy and paste the following, and press Return when done:

defaults write com.apple.Preview Preview -dict-add PVPDFSpotlightSelectionSize 10

What you’ve just done is changed the value of the zoom-controlling key from 28 to 10, or 100 percent (actual size). You won’t see any output in the Terminal, other than another prompt line appearing, but don’t worry—something’s changed. To prove it, just open up another PDF via Spotlight and take a look at the results. Here’s what I saw for the same search as before, but with the zoom at 100% (keep in mind these images have been reduced for display here; it was easily readable at actual size on my screen):


Now I can not only see my highlighted text, I can see where it lies in relation to the rest of the page. I can also get a better sense of exactly which document I’m looking at, since I can see the full page.

If 100 percent is too small for your eyes, you can use (almost) whatever value you’d like. Just remember to quit Preview first, and remember that you enter a decimal, not a percentage. For instance, to set the zoom to 125 percent, you’d use a value of 12.5; for 150 percent, it would be 15. Unfortunately, it doesn’t seem possible to set the zoom below 100 percent; any values below 10 in the preferences file result in a zoom level set to 100 percent. To put things back to the default, set the value to 28.

With this simple change, I’m now much happier with Spotlight-opened PDFs—I can read what I found, and see the item’s context relative to the rest of the document.

Shop Tech Products at Amazon