• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Convert PDF CGContextRef to NSView for hi-res printing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Convert PDF CGContextRef to NSView for hi-res printing
      • From: Gilles Celli <email@hidden>
References: 
 >Convert PDF CGContextRef to NSView for hi-res printing (From: Gilles Celli <email@hidden>)

  • Prev by Date: Re: NSURLRequests and Firewalls
  • Next by Date: Re: How are views supposed to reload after being nillified by memory warnings?
  • Previous by thread: Re: Convert PDF CGContextRef to NSView for hi-res printing
  • Next by thread: Re: Convert PDF CGContextRef to NSView for hi-res printing
  • Index(es):
    • Date
    • Thread