Printing NSTextView puts text in middle of page


tridiak
 

Printing a NSTextView centres the text (if it is less than one page in size) vertically in the page, as opposed to the top.
What do you need to do to fix this?

let tv = NSTextView()
tv.textStorage?.append(ats)


var npo = NSPrintOperation.init(view: tv);
tv.frame.size.width = (sampleViewScroll.documentView?.frame.size.width)!;
tv.frame.size.height = 20000; // or some large number
npo.run();

The attributed text (ats) is valid (displayed in a visible NSTextView).

Do I need to calculate the size of the text and set the margins?
Or is there a justification setting I am missing?

TIA
Mark

Join cocoa@apple-dev.groups.io to automatically receive all group messages.