Cory
Cory

Reputation: 2312

How to print CorePlot Graph

I'm trying to print an NSView which includes a couple coreplot piecharts among other items. However the piecharts do not appear. I now understand that layer backed views do not print, but I'm having difficultly locating any examples where people circumvented this and printed coreplot graphs within a NSView. What is the best approach for this?

Upvotes: 1

Views: 181

Answers (1)

Volker
Volker

Reputation: 4660

For me it worked as soon as I have set-up the printRect like:

NSRect printRect = NSZeroRect;
printRect.size.width  = (printInfo.paperSize.width - printInfo.leftMargin - printInfo.rightMargin) * printInfo.scalingFactor;
printRect.size.height = (printInfo.paperSize.height - printInfo.topMargin - printInfo.bottomMargin) * printInfo.scalingFactor;

self.hostingView.printRect = printRect;     
op = [NSPrintOperation printOperationWithView:self.hostingView printInfo:printInfo];

Note self.hostingViewrefers to the CorePlot hostingView.

Upvotes: 2

Related Questions