Giving Skim an ability it should already have

I like Skim, an OS X PDF reader, enough to have listed it in my software recommendations. Skim is based on Apple’s PDFKit, just as Apple’s Preview application is. It offers a bunch of note-taking abilities as well, but I don’t use those. The main reason I use Skim over Preview is exactly one feature: in “two page” mode, Skim offers control over treating the first page as a “cover page” and Preview doesn’t. Skim calls this “book mode”.

I read a lot of roleplaying PDFs. Most of these are created using “facing pages”, where there is a clear right and left in the layout. When you read a PDF in two page mode, you want the right page to be on the right and the left on the left. Here is an example, from the Eclipse Phase rulebook:

Two page correct

This particular document has a coverpage, so the above image shows the display of a two-page layout in book mode. If I turn book mode off, I get this:

Two page incorrect

On the other hand, there are many similar roleplaying PDFs that are formatted with more “cover” pages, such that their layouts look correct when book mode is off and incorrect when it is on.

So, Skim can handle all this and Preview can’t. Great. But, while Skim allows you to set a global option for, say “Two Page layout, Book mode on”, it as no facility to remember what settings you selected for a particular document and restore them when you open it. So, I’m constantly readjusting the book mode setting every time I open something. (And, since some rpg documents are built to be single landscape pages, I often have to change two page to single page and back as well.)

Skim does have a feature that remembers what page a document was on, and restores that when you open it, but this fails in two page cases. For example, suppose my global default is “Two Page, Book mode off”. When I open the document pictured above, the layout is off, so I have to turn book mode on. Once done, I move to a particular page (171 in this case) and it looks good:

Two page correct

But, if I turn on the “remember what page I was on” setting, then close this document, when I reopen it, it opens using my global defaults so shows me this:

Two page incorrect

In a tight technical sense, you might consider that the “remember what page I was on” actually worked, but clearly the result was not what I intended. I was viewing pages 170-171 when I closed the document, why did it reopen the document to pages 171-172? The reason is pretty obviously because it does not remember the layout context along with the page.

So, I submitted a feature request to the Skim team to add an option to remember the layout and book mode. Given the existence of the “remember my page” feature, surely building something like this would be trivial. Within about four hours, this bug had been summarily closed, unimplemented, by one of the developers, who gave the following message (in its entirety):

This is not consistent with the current behavior, and not an improvement over it, because it is not consistent with the nature of PDF documents. This was rejected long ago, so I won’t go (again) into more details.

Hmmm. In only two dismissive sentences, this developer managed to sour me on Skim as a whole. Not even a link to this, apparently tortuous, past discussion of the idea. Something.

(I should also mention something else here. When PDFs are created in Acrobat, they can be given properties that instruct a viewer what layout and “book view” to give them on opening. Skim ignores these settings. I submitted a feature request to support these as well. This request was also summarily closed, though for a slightly more legitimate reason: PDFKit apparently doesn’t make those settings visible. On the other hand, its a PDF, not Sanscrit; you could read those settings yourself…)

Anyway, once upon a time, when a developer told you to piss off that was the end of it. Fortunately, Skim is open source. So…

This diff file contains a hack that, when the “remember my page” option is turned on, instructs Skim to remember the book mode and display choice in the same place as the page number (in ~/Library/Preferences/net.sourceforge.skim-app.skim.bookmarks.plist) and restore it next time the file is opened. It seems to work OK in my limited testing.

Having never seen the code before, it took me about 90 minutes to hack the code in this way, which means that someone who actually knows the product likely could have done it (and done it more correctly) in about 15. (For comparison, writing this post took about twice as long.) Normally, I would submit this hack as a patch to the project, but it is pretty clear they are not interested in it. Hopefully it will help you.