I'm creating a PDF document consisting of text only, where all the text is the same point size and font family but each character could potentially be a different color. Everything seems to work fine using the code snippet below, but the default space between the lines is slightly greater than I consider ideal. Is there a way to control this? (FYI, type "ColoredText" in the code below merely contains a string and its color. Also, the reason I am treating the newline character separately is that for some reason it doesn't cause a newline if it's in a Chunk.)
Thanks, Ray
List pdfFilesAsBytes = new List(); iTextSharp.text.Document document = new iTextSharp.text.Document(); MemoryStream memStream = new MemoryStream(); iTextSharp.text.pdf.PdfWriter.GetInstance(document, memStream); document.SetPageSize(isLandscape ? iTextSharp.text.PageSize.LETTER.Rotate() : iTextSharp.text.PageSize.LETTER); document.Open(); foreach (ColoredText coloredText in coloredTextList) { Font font = new Font(Font.FontFamily.COURIER, pointSize, Font.NORMAL, coloredText.Color); if (coloredText.Text == "\n") document.Add(new Paragraph("", font)); else document.Add(new Chunk(coloredText.Text, font)); } document.Close(); pdfFilesAsBytes.Add(memStream.ToArray()); []> []>