Invokes the specified document link target.
public virtual void RunLinkTarget(
DocumentLinkTarget linkTarget
)
linkTarget
Properties of the link target to invoke
RunLinkTarget is called internally by the document viewer and can be invoked by the user to perform the action specified by a DocumentLinkTarget object.
It is called internally when any of the following occur:
When DocumentViewerPageLinksInteractiveMode is active and user clicks on a page link that has the value of LinkType set to DocumentLinkType.TargetPage. Page links are parsed using DocumentPage.GetLinks.
When GotoBookmark is called (either called by the application or when the user user clicks on an item created by Bookmarks). RunLinkTarget is invoked with the value of DocumentBookmark.Target
The application can also create a custom DocumentLinkTarget that does not exist in the document and call RunLinkTarget manually.
In all cases, the following is performed:
If the value of PageNumber of linkTarget is not 0 and not equal to CurrentPageNumber, then GotoPage is invoked to move the view to the new target page.
View.RunLinkTarget is called to apply the page fit and zooming properties of the link target.
If the value of PageNumber of linkTarget is 0, then the current page is not changed, otherwise, if the value is not a valid page number, an exception is thrown.
Start with the example created in DocumentViewer, remove all the code in the Example function and add the code below.
When the user clicks the Example button, we will go to page number 3 in the document and set the fit mode to "page width".
using Leadtools;
using Leadtools.Controls;
using Leadtools.Document;
using Leadtools.Document.Viewer;
using Leadtools.Codecs;
using Leadtools.Caching;
using Leadtools.Annotations.Engine;
using Leadtools.Ocr;
// Create a new DocumentLink
// First the target, goto page number 3 and fit width
var linkTarget = new DocumentLinkTarget();
linkTarget.PageNumber = 3;
linkTarget.PageFitType = DocumentPageFitType.FitWidth;
// Now the link, of type goto-page
var link = new DocumentLink();
link.LinkType = DocumentLinkType.TargetPage;
link.Target = linkTarget;
// Run this link
_documentViewer.RunLinkTarget(linkTarget);