Goldenseal Pro Progress Report- Printing (Mar 27)

Tables are far enough along that we are now working on the remaining parts of the interface for Goldenseal Pro. The short-term goal is to finish enough to start using it for our own business.  Using ‘beta’ software is painful at times, but it’s the quickest way to test our new estimating and accounting software.

For big projects, we usually work on the hardest parts first, since they need the most time to learn, build and debug. Printing is the next most difficult task after tables, so we read Apple’s printing guide last Friday. Turns out that it only requires one line of code. We added it, clicked the Print button, and whoosh, a printed form came out! Here’s the code in all its glory:

[[NSPrintOperation printOperationWithView:[currentPrintController view]] runOperation];

The brackets mean it’s Objective-C, and the NS prefix is short for NextStep, first developed for Steve Job’s Next computer in the 1990s.

The current/old version of Goldenseal has hundreds of lines of C++ code for printing. It deals with margins, landscape vs portrait, different paper sizes, and many other trivial details. We spent months getting it to work right. When Apple updated to OS X, it took another month to update the printing, which still isn’t perfect. That printing code is so complex that every bug fix just broke something else.

In the previous post I complained about how complex NSTableView is, but NSPrintOperation and NSPrintInfo sure do it right. There’s setOrientation for landscape/portrait, and setTopMargin for the top margin, etc. It even does pagination, which saves 100+ lines of code right there.

Both of the project estimates for Goldenseal Pro figured a month apiece for printing on Mac and Windows. At least on the Mac, it will take much less time than that. Estimates that go under budget are always very pleasant!

One thing different in Goldenseal Pro is that we show a Print Preview window right at the beginning. That way you know exactly what you’re getting, before you print a form. As a bonus, the new interface helps us to debug the appearance without printing reams of paper. We couldn’t do it that way in the original Goldenseal, simply because processors were too slow back then. The several-second delay would have been too annoying.  Now, it’s just milliseconds.

Dennis Kolva
Programming Director


Author: Dennis Kolva

Programming Director for Turtle Creek Software. Design & planning of accounting and estimating software.