Re: Draw word wrapped text to a quartz context?

22 views
Skip to first unread message

Matt Freedman

unread,
Nov 5, 2009, 2:52:39 PM11/5/09
to iPhone SDK Development
Nevermind – it is much easier than I thought. You do not have tou se
the CGContextShowTextAtPoint to render the string, that is just what
was used in the sample code that I had found. The right way is to push
the pdf context, then you can use the higher level NSString
drawInRect, which does the word wrapping for you. It works great.

-- Matt

On Nov 5, 2009, at Nov 5;11:05 AM, Matt Freedman wrote:

> Per my recent message about html to pdf conversion, I am looking
> into just creating the pdf files manually, by drawing in the text
> and images myself, and skipping the html.
>
> To write text into a pdf, you create a pdf context with
> CGPDFContextCreateWithURL, and then use CGContextShowTextAtPoint to
> write C strings into that context. For paragraphs of text this is
> obviously going to get old really fast without word wrapping support.
>
> The higher level cocoa UI components obviously support word wrapping
> on NSStrings. But what is the best approach to writing word wrapped
> C strings into a quartz CGContext?
>
> -- Matt
>

Matt Freedman

unread,
Nov 5, 2009, 2:05:27 PM11/5/09
to iPhone SDK Development
Reply all
Reply to author
Forward
0 new messages