Free Support Forum - aspose.com

Link Annotation Not Accepting New Value - 2

Dear Sirs,

Some day I am hoping I will be able to fully update a link annotation in Aspose. After fixing being able to update a LaunchAction file destination(372720) and now updating the zoom factor on a GotoRemoteAction(402317). I am unable to update the file destination for the GotoRemoteAction. I am assuming this is just about the same problem that 372720 was. You can actually use my PDF file I provided to you in 402317 as this is the file I am trying to test the below code with.

Dim myGotoAction As Aspose.Pdf.InteractiveFeatures.GoToRemoteAction = LinkAnnotation.Action

Dim myFileSpec As Aspose.Pdf.FileSpecification = myGotoAction.File

Debug.WriteLine("myFileSpec.Name: " & myFileSpec.Name)

myFileSpec.Name = "c:\Somefolder\somefile.pdf"

Debug.WriteLine("myFileSpec.Name: " & myFileSpec.Name)

Is there any way to put a high priority on this? I have been waiting through 2 other tickets to updated link annotations and was so close

Hi Brent,


Thanks for using our products and sorry for the delayed response.

I have gone through your requirements and as per my understanding, you need to update the link in existing PDF file so that it should point to a new PDF document. If so is the case, then please try using the following code snippet to accomplish your requirements. In case I have not properly understood your requirement, please share some more details.

[VB.NET]

'open document<o:p></o:p>

Dim document As Document = New Document("C:\pdftest\This is a test Zoom Fit Page.pdf")

' get the first link annotation from first page of document

Dim linkAnnot As LinkAnnotation = CType(document.Pages(1).Annotations(1), LinkAnnotation)

' sopecify the destination PDF file and the page number to be displayed when link is accessed

linkAnnot.Action = New InteractiveFeatures.GoToRemoteAction("example_bindPDF(File).pdf", 1)

' save the document with updated link

document.Save(“C:\pdftest\This is a test Zoom Fit Page_Updated.pdf”)

Afternoon,

I have tried your solution above and it does work for me. However I also want to specify that the link should be opened as Inherit Zoom. the constructor you used above linkAnnot.Action = New InteractiveFeatures.GoToRemoteAction(“example_bindPDF(File).pdf”, 1) does not seem to allow any changes to its Desitination property. I can save and reload the link and then update it but I cannot do it in one step which is really what is needed.

Dim newGotoAction As New Aspose.Pdf.InteractiveFeatures.GoToRemoteAction(Me.DestinationFile, Me.DestinationPage)

Dim newDest As New Aspose.Pdf.InteractiveFeatures.XYZExplicitDestination(Me.Parent.pdfDoc, oldDest.PageNumber, 0, 0, 0)

newGotoAction.Destination = newDest

linkAnnot.Action=newGotoAction


Brent

FalconsSnowman:
I have tried your solution above and it does work for me.

Hi Brent,

Can you please share your PDF file so that we can test the scenario at our end.
FalconsSnowman:
However I also want to specify that the link should be opened as Inherit Zoom. the constructor you used above linkAnnot.Action = New InteractiveFeatures.GoToRemoteAction(“example_bindPDF(File).pdf”, 1) does not seem to allow any changes to its Desitination property. I can save and reload the link and then update it but I cannot do it in one step which is really what is needed.
As per my understanding, you need to have an overloaded constructor of GoToRemoteAction which should allow to specify the zoom factor when destination is opened. Please correct me so that I can further share my comments.

I need to be able to modify the destination page and zoom level for a gotoremoteaction. The solution does not have to be a new constructor but i guess either of the two options below would work: Attached is my sample pdf doc.


1.) Add a new constructor that excepts a destination object.
Dim newAction as Aspose.Pdf.InteractiveFeatures.GoToRemoteAction(Me.DestinationFile, Me.DestinationPage, newDestination)
2.) Allow the Destination property to be updated after the creation of the new remote goto action
Dim newAction as Aspose.Pdf.InteractiveFeatures.GoToRemoteAction(Me.DestinationFile, Me.DestinationPage)
newAction.Destination = ?


Hi Brent,


Thanks for sharing the details and resource file. I am working over this query and will get back to you soon. We are sorry for this delay and inconvenience.

Good Morning,

