GoToAction and GoToRemoteAction

Regarding GoToRemoteAction

I used your example of how to add link to external pdf, found here.

The example shows:

link.Action = new GoToRemoteAction("C:\\Junk\\test.pdf", 2);

The example works fine, except for one issue: In Acrobat, it opens the remote document in the same window as the source document.

Can I force the external document to load into a new window in Acrobat Reader or any other comparable renderers? I am wondering if there is such a property as:

link.Action = new GoToRemoteAction("C:\\Junk\\test.pdf", 2, openInNewWindow);

I am not sure if the PDF standard supports this capability, but it would be nice if it did and even nicer if Aspose supports it.

Regarding GoToAction

Visual Studio is showing a warning message that GoToAction() is deprecated. It also advised to use constructors when initializing it. This is ambiguous to me. Should I be fine with initializing it with constructors, or is the message intending to direct me to use some other method which is supposed to replace it?

Also, I can't succeed in using it because I am not clear on how to set the value of Destination. Please fill in what comes after this:

{ Destination = What goes here? }

I unsuccessfully tried new Aspose.Pdf.InteractiveFeatures.IAppointment() since Destination tells me it is of that type.

Thanks.


Hi Jeff,

Thanks for your interest.

jeffmatt:
Regarding GoToRemoteAction

I used your example of how to add link to external pdf, found here.

The example shows:

link.Action = new GoToRemoteAction("C:\\Junk\\test.pdf", 2);

The example works fine, except for one issue: In Acrobat, it opens the remote document in the same window as the source document.

Can I force the external document to load into a new window in Acrobat Reader or any other comparable renderers? I am wondering if there is such a property as:

link.Action = new GoToRemoteAction("C:\\Junk\\test.pdf", 2, openInNewWindow);

I am not sure if the PDF standard supports this capability, but it would be nice if it did and even nicer if Aspose supports it.




You can open new document in new windows, use NewWindow property of GoToRemotaAction object to to specify destination document that should be opened in new window, while creating a Hyperlink. Please check following sample code, it will help you to accomplish the task.

....

....

Aspose.Pdf.Page page = document.Pages[SourcePageNumber];

// create Link annotation object

Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation link = new Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation(page, new Aspose.Pdf.Rectangle(llx1, lly1, urx1, ury1));

// create border object for LinkAnnotation

Aspose.Pdf.InteractiveFeatures.Annotations.Border border = new Aspose.Pdf.InteractiveFeatures.Annotations.Border(link);

// set the border width value as 0

border.Width = 1;

border.Style = Aspose.Pdf.InteractiveFeatures.Annotations.BorderStyle.Solid;

// set the border for LinkAnnotation

link.Border = border;

link.Color = Aspose.Pdf.Color.Blue;

// specify the link type as remote URI

link.Action = new Aspose.Pdf.InteractiveFeatures.GoToRemoteAction(aURL, DestinationPageNumber);

(link.Action as GoToRemoteAction).NewWindow = ExtendedBoolean.True;

// add link annotation to annotations collection of first page of PDF file

page.Annotations.Add(link);

....

....

jeffmatt:

Regarding GoToAction

Visual Studio is showing a warning message that GoToAction() is deprecated. It also advised to use constructors when initializing it. This is ambiguous to me. Should I be fine with initializing it with constructors, or is the message intending to direct me to use some other method which is supposed to replace it?

Also, I can't succeed in using it because I am not clear on how to set the value of Destination. Please fill in what comes after this:

{ Destination = What goes here? }

I unsuccessfully tried new Aspose.Pdf.InteractiveFeatures.IAppointment() since Destination tells me it is of that type.


In reference to GoToActions() only constructor without parameter is depreceted, you can use other overloads e.g.

double zoom = 1.5;

Document doc = new Document(myDir + "35294.pdf");

GoToAction action = new GoToAction(new XYZExplicitDestination(doc.Pages[1], doc.Pages[1].Rect.Width, doc.Pages[1].Rect.Height, zoom));

....

....


Please feel free to contact us for any further assistance.


Best Regards,