Search code examples
macospdfosx-mavericksnsscrollviewnsprintoperation

NSScrollView printing inverted on OSX Mavericks


I have a Mac app that has been on the app store for a few years. It's a time tracking and invoicing app that creates a PDF for the invoice. The PDF is generated from the content of a window in the app that contains the invoice information. Before OSX Mavericks the PDF printed just as it looked like on screen. Unfortunately in Mavericks, the NSScrollView that I am using for the table is printing horizontally inverted.

PDF as it should look, and how it looked on OSX Lion and Mountain Lion:

PDF as it should look, and how it looked on OSX Mountain Lion

PDF as it prints out on Mavericks:

PDF as it prints out on Mavericks

When I searched the Google for this problem I did find another person experiencing what seems to be the same problem.

The NSScrollView is nothing fancy, just an NSScrollView with an NSClipView as its contentView, and an NSTableView inside of that.

IB layout for invoice window

I'm really hoping that this is a problem that can be fixed, and not just a bug introduced by Mavericks when printing NSScrollViews. Thanks for any help!


Solution

  • Well, I wouldn't say I found a fix for this, but I was able to make this work normally again. I accidentally found that if I put another identical table in the same view hierarchy as the existing one and hid the new table, the first one would print correctly. Don't ask me why it works, because it feels like some serious cargo-culting, but it made the table inversion go away. I hate these kinds of "fixes".