Hi ,
I want to eliminate a bad hyperlink from the PDF uploaded . Is it possible to do using aspose?
Please guide me the steps if possible.
Observation :While uploading the pdf with a bad hyperlink the error message is generated
Thanks,
Shilpi
Any updates?
Please let me know…
Hi Shilpi,
Hi ,
I am sending the sample pdf attached in the first post . The try2.pdf is a good hyperlink where one can navigate to the google.com
In the hyperlink.pdf the hyperlink embedded in it is a bad hyperlink as it does not naviagtes to any file.
My requirement is to replace the bad hyperlink with the plain text in the pdf.
Thanks,
Shilpi
Hi ,
Any update? Please let me know …I need it urgently
Thanks,
Shilpi
Hi Shilpi,
//
Load source PDF file containing hyperlinks<o:p></o:p>
Document document = new Document("c:/pdftest/16222-acrobat-device-gray.pdf");
// Traverse through all the page of PDF
foreach (Aspose.Pdf.Page page in document.Pages)
{
// Get the link annotations from particular page
Aspose.Pdf.InteractiveFeatures.Annotations.AnnotationSelector selector = new Aspose.Pdf.InteractiveFeatures.Annotations.AnnotationSelector(new Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation(page, Aspose.Pdf.Rectangle.Trivial));
page.Accept(selector);
// Create list holding all the links
System.Collections.IList list = selector.Selected;
// Iterate through invidiaul item inside list
foreach (Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation a in list)
{
// Print the destination URL
Console.WriteLine("
Destination: " + (a.Action as
Aspose.Pdf.InteractiveFeatures.GoToURIAction).URI + "
");
}
}
Hi ,
I have the following code snippet which I am using to change the destination url :
foreach (Aspose.Pdf.Page page in pdfDocument.Pages)
{
Aspose.Pdf.InteractiveFeatures.Annotations.AnnotationSelector selector = new Aspose.Pdf.InteractiveFeatures.Annotations.AnnotationSelector(new Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation(page, Aspose.Pdf.Rectangle.Trivial));
page.Accept(selector);
System.Collections.IList list = selector.Selected;
foreach (Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation a in list)
{
if (a.Destination == null)
{
a.Action = new GoToURIAction("…");
}
}
}
I want to set the value of GoToURIAction as the value of the hyperlink text.
Please suggest me the method which shall return me the hyperlink text.
Also confirm me if the Destination check is correct to detect the bad hyperlink or not?
Also suggest me a way if i can change the hyperlink to plain text in the pdf and save it.
Thanks,
Shilpi
Hi Team ,
Any updates ? Looking for a reply
Thanks,
Shilpi
Hi Shilpi,