Greetings,
I have an issue with the TOC where the line spacing on word wrap is ignored when the text is at certain lengths. When the heading text is longer this does not occur. See image:
image.png (16.6 KB)
This code replicates the issue:
Aspose.Pdf.License asposeLicense = new Aspose.Pdf.License();
asposeLicense.SetLicense("Aspose.Total.NET.lic");
var pdfDocument = new Aspose.Pdf.Document();
Aspose.Pdf.Page tocPage = pdfDocument.Pages.Add();
TocInfo tocInfo = new TocInfo();
tocInfo.Title = new TextFragment("Table of Contents Page");
tocPage.TocInfo = tocInfo;
// Broken
TextSegment textSeg = new TextSegment();
textSeg.Text = "1 - This text should have line spacing when it wraps asdf asdf asdf asdf asdf asdf as";
textSeg.TextState.FontSize = 11;
textSeg.TextState.LineSpacing = (float)1.5 * 12;
Heading tocHeading = new Heading(2);
tocHeading.TocPage = tocPage;
tocHeading.Segments.Add(textSeg);
tocHeading.DestinationPage = pdfDocument.Pages[1];
tocPage.Paragraphs.Add(tocHeading);
// Working
TextSegment textSeg2 = new TextSegment();
textSeg2.Text = "2 - This text will have line spacing when it wraps asdf asdf asdf asdf asdf asdf asdf asdf";
textSeg2.TextState.FontSize = 11;
textSeg2.TextState.LineSpacing = (float)1.5 * 12;
Heading tocHeading2 = new Heading(2);
tocHeading2.TocPage = tocPage;
tocHeading2.Segments.Add(textSeg2);
tocHeading2.DestinationPage = pdfDocument.Pages[1];
tocPage.Paragraphs.Add(tocHeading2);
pdfDocument.Save("output.pdf");
Any help would be greatly appreciated.
Cheers,
Jordan