Searching PDF documents: a new feature in Podofyllin

One of the most popular features in PDF readers, Find (or Search if you prefer) isn’t built into the macOS PDFKit. This is odd, because its sibling for rich text, TextKit, does have good readymade support for Find. But look in PDFKit, and although some of the supporting features are there, it’s as if the engineering team had to suddenly rush off to do something different before it could be completed.

It’s even worse than that, of course, because TextKit doesn’t have one Find system but two: one working from a small bar at the top of the window, the other from a Find window with more extensive controls. When discussing their merits recently, I think we all agreed that the window was a superior solution for most users, although for quick and simple searches, a Find bar is unobtrusive and efficient.

When I started to implement a proper Find window for my PDF reader Podofyllin, I realised that it had a problem. With four different views in the same window – thumbnail, PDF, text, and outline (contents to come in a future release) – of which the text view already has a Find window, adding another Find window for PDF was going to result in a confusing mess.

In this case, notwithstanding the fact that a separate Find window is generally preferable, a Find bar looks and works better. To achieve that, it has some bells and a whistle or two.

As you type your search term into its field (which grows when you enlarge the window), live search finds the first matching word character by character. This often means that you don’t have to type in the whole word to get good hits. Press Return when you’re happy that the term is specific enough, and it will be added to this drop-down menu of recent searches, for ready access later.

podofyllin18

You also have two options, to search with case sensitivity, or literally, in which every character must match exactly.

Once the first hit is selected, move forward to the next using ⌘], or move back with ⌘[. If you’ve already selected the characters in the PDF which you wish to use as a search term, press ⇧⌘F (Shift-Command-F) and that will become the next term for the search, and its first hit will be selected for you already.

The only feature that this doesn’t support is the use of regular expressions.

One final advantage over a Find window is that of gaining focus. With two different search systems active, which takes precedence depends on whether the PDF or Text view is in focus (active). The moment that you click to use the PDF search, it brings that into focus, so it then gets on with the job.

podofyllin19

I hope that you find this a valuable feature in this new version of Podofyllin. It also gives you a glimpse of where it’s going next: when you have a PDF document open, using the new command Open Source (pun intentional) in the Window menu opens a window in which some of the internal data of the PDF are displayed. I’m now working on parsing the contents to give you insight into what your documents contain.

Podofyllin version 1.0b4 is now available from here: podofyllin10b4
and from Downloads above.