line break

  • José Luis Zúñiga

    Hi, I like to know the best way to make line breaks when showing text. I have a String with the usual "\n" in  it, how do i print them on my .pdf file?

  • Anonymous

    Anonymous - 2012-02-28

    PDF does not have the concept of a "linebreak". it's a plain page description language - so you have to position a cursor to a position and draw a character there. if you have  a linebreak, position the cursor on the new start position and resume drawing…

    You must provide the layouting code yourself. This may be as simple as for example the "LineBreakMeasurer" from awt or the "flying saucer" xhtml renderer.

    if your text is *really* completely "pre-layouted" you max use the "T*" operator (or the equivalent "textLineNew" in ICSDevice) where the "cursor" is reset to the line start and offset by the text leading height.


Log in to post a comment.