• 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: PDFKit guidance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PDFKit guidance


  • Subject: Re: PDFKit guidance
  • From: "Adam R. Maxwell" <email@hidden>
  • Date: Sat, 21 Jun 2008 18:34:45 -0700


On Jun 20, 2008, at 12:53 PM, John Calhoun wrote:


On Jun 20, 2008, at 5:21 AM, Adam R. Maxwell wrote:
If you want to draw in memory, I think you have to drop down to Quartz; using PDFKit would likely be easier, but it looks like you can only specify a Quartz filter when saving to a file?.

I think there may be some confusion with regards to drawing....

Antonio is correct that PDFPage has a -[drawWithBox:] method that is used not simply for displaying to screen but also for rendering into a PDF context for saving to file as well. So, you can still use PDFPage, override -[drawWithBox:] in an app that has no intention of displaying the PDF to screen.

The saving method is in PDFDocument. When called it walks through each PDFPage in the document and calls it to render into a PDF context. (Printing within PDF Kit does something similar, BTW.) Optionally too, you can pass a QuartzFilter to the save method in PDFDocument and get, for example, grayscale output.

You can also do something similar in Quartz with CGPDFDocumentRefs and CGPDFPageRefs. The QuartzFilter stuff should work for CGContexts as well.

There is I think a perception that PDF Kit is only for displaying PDF's and I like to try to dispell that when I can. :-)

I appreciated Antonio's (and your) reminder :). If I understand correctly, the OP could create a PDF context with kCGPDFXDestinationOutputProfile set to a grayscale profile, set it as the current context with [NSGraphicsContext setCurrentContext:], then draw each PDFPage into it. Would you still have to use CGContextBeginPage/CGContextEndPage in that case, or is there an easier way to draw all pages of a PDFDocument into a given context? There's an obvious advantage in using PDFKit if you're saving to disk, but I'm curious to know if there's a distinct advantage in using it to draw to memory. Subclassing PDFPage apparently requires 10.5, also, unless I'm missing something.


thanks,
adam
_______________________________________________

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: PDFKit guidance
      • From: John Calhoun <email@hidden>
References: 
 >Re: PDFKit guidance (From: Joel Norvell <email@hidden>)
 >Re: PDFKit guidance (From: Torsten Curdt <email@hidden>)
 >Re: PDFKit guidance (From: Antonio Nunes <email@hidden>)
 >Re: PDFKit guidance (From: Torsten Curdt <email@hidden>)
 >Re: PDFKit guidance (From: "Adam R. Maxwell" <email@hidden>)
 >Re: PDFKit guidance (From: John Calhoun <email@hidden>)

  • Prev by Date: Re: How to hide the divider in a collapsed NSSplitView pane
  • Next by Date: Re: How to hide the divider in a collapsed NSSplitView pane
  • Previous by thread: Re: PDFKit guidance
  • Next by thread: Re: PDFKit guidance
  • Index(es):
    • Date
    • Thread