Invalid Destination path for GotoRemoteAction

hi,


We have some links in the attached document, here we are not getting the proper destination file path for Links with GotoRemoteAction.

We are using below code to get Destination path:

string destpath = gotoraction.File.Name;

Resulting filepath:
"blankcrf.pdf\0ÿÿÿP\0\0\0\0\0”Û\0zÀ\0\0\0\0\0dÛ\0þsÔw×\f:(\0\0\0\0\0\0\0zÀ\0\0\0\0\0\0\0\0\0\0\0!\0€0Z#!\0\0\0,Þ\0\0\0\0o\0\0\0\0\0o\0\00Z#o\0\0\0HÞ\0,
R\00Z#o\0\0\0\0\0\0\0\0\0\0!\0€0Z#!\0\0\0lÞ\0,
R\00Z#!\0\0\0\0€!\0€\0\0\0\0\0\0Š†R\0\0\0\0\0\0\0!\0€0Z#!\0\0\0¤Þ\0,
R\00Z#!\0\0\0\0€!\0€\0\0\0\0\0\0Š†R\0\0\0\0!\0€!\0€\0\0\0"

Please let me know.

Hi Chenna,


Thanks for contacting support.

I have tested the scenario using following code snippet and as per my observations, the destination for only first link is being returned i.e. Destination: blankcrf.pdf and then application hangs. For
the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-37973. We will
investigate this issue in details and will keep you updated on the status of a
correction. We
apologize for your inconvenience.

However we will appreciated if you can please share the code snippet which you are using so that we can again test the scenario.

[C#]

//
Load source PDF file containing hyperlinks
<o:p></o:p>

Document document = new Document("c:/pdftest/define.pdf");

// Traverse through all the page of PDF

foreach (Aspose.Pdf.Page page in document.Pages)

{

// Get the link annotations from particular page

AnnotationSelector selector = new AnnotationSelector(new Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation(page, Aspose.Pdf.Rectangle.Trivial));

page.Accept(selector);

// Create list holding all the links

IList list = selector.Selected;

Console.WriteLine("Number of links = "+ list.Count);

// Iterate through invidiaul item inside list

foreach (LinkAnnotation a in list)

{

// Print the destination URL

Console.WriteLine("Destination: " + (a.Action as Aspose.Pdf.InteractiveFeatures.GoToRemoteAction).File.Name+ "");

}

}

hi,


Here is the code we are using:

AnnotationCollection annots = pageobj.Annotations;
if (annots != null && annots.Count != 0)
{
PdfAction action = annot.Action;
if (action is GoToRemoteAction)
{
GoToRemoteAction gotoraction = action as GoToRemoteAction;
sLinkDest = gotoraction.File.Name;
}
}

Hi Chenna,


Thanks for sharing your source code. We have managed to notice the invalid file name of GoToRemoteAction and logged it as PDFNEWNET-37981 in our issue tracking system for further investigation and resolution. We will keep you updated about the issue resolution progress via this forum thread.

We are sorry for the inconvenience caused.

Best Regards,

Hi Tilal Ahmad,

Any update on the issue "PDFNEWNET-37981"related to "Invalid Destination path for GotoRemoteAction"?

I really appreciate if I can get early resolution to this issue.

Thanks & Regards

Chenna Basappa C

Hi Cheena,

Thanks for your inquiry. I am afraid we have recently noticed the issue (PDFNEWNET-37981) and yet it is pending for investigation due to the issues already under investigation. We will notify you as soon as we made some significant progress towards issue resolution.

We are sorry for the inconvenience caused.

Best Regards,

Hi,

I know you are working on the issue (PDFNEWNET-37981), I am just curious to know any further update on this issue which is reported almost a month back.
I am holding my project time-line for this to be resolved. It would be great if you share any further update on this item.

Thanks & Regards

Chenna Basappa C

Hi Chenna,


Thanks for your inquiry. I am afraid your reported issue is still not resolved due to other issues under investigation and resolution. However we have requested our development team to share an ETA at their earliest. We will update you as soon as we get a feedback.

Thanks for your patience and cooperation.

Best Regards,

Hi Chenna,


Thanks for your patience.

We have further investigated the issue reported earlier as PDFNEWNET-37981 and as per our observations, your file seems to be created with third-party software :
pdf:ProducerNeevia Converter (OEM)</pdf:Producer>

We have noticed that file names in link annotations contains extra characters after reasonable file name “blankcrf.pdf”. Please see attached screenshots 37981-object and 37981-object2 (it shows view of the GoToR destination object; please pay attention to F entry: it contains correct file name but some extra characters are present after file name).

So the API extracts exact information which is contained in your document. I can also notice that zero character is present after file name. We can truncate string and extract correct file name using following code snippet.

[C#]

private string TruncateString(string s)<o:p></o:p>

{

string result = s;

//find zero character.

int index = s.IndexOf((char)0);

//if zero character present, truncate characters after it.

if (index != -1)

{

result = s.Substring(0, index);

}

return result;

}


and we can apply this function to file name in your code as :

[C#]

…<o:p></o:p>

else if (link.Action is GoToRemoteAction)

{

GoToRemoteAction action = (GoToRemoteAction)link.Action;

Console.WriteLine(TruncateString((action as GoToRemoteAction).File.Name));

}

...

I think Acrobat Reader also perform similar operation to show correct file name.

The issues you have found earlier (filed as PDFNEWNET-37973) have been fixed in Aspose.Pdf for .NET 10.6.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Chenna,


Thanks for your patience.

In order to generate correct output, you need to update your code snippet.

  1. Some of actions are not GoToRemote actions and that’s why they can be casted to this class.
  2. File names are stored not correctly (with some extra characters) but these characters are separated with zero characters for example:
filename.pdf\0$@#%^#$%#GDFER%#…

Example of more correct code:
[C#]

// Load source PDF file containing
hyperlinks
<o:p></o:p>

Document document = new Document(input("define.pdf"));

// Traverse through all the page of PDF

foreach (Aspose.Pdf.Page page in document.Pages)

{

// Get the link annotations from particular page

AnnotationSelector selector = new AnnotationSelector(new Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation(page, Aspose.Pdf.Rectangle.Trivial));

page.Accept(selector);

// Create list holding all the links

IList list = selector.Selected;

Console.WriteLine("Number of links = " + list.Count);

// Iterate through invidiaul item inside list

int count = 0;

string name;

string actionType;

foreach (LinkAnnotation a in list)

{

// Print the destination URL

name = null;

actionType = null;

if (a.Action is Aspose.Pdf.InteractiveFeatures.GoToRemoteAction)

{

name = (a.Action as Aspose.Pdf.InteractiveFeatures.GoToRemoteAction).File.Name;

actionType = "GoToRemoteAction";

}

else

if (a.Action is Aspose.Pdf.InteractiveFeatures.LaunchAction)

{

name = (a.Action as Aspose.Pdf.InteractiveFeatures.LaunchAction).File;

actionType = "LaunchAction";

}

if (name != null)

{

int index = name.IndexOf((char)0);

if (index >= 0)

{

name = name.Substring(0, index);

}

Console.WriteLine(actionType + ": #" + count + "
Destination: "
+ name + "");

count++;

}

}

}