The leading is the space between baselines. The first line will be positioned below the top margin by the leading value. If you need to adjust the height of the first line you must decide what you want, generally leading, font size or ascender.
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Mitch Freed > Sent: Tuesday, October 18, 2005 3:58 PM > To: [email protected] > Subject: [iText-questions] Paragraph Leading > > I am using ColumnText to add content to a document. I am > adding a Paragraph to the document and specifying Leading as > 0. The text is being placed outside the column boundaries > (margins). If I don't specify leading (it defaults to 16) and > is not being placed flush against the top of the column (top > margin). If I specify Leading as 8, the Paragraph will begin > directly under the top margin. > > I can't understand from the documentation how Paragraph > Leading is supposed to be used. From what I read it is > supposed to be the spacing between lines, usually 1.5 * the > font size. Why the spacing above the first line of the > paragraph though? > > ________________________________ > > > iTextSharp.text.Document document = new > iTextSharp.text.Document(iTextSharp.text.PageSize.LETTER); > > System.IO.MemoryStream ms = new MemoryStream(); > iTextSharp.text.pdf.PdfWriter writer = > iTextSharp.text.pdf.PdfWriter.GetInstance(document, ms); > > document.Open(); > > iTextSharp.text.pdf.PdfContentByte cb = writer.DirectContent; > cb.Rectangle(72, 72, 612 - 144, 792 - 144); > cb.Stroke(); > > iTextSharp.text.Paragraph p = new iTextSharp.text.Paragraph(); > p.Leading = 0; // ?? > p.Add(new iTextSharp.text.Chunk(this.pageText.Text)); > > iTextSharp.text.pdf.ColumnText ct1 = new > iTextSharp.text.pdf.ColumnText(cb); > ct1.AddElement(p); > > ct1.SetSimpleColumn(72, 72, 612-72, 792-72); > ct1.Go(); > > document.Close(); > > ________________________________ > > > Thanks, > Mitch Freed > [EMAIL PROTECTED] > ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
