Re: Convert PDF CGContextRef to NSView for hi-res printing
Re: Convert PDF CGContextRef to NSView for hi-res printing
- Subject: Re: Convert PDF CGContextRef to NSView for hi-res printing
- From: Wim Lewis <email@hidden>
- Date: Mon, 05 Mar 2012 14:21:30 -0800
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 (email@hidden)
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:
This email sent to email@hidden