m trying to set the line spacing of a TextFragment object using Aspose.pdf in C#, but I’m unable to set the value between 0.0 to 1.0
I also want to set the line spacing to a value less than 1, such as 0.82, but it seems to be getting rounded up to 1. I’ve verified that the font file exists at the specified path,
var fontPath = _dataDir + "astmensh.otf";
var document = new Aspose.Pdf.Document();
var page = document.Pages.Add();
TextBuilder builder = new TextBuilder(page);
TextParagraph paragraph = new TextParagraph();
paragraph.Rectangle = new BoundingBox(pageHeight).getBoxPosition(70.136f, 148.652f, 425.665f, 549.093f);
paragraph.VerticalAlignment = VerticalAlignment.Top;
paragraph.HorizontalAlignment = HorizontalAlignment.Left;
paragraph.FormattingOptions.WrapMode = TextFormattingOptions.WordWrapMode.ByWords;
paragraph.FormattingOptions.LineSpacing = TextFormattingOptions.LineSpacingMode.FontSize;
var textFragment = new Aspose.Pdf.Text.TextFragment(@"Greetings Ms. test999,
I wanted to let you know I am thinking of you.");
textFragment.TextState.Font = FontRepository.OpenFont(fontPath);
textFragment.TextState.ForegroundColor = Color.Parse("#211d70");
textFragment.TextState.FontSize = 28;
textFragment.TextState.LineSpacing = 0.82f;
paragraph.AppendLine(textFragment);
builder.AppendParagraph(paragraph);
document.Save(_dataDir + "manual-output.pdf");