Add uri link action to existed links

Hi Team,

I have uploaded a document with two hyperlinks in toc. and i need code make two hyperlinks navigating to “www.google.com”. you have to remove the existing destination and create a new uri action with “www.google.com”. Table of Contents.pdf (283.3 KB)

Thanks and Regards,
Harish G.

@HarishGali

We tried below code snippet in our environment but the links in generated PDF document did not work.

Aspose.Pdf.Document doc = new Aspose.Pdf.Document(dataDir + @"Table of Contents.pdf");
foreach (var page in doc.Pages)
{
    foreach (var annotation in page.Annotations)
    {
        if (annotation is LinkAnnotation)
        {
            page.Annotations.Delete(annotation);
            LinkAnnotation lnk = new LinkAnnotation(page, annotation.Rect);
            lnk.Hyperlink = new WebHyperlink("https://aspose.com");
            page.Annotations.Add(lnk);
        }
    }
}
doc.Save(dataDir + "output.pdf");

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-54970

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.