Re: Unable to generate a PDF from textual data
Re: Unable to generate a PDF from textual data
- Subject: Re: Unable to generate a PDF from textual data
- From: "Michael Ash" <email@hidden>
- Date: Fri, 14 Nov 2008 14:17:04 -0500
On Fri, Nov 14, 2008 at 1:16 PM, Lee, Frederick (Ric)
<email@hidden> wrote:
> Greetings:
>
> I'm trying to create a PDF from a NSString; but I'm not getting anything.
>
> What am I doing wrong?
Are you thinking that your code will build a PDF which contains a
visual representation of the text contained in the NSString? If so,
this isn't right, it's barely even wrong.
CGPDFDocumentCreateWithProvider expects raw PDF data. In other words,
it expects you to already have a PDF from somewhere, and all it does
is read that PDF into memory so you can work with it. It's not going
to magically realize that you're giving it human-readable text,
perform rendering and layout on that text, and produce a PDF document
from it.
If your goal is to create a new PDF which visually contains a string,
your best approach is probably to put that string into an NSTextView,
and then use the Cocoa printing system to generate a PDF from it.
Mike
_______________________________________________
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