We are an old customer of Aspose and we are using version 18.1.0 of Aspose pdf. ( we can’t upgrade because it’s very cost )
and I notice that we can generate the table of the content page and it’s visible in the browser ( chrome and ME ) but in adobe acrobat reader it’s not display anything but still can click
this is block of code :
** Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
doc.Pages.Add();
Page tocPage = doc.Pages.Add();
TocInfo tocInfo = new TocInfo();
//set LeaderType
tocInfo.LineDash = TabLeaderType.Solid;
TextFragment title = new TextFragment("Table Of Contents");
title.TextState.FontSize = 12;
tocInfo.Title = title;
//Add the list section to the sections collection of the Pdf document
tocPage.TocInfo = tocInfo;
//Define the format of the four levels list by setting the left margins
//and
//text format settings of each level
tocInfo.FormatArrayLength = 4;
tocInfo.FormatArray[0].Margin.Left = 0;
tocInfo.FormatArray[0].Margin.Right = 30;
tocInfo.FormatArray[0].LineDash = TabLeaderType.None;
tocInfo.FormatArray[0].TextState.ForegroundColor = Color.Red;
tocInfo.FormatArray[1].Margin.Left = 10;
tocInfo.FormatArray[1].Margin.Right = 30;
tocInfo.FormatArray[1].LineDash = TabLeaderType.None;
tocInfo.FormatArray[1].TextState.FontSize = 10;
tocInfo.FormatArray[2].Margin.Left = 20;
tocInfo.FormatArray[2].Margin.Right = 30;
tocInfo.FormatArray[3].LineDash = TabLeaderType.None;
tocInfo.FormatArray[3].Margin.Left = 30;
tocInfo.FormatArray[3].Margin.Right = 30;
//Create a section in the Pdf document
Page page = doc.Pages.Add();
//Add four headings in the section
for (int Level = 1; Level <= 4; Level++)
{
Aspose.Pdf.Heading heading2 = new Aspose.Pdf.Heading(Level);
TextSegment segment2 = new TextSegment();
heading2.Segments.Add(segment2);
heading2.IsAutoSequence = true;
heading2.TocPage = tocPage;
segment2.Text = "Sample Heading" + Level;
heading2.TextState.Font = FontRepository.FindFont("Verdana");
//Add the heading into Table Of Contents.
heading2.IsInList = true;
page.Paragraphs.Add(heading2);
}
// save the Pdf
doc.Save(outFile);**