It's about formatting PDFs using basic graphics. But it can be about any type of swap when it comes to printing a line on two pages.
I need to split a string into several pages. For small lines this is not a problem. For them, I use the NSString UIKit sizeWithFont sizeWithFont to determine if the full text on the current page is suitable or not. If so, I print it using drawInRect , and if not, move it to the next page.
Works fine, but not suitable for longer lines. In my application, individual lines (user-provided) may even be longer than a full page.
When there is a full page or some remaining space of the specified page, how can I determine exactly what part of the NSString can be displayed in the specified rectangle so that I can turn it off and print the remaining line (or at least part of it) on the next page?
I thought of an alternative. This brings the full text into the context of the graphic screen, and then cuts the created image into fragments that fit into the free space on the pages. But if I do this, I need to place the cut line exactly between the text lines. And to be honest, I'm not sure how to determine where the text containing the graphics can be safely cut into two (or more) parts without cutting the line of text in its middle.
I hope I expressed myself understandable and that someone is coming to the rescue.
source share