Add TOC in existing PDF document using Aspose.PDF for .NET - Fail to edit TOC text in Adobe

Dear Team
We have created TOC in PDF document using following code. TOC is created successfully. However if we edit this newly created TOC in Adobe, we are not able to type few characters in TOC lines. We observed that we are not able to enter character that are not present in TOC. They are displayed as dots.

Also we observed that we are not able to edit heading “Table of Contents”. Please find attached input and output PDF files

   public static void CreateTOCFromBookmarks(String FileIn, String FileOut)
    {
            Document doc = new Document(FileIn);

            TocInfo tocInfo = new TocInfo();
            Aspose.Pdf.Page tocPage = null;
            TextFragment titleFrag = new TextFragment();
            titleFrag = new TextFragment();
            titleFrag.Text = "TABLE OF CONTENTS";
            titleFrag.TextState.LineSpacing = 20;
            titleFrag.TextState.FontSize = 12;
            titleFrag.TextState.Font = FontRepository.FindFont("Times New Roman");
            titleFrag.TextState.HorizontalAlignment = HorizontalAlignment.Center;
            titleFrag.TextState.FontStyle = FontStyles.Bold;
            tocPage = doc.Pages.Insert(1);
            tocInfo.Title = titleFrag;
            tocPage.TocInfo = tocInfo;

            Aspose.Pdf.Heading heading2 = new Heading(1);
            heading2.TextState.Font = FontRepository.FindFont("Times New Roman");
            heading2.TextState.FontStyle = FontStyles.Regular;
            heading2.TextState.FontSize = 12;
            TextSegment segment2 = new TextSegment();
            heading2.TocPage = tocPage;
            segment2.Text = "Lorem ipsum dolor sit amet, consectetuer";
            heading2.TextState.ForegroundColor = Color.Blue;
            heading2.TextState.LineSpacing = 10;
            heading2.DestinationPage = doc.Pages[2];
            heading2.Top = doc.Pages[2].Rect.Height;
            heading2.Segments.Add(segment2);
            tocPage.Paragraphs.Add(heading2);

            heading2 = new Heading(2);
            heading2.TextState.Font = FontRepository.FindFont("Times New Roman");
            heading2.TextState.FontStyle = FontStyles.Regular;
            heading2.TextState.FontSize = 12;
            segment2 = new TextSegment();
            heading2.TocPage = tocPage;
            segment2.Text = "In porttitor. Donec laoreet nonummy augue";
            heading2.TextState.ForegroundColor = Color.Blue;
            heading2.TextState.LineSpacing = 10;
            heading2.DestinationPage = doc.Pages[2];
            heading2.Top = doc.Pages[2].Rect.Height;
            heading2.Segments.Add(segment2);
            tocPage.Paragraphs.Add(heading2);

            doc.Save(FileOut);
    }

toc edit.zip (168.4 KB)

@crshekharam

The issue seems related to fonts mapping. However, could you please share which version of Adobe Reader are you using? Also, please share a screenshot of the error that you face during editing the text in TOC. We will further proceed to assist you accordingly.

@asad.ali
We are using Adobe Acrobat X Pro to edit PDF. Please find screenshot. In red colored area we typed capital A-Z characters and in green colored area we typed lower case a-z characters. However, some of characters are shown as dots.

image.png (51.5 KB)

@crshekharam

We have logged an investigation ticket as PDFNET-49098 in our issue tracking system to further analyze this case. We have recorded all provided information along with the ticket as well. As soon as we complete its investigation, we will inform you within this forum thread. Please be patient and spare us some time.

We are sorry for the inconvenience.