I have tried accessing the hyperlink inside PDF file on page 30 and I am getting IndexOutOfRangeException. Can you please share some sample project, so that we can test the scenario in our environment. We are sorry for this inconvenience.
[C#]
using (Document pdfDocument = new Document("c:/pdftest/CA494-18500±+In-Mold+Labeling+(IML)+for+HP+Indigo+L%26P+How+to+Guide.pdf"))
{
Console.WriteLine(pdfDocument.Pages[30].Annotations[1]);
LinkAnnotation linkAnno = (LinkAnnotation)pdfDocument.Pages[30].Annotations[5];
if (linkAnno.Action != null)
{
if (linkAnno.Action.GetType().Name == "GoToRemoteAction")
{
// Console.WriteLine("LinkAnnotation >>>> GoToRemoteAction");
}
else if (linkAnno.Action.GetType().Name == "GoToURIAction")
{
GoToURIAction uriAction = (GoToURIAction)linkAnno.Action;
string uri = uriAction.URI;
Console.WriteLine(">>>> " + uri);
// Logger.LogMessage(">>>> " + uri);
Console.WriteLine(" ------- " + pdfDocument.FileName);
// Logger.LogMessage(" ------- " + docName);
}
}
else if (linkAnno.Destination is ExplicitDestination explicitDest)
{
Console.WriteLine("{0}[{1}]", pdfDocument.Pages[30].Annotations[5], explicitDest.PageNumber);
}
else if (linkAnno.Destination is NamedDestination namedDest)
{
Console.WriteLine("{0}[{1}]", pdfDocument.Pages[30].Annotations[5],
pdfDocument.Destinations.GetPageNumber(namedDest.Name, false));
}
pdfDocument.Save("c:/pdftest/LinkUpdated.pdf");
}
I have tested the scenario and I am able to
notice the same problem. For the sake of correction, I have logged this problem
as PDFNEWNET-40500 in our issue tracking system. We will
further look into the details of this problem and will keep you updated on the
status of correction. Please be patient and spare us little time. We are sorry
for this inconvenience.