• 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: Graham Cox <email@hidden>
  • Date: Tue, 06 Mar 2012 09:12:28 +1100

On 06/03/2012, at 7:13 AM, Gilles Celli wrote:

> Hi,
>
> 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.
>
> However if I want print the graphs via the Printer Panel, I need first to create a bitmap-based NSImageView as far as I understand,
> so the prints never seem to be vector based, there will always be jaggies in the plots and text.

Your understanding is definitely wrong.

You need a view to cooperate with the print subsystem, but it doesn't have to be NSImageView, and usually is not. Ultimately, the print system ends up calling the view's -dataWithPDFInsideRect: method. If you override that method to return your PDF data, you're done. Of course there will be other things to consider, such as pagination, so that approach might be too simplistic, but might give you a starting point. Printing is entirely built around PDF, so there is no reason to accept bitmaps, jaggies or any other artefact of rasterization.

--Graham



_______________________________________________

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


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

  • Prev by Date: Re: Releasing WSMethodInvocationInvoke()
  • Next by Date: Re: NSURLRequests and Firewalls
  • Previous by thread: 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