Hello, I have a fresh install of Aspose PDF 19.4.0. I am trying to add a TextFragment to a TextParagraph and then to a TextBuilder per some examples. Unless I make the font size smaller I can not fit in a large amount of text. Shouldn’t the TextFragment height be automatic? I have tried by adding the text when the TextFragment is created and also tried adding it after the TextState settings I have, still cannot fit a large amount of text unless font size is smaller.
Code below:
var page = document.Pages.Add();
TextBuilder builder = new TextBuilder(page);
// Create text paragraph
TextParagraph paragraph = new TextParagraph();
paragraph.HorizontalAlignment = HorizontalAlignment.Center;
paragraph.VerticalAlignment = VerticalAlignment.Bottom;
// Specify the location to add TextParagraph
paragraph.Rectangle = new Rectangle(18, 8, page.PageInfo.Width - 18, 300);
// Specify word wraping mode
paragraph.FormattingOptions.WrapMode = TextFormattingOptions.WordWrapMode.ByWords;
// Create text fragment
//Width:{paragraph.Rectangle.Width}x{paragraph.Rectangle.Height} {paragraph.Rectangle.LLX}-{paragraph.Rectangle.LLY} x {paragraph.Rectangle.URX}-{paragraph.Rectangle.URY}
TextFragment disclaimerFragment = new TextFragment();
disclaimerFragment.TextState.FontSize = 11; //if set to 7 my text fits
disclaimerFragment.TextState.ForegroundColor = Color.FromRgb(System.Drawing.Color.SlateGray);
disclaimerFragment.Text = $"{content}"; //content added from variable, large paragraph, 600 characters
// Add fragment to paragraph
paragraph.AppendLine(disclaimerFragment);
// Add paragraph
builder.AppendParagraph(paragraph);;
Any help is appreciated, thanks!