Re: Generating PDFs....
Re: Generating PDFs....
- Subject: Re: Generating PDFs....
- From: Scott Thompson <email@hidden>
- Date: Wed, 29 Jun 2005 08:39:23 -0500
On Jun 28, 2005, at 11:40 PM, Dave DeLong wrote:
Forgive me if this has been beaten over the head before...
I'm looking for a way to generate PDFs. I've got a whole bunch of
NSAttributedStrings that I need to schlep out to a PDF, and I have
no clue how to do it. I've searched the documentation and found a
whole bunch of stuff about PDF Annotations, but (I think) that's
not what I need. I've also done a bit of Googling, but have been
unable to find some answers.
Ideally what I'm looking for would be an example project of how to
create a PDF in general (including drawing text etc) that I could
work off of.
Any pointers?
One easy way to do it is to create a view that you draw the strings
into and then call:
- (NSData *)dataWithPDFInsideRect:(NSRect)rect;
This will ask your view to draw it's contents into a PDF that you can
then save to disk.
A slightly more complicated version would involve creating a
CGPDFContext directly and then drawing the strings into that PDF
context. This is a bit more challenging since Core Graphics, as a
general rule, is not the friendliest environment for drawing text.
You'd probably want to draw into the CGPDFContext using ATSUI
directly which can involve a bit of learning.
Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden