Adding hyperlinks to an existing PDF

i have a pdf document which i am getting from the client.There is a note section in the pdf.So I want to add a hyperlink against the text "note" through out the document . The destination of the link is within the document. Is this possible by ASPOSE. Please revert me if you need any other information.

Hi Prashant,

Thanks for your interest in our products.

I am pleased to share that your requirement can be accomplished using Aspose.PDF for .NET. Please visit the following links for further information:

In the event of any further query, please feel free to contact.

Hi Team

Actually i didn't find any function which is supporting my requrement.

I want to read an exzisting file and find a text in it and set that text as a hyperlink and the destination would be some section in the same document.

Could you please tell me the exact function which is doing this.

Thanks

Prashant

Hi Prashant,

Please try using the following code snippet which searches for a string in existing PDF, replaces it with new string and adds a hyperlink over same location to a page within same document. In case you still face the similar issue or you have any further query, please feel free to contact. We are sorry for this inconvenience.

[C#]

//open document<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Document pdfDocument = new Document("c:/pdftest/input.pdf");

//create TextAbsorber object to find all instances of the input search phrase

TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("rmannot");

//accept the absorber for a particular page

pdfDocument.Pages[1].Accept(textFragmentAbsorber);

//get the extracted text fragments

TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;

//loop through the fragments

foreach (TextFragment textFragment in textFragmentCollection)

{

//update text and other properties

textFragment.Text = "LocalLink";

textFragment.TextState.Font = FontRepository.FindFont("Verdana");

textFragment.TextState.ForegroundColor =Aspose.Pdf.Color.Blue;

}

//open document

PdfContentEditor contentEditor = new PdfContentEditor();

contentEditor.BindPdf(pdfDocument);

System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle((int)textFragmentCollection[1].Position.XIndent, (int)textFragmentCollection[1].Position.YIndent, 20, 10);

//create link to page 3 in same document

contentEditor.CreateLocalLink(rectangle, 3, 1, System.Drawing.Color.Red);

//save updated PDF

contentEditor.Save("c:/pdftest/PDFwithyperlink.pdf");