Re: Generating PDFs....
Re: Generating PDFs....
- Subject: Re: Generating PDFs....
- From: Nicko van Someren <email@hidden>
- Date: Wed, 29 Jun 2005 15:07:34 +0100
On 29 Jun 2005, at 14:39, Scott Thompson wrote:
On Jun 28, 2005, at 11:40 PM, Dave DeLong wrote:
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.
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.
Keep in mind that this will generate a single page of PDF output. If
you want to make a multi-page PDF, and you are on Tiger, this is now
relatively easy using PDFKit. You can make a PDFDocument object from
the PDF data returned above (using initWithData:) and then for all
but the first page you can extract the single PDFPage from each of
these documents and insert them back in to the first document using
insertPage:atIndex:
Cheers,
Nicko
_______________________________________________
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