On Aug 6, 2008, at 11:37 AM, Paul Archibald wrote:
It looks like PDFKit is aimed at simply reading and navigating within an existing PDF file, but what I need to do is create a new PDF and write some simple text to it.

Sorry, I had to jump in and refute that — PDF Kit does allow PDF content creation, but it may not be so obvious looking at the API.

Subclassing PDFPage is a way to do this. Subclass and implement - [boundsForBox:] and -[drawWithBox:] and you're there. You report back the size of the PDF page in -[boundsForBox:] (in points where 72 == 1 inch) and you draw your text in the -[drawWithBox:] method.

You create an empty PDFDocument (alloc, init) and add your subclassed PDFPage to the document.


On Aug 6, 2008, at 11:42 AM, Charles Steinman wrote:
Easiest way: Create a view that draws what you want, send it - dataWithPDFInsideRect: and write that data to a file.

Charles is correct. And it is easiest. The PDF Kit method I outlined above gives you slightly more control over the resulting PDF (you can for example add metadata, multiple pages, differing crop/media boxes, etc.).

John Calhoun—_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to