Just checking in and seeing if there was any update on this?

Hi,


Sorry for the delayed response. I am still working on reproducing this issue and will get back to you soon.

FalconsSnowman:
I need to be able to modify the destination page and zoom level for a gotoremoteaction. The solution does not have to be a new constructor but i guess either of the two options below would work: Attached is my sample pdf doc.

2.) Allow the Destination property to be updated after the creation of the new remote goto action

Hi Brent,

Thanks for your patience. I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as
PDFNEWNET-34766. We
will investigate this issue in details and will keep you updated on the status
of a correction.

We
apologize for your inconvenience.

Hi Brent,


Thanks for your patience.

I am pleased to share that the issue PDFNEWNET-34766 reported earlier has been resolved and its hotfix will become available in upcoming release version of Aspose.Pdf for .NET 7.7.0. Please try using the following code snippet to accomplish your requirement.

[C#]

Document document = new Document(“c:/pdftest/This is a test Zoom Fit Page.pdf”);<o:p></o:p>

LinkAnnotation linkAnnot = (LinkAnnotation)document.Pages[1].Annotations[1];

GoToRemoteAction goToR = (GoToRemoteAction)linkAnnot.Action;

// next line update destination, do not update file

goToR.Destination = new XYZExplicitDestination(document, 2, 0, 0, 1.5);

// next line update file

goToR.File = new FileSpecification("c:/pdftest/PDFInput (1).pdf");

document.Save("c:/pdftest/ResultantFile.pdf");

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Dear Sir,

I was hoping this would solve it for me. Alas No.

1.) The exact steps above do work as long as this is the only scenario. There are so many other ways to do this that should work according to your object model.
2.) I have to be able to set the destination path to a relative path that will exist at some point in the future but currently does not.

The FileSpecification Object instantiation that you show, only allows paths that are currently verifiable. if I change up your example ever so slightly via:

goToR.Destination=new XYZExplicitDestination(document,2,0,0,0)
Dim newfile as new FileSpecification()
newfile.name ="…\somefolder\somefile.pdf"

Then your object does not retain the new name parameter and does not work. I have also tried(sorry…mixing vb and c#)

Document document = new Document("c:/pdftest/This is a test Zoom Fit Page.pdf");

LinkAnnotation linkAnnot = (LinkAnnotation)document.Pages[1].Annotations[1];

Dim newGotoAction As New Aspose.Pdf.InteractiveFeatures.GoToRemoteAction("..\somefolder\somefile.pdf", 1)

Dim newDest as New Aspose.Pdf.InteractiveFeatures.XYZExplicitDestination(document,1, 0, 0, 0)

newGotoAction.Destination=newDest

linkAnnot.Action=newGotoAction

by examining the properties at runtime it looks like it takes but when I actually save the document it does not maintain what was set.

I am guessing the easiest path at your end would provide a fix so FileSpecification.Name would correctly accept a new value.

Please Help

Hi Brent,


Sorry for the delayed response. As per my understanding initial requirements have been fulfilled and now as a new requirement you want to set destination path of link annotation a relative path . Please correct me if there is any difference in my understanding.


Thanks for your patience and cooperation.


Best Regards,

It is the same requirement however the solution that was implemented only allows for setting the destination to an existing file where we need to be able to set a destination to path that will exist just not currently. I think it was just an assumption that there would not be a restriction to the type of path that would be allowed. I suggested a remedy of correctly accepting setting the name property which would solve the issue. I understand where this on its own looks like a new request but it also is due to a limitation of the current fix. Is there a timing difference on your end for getting a fix for this? I think your question is an effort to decide whether this ticket can be closed and create a new one or keep this one open. if there is no difference in time then I suppose it does not matter.


Brent

Hi Brent,


Thanks for your feedback. I’ve logged your request as PDFNEWNET-34892 in our issue tracking
system for further investigation and resolution and also linked your request to the issue id. You will be notified via this thread as soon as it is resolved.

Please feel free for contact us for any further assistance.


Best Regard,

Hi Brent,


Thanks for your patience. Your reported issue has been resolve. Please download and try latest Aspose.Pdf for .NET dll. Now it allows LinkAnnotation to accept a destination path that doesn’t exist at the moment.

Please feel free to contact us for any further assistance.

Best Regards,