Andreas Huhn wrote: > hi there, > im writing a program that should create pdfs of a variable length > depending on the text. i have a fixed width though. > if i try to find out the texts length by using: > > size=size+(base_font_name.getAscentPoint( > phrase3.toString(),font.size()) - > base_font_name.getDescentPoint(phrase3.toString(),font.size()));
That's not the right way to do this. This gives you the height of one long string of text. You haven't defined a width here. > i end up short, as the distance between two lines is not added into "size". > in order to correct that i would need to know the number of lines > written, so i can measure up "size". > > is there a way to find out the "linecount"? Add all your text to a ColumnText object, define a column (left and right border), perform go(true). This is a simulation. No text is added to the document, but you can ask the ColumnText for its Y position after adding text, the number of lines that have been added, and so on... This is explained in Chapter 7 of the book. br, Bruno ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
