Thanks Paulo, But to clarify, do you mean to use the setTextMatrix() method after every line, to reposition the 'cursor'?
Thanks Chris -----Original Message----- From: Paulo Soares [mailto:[EMAIL PROTECTED]] Sent: Monday, July 08, 2002 11:26 AM To: Chris Ward; iText (E-mail) Subject: RE: [iText-questions] How to get a new line in template when adding text? You need to use PdfContentByte.setLeading() to set the line spacing before using newlineShowText(). I recommend the use of setTextMatrix() instead: the results are more predictable. Best Regards, Paulo Soares > -----Original Message----- > From: Chris Ward [SMTP:[EMAIL PROTECTED]] > Sent: Monday, July 08, 2002 17:17 > To: iText (E-mail) > Subject: [iText-questions] How to get a new line in template when > adding text? > > I must be missing something easy. I am trying to add several lines of text > to a template. I figured that newlineShowText() or newlineText() would > move the 'cursor' down one line. Is that incorrect, or am I misusing them? > > > With this code, I was expecting to get 10 lines on the template, but I > only get one, each overwriting the other. > > > PdfContentByte cb = writer.getDirectContent(); > PdfTemplate template = cb.createTemplate(500, 500); > BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, > BaseFont.CP1252, BaseFont.NOT_EMBEDDED); > template.setFontAndSize(bf, 12); > template.beginText(); > template.setTextMatrix(100, 200); > for( int i=0; i<10; i++ ) { > template.newlineShowText("Line : "+i); > template.newlineText(); // try both > newline commands > } > template.endText(); > cb.addTemplate(template, 100, 400); > > > Do I have to keep track of the height of the text, and move the 'cursor' > my self, with .setTextMatrix() each time I write a line? > > Thanks, > Chris > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Oh, it's good to be a geek. http://thinkgeek.com/sf _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
