HTML anchor tag<a> links are not working from 2nd page onward in ASPOSE PDF

Hi Aspose Team,

When we are trying to add a table and HTML content in same document, HTML anchor tag links are not working from 2nd page onwards, and those links are appearing in random place in the document. Please help us to resolve the same. I have added the sample code to reproduce the issue below.

Aspose version: 24.02
.Net example to reproduce the issue:

       var document = new Document();
        var pages = document.Pages.Add();
        pages.SetPageSize(595, 841.68);
        pages.PageInfo.Margin = new MarginInfo(50, 60, 50, 180);
        var HTMLContent =
          "<HTML><strong>Hyperlinks are not working from second pages<br></strong>\r\nanchor tag links are working in first page <a href=\"https://docs.aspose.com/pdf/net/actions/\"> Working in first page</a> adding another link <a href=\"https://www.google.co.uk/\"><u> Link2 working in first page</u></a><p>Extensive Hyperlink functionality Hyperlinks allow users to navigate quickly and efficiently within a PDF document. By clicking on hyperlinks, readers can jump to different sections, chapters, or pages without having to manually scroll through the document. Aspose.PDF for .NET provides many advantages, including improved navigation, cross-referencing, access to external resources, interactivity, and enhanced communication. They contribute to a more engaging, informative, and accessible reading experience for users. Let’s check the next section for more details</p><br><br><strong> Hyper links working in first page</strong>anchor tag links are working in first page <a href=\"https://docs.aspose.com/pdf/net/actions/\"> Working n first page</a><br> <a href=\"https://www.google.co.uk/\"><u> Link2 working in first page</u></a>\r\n<p>direct links also working as expected in first page https://www.w3schools.com/ </p>\r\n<br><br><br><strong>Hyperlinks are not working from second pages<br><br></strong>\r\nanchor tag links are working in first page <a href=\"https://docs.aspose.com/pdf/net/actions/\"> Working in first page</a><br> <a href=\"https://www.google.co.uk/\"><u> Link2 working in first page</u></a>\r\n<p>Extensive Hyperlink functionality Hyperlinks allow users to navigate quickly and efficiently within a PDF document. By clicking on hyperlinks, readers can jump to different sections, chapters, or pages without having to manually scroll through the document. Aspose.PDF for .NET provides many advantages, including improved navigation, cross-referencing, access to external resources, interactivity, and enhanced communication. They contribute to a more engaging, informative, and accessible reading experience for users. Let’s check the next section for more details</p><br><br><br><br><br><br><br><br><br><br><br><br><br><br>\r\n<strong>NOT WORKING IN THIS PAGE[2nd page and onwards] <*a><br></strong>\r\nanchor tag links are not working in second page <a href=\"https://docs.aspose.com/pdf/net/actions/\">NOT Working in second page</a><br> <a href=\"https://www.google.co.uk/\"><u> Link2 NOT working in second page</u></a>\r\n<p>Extensive Hyperlink functionality Hyperlinks allow users to navigate quickly and efficiently within a PDF document. By clicking on hyperlinks, readers can jump to different sections, chapters, or pages without having to manually scroll through the document. Aspose.PDF for .NET provides many advantages, including improved navigation, cross-referencing, access to external resources, interactivity, and enhanced communication. They contribute to a more engaging, informative, and accessible reading experience for users. Let’s check the next section for more details</p><br><strong> Hyper links not working in second page</strong><br>\r\nanchor tag links are working in first page <a href=\"https://docs.aspose.com/pdf/net/actions/\"> NOT Working in second page</a><br> <a href=\"https://www.google.co.uk/\"><u> Link2 NOT working in second page</u></a>\r\n<p>direct links also not working as expected in second page https://www.w3schools.com/ </p>";
        var table = new Table
        {
        };
        table.ColumnWidths = "450";
        table.Margin.Bottom = 10;
        var row = table.Rows.Add();
        var cell = new Cell();
        cell.Margin = new MarginInfo(2, 2, 2, 2);
        cell.Paragraphs.Add(new TextFragment("Hi After adding this line in Table row to pagas HTML is not working after this"));
        row.Cells.Add(cell);
        pages.Paragraphs.Add(table);

        var html = new HtmlFragment(HTMLContent)
        {
            TextState = new TextState()
            {
                Font = FontRepository.FindFont("Arial", FontStyles.Regular),
                FontSize = 12,
                FontStyle = FontStyles.Regular,
                LineSpacing = 1.5f
            }
        };
        pages.Paragraphs.Add(html);
        document.Save("C:\\Temp\\HTMLLinksNotWorkingInSecondPage.pdf");

Example.PNG (56.8 KB)

HTMLLinksNotWorkingInSecondPage.pdf (182.1 KB)

@AnandaBairy

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-57437

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.