|
|
OK, thank you! I get Text from Link like this: Code: Private Sub PdfView_BeforeLinkClicked(sender As Object, e As EventArguments.PdfBeforeLinkClickedEventArgs) Handles PdfView.BeforeLinkClicked
Dim weblink = e.WebLink
Dim link = e.Link
Dim pageIndex = PdfView.CurrentPage.PageIndex
Dim page As PdfPage = PdfView.Document.Pages(pageIndex)
'Dim document = PdfView.Document.Handle
If Not IsNothing(link) Then
'Dim _handle = link.Handle
Dim pdfLink = page.Text.GetBoundedText(link.AnnotationRect)
If Not String.IsNullOrWhiteSpace(pdfLink) OrElse Not String.IsNullOrEmpty(pdfLink) Then
If IsNothing(link.Destination) Then
Debug.WriteLine("DestinationType - Nothing")
Debug.WriteLine(pdfLink)
e.Cancel = True
CefSharp.WebBrowserExtensions.LoadHtml(frmWebBrowser.ChromiumWebBrowser,
frmWebBrowser.CreatePage(pdfLink))
tabBrowser.ShowOnlyMe()
End If
End If
End If
End Sub
|
|
|
Hello, for web links PdfWebLink.UrlInfo property to get URL for other links the Destination/Action property. Here are еру details about actions https://pdfium.patagames...l/WorkingSDK_Actions.htmand Destinations https://pdfium.patagames...kingSDK_Destinations.htmThe destination cannot be a URI, so the action is of interest to you. Code:public virtual void ProcessAction(PdfAction pdfAction)
{
switch (pdfAction.ActionType)
{
case ActionTypes.Uri:
var ps = new ProcessStartInfo((pdfAction as PdfUriAction).ActionUrl) { UseShellExecute = true, Verb = "open" };
Process.Start(ps);
break;
}
}
Links (web links, actions, and destinations) do not contain text on their own. They are placed above the text object (or any other object). so you need to get the bounds of the link and get the text using the GetBoundedText method. page.Text.GetBoundedText()
|
|
|
Hi! I´m trying to get a value of a link clicked in pdf. In "PdfBeforeLinkClickedEventArgs" the "e" is not giving me enough information! I´ve tried that so far: Code:Private Sub PdfViewer1_BeforeLinkClicked(sender As Object, e As Patagames.Pdf.Net.EventArguments.PdfBeforeLinkClickedEventArgs) Handles PdfViewer1.BeforeLinkClicked
e.Cancel = True
Dim weblink = e.WebLink
Dim link = e.Link
Dim pageIndex = PdfViewer1.CurrentPage.PageIndex
Dim page As PdfPage = PdfViewer1.Document.Pages(pageIndex)
If Not IsNothing(weblink) Then
Debug.WriteLine("Weblink")
End If
If Not IsNothing(link) Then
Dim _handle = link.Handle
For Each _pair In link.Dictionary
'I need text written on control and destination URI
Next
End If
End Sub
|
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close