Wim and Graham, Thanks for your quick reply…I finally found out how to print vector based graphs thanks to Wim's answer:
I created a NSView based class which draws then (via drawRect:) the Coreplot graphs with my custom made method renderGraphsInContext: It works wonderfully. Cheers, Gilles On Mar 5, 2012, at 11:21 PM, Wim Lewis wrote: > > On 5 Mar 2012, at 12:13 PM, Gilles Celli wrote: >> I'm stuck on a problem on how to print high resolution graphs on Mac OS X, >> by using the wonderful CorePlot (1) framework. >> I've asked on the Coreplot mailing list but no answer...maybe it's too >> obvious that I don't see the tree in the forest: >> >> My method produces a CGContextRef (with CGPDFContextCreate) which then >> writes the drawing / plotting as a PDF. >> This works great: The written PDF file doesn't have any jaggies since it is >> vector based. [...] So is it possible to print directly a PDF based >> CGContextRef ? > > I haven't looked at CorePlot, but from the -exportActiveGraphsToPDF: > implementation, it looks like you could print vector PDF by getting the > CGContextRef corresponding to the current NSGraphicsContext: > > NSGraphicsContext *nsContext = [NSGraphicsContext currentContext]; > [self renderGraphsInContext:[nsContext graphicsPort]]; > > If this is in the -drawRect: method that is called during printing, then > [NSGraphicsContext currentContext] will be the graphics context that is > writing PDF to the print file, and -renderGraphsInContext: can emit vector > output without any extra conversions. > > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com