Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How would I capture the url target of a clicked link or redirect the event handler?

$
0
0

I have a WPF application with a tabControl in which I have two tabs. The first contains a userControl with an Acrobat reader in it, the second has a webBrowser. I want to capture the url's of links clicked in the PDF file in tab one and have them display on the browser in tab 2. I read a few posts about using a JavaScript to call a method in my form that would navigate the browser to the link the script passed but was unable to get it working. I'm fairly new to programming and I honestly don't know how to get the script run in Acrobat to call a method in the code-behind of the app. I know that the Acrobat reader is MainWindow.tabControl1.tabItem1.WindowsFormsHost1.uc.axAcroPDF1 and the method I want to call is in my MainWindow class 

public void capturePdfUrl(string address)

{

webSurf(address);

}

the webSurf() method just handles all the parsing and validating of string input to properly formatted url then calls webBrowser1.Navigate(formattedUrl);

the javascript run by the PDF file when a link is clicked is:

Window.external.capturePdfUrl(http://an address to info on a wiki);

Additionally, I would like for the PDF file to be included in my build when I publish the project rather than being referenced externally. I didn't see any ResourceManager solutions that would allow me to reference it in that way. And I've tried adding a folder to my project but can't find a reference to it that works. I would have assumed it would be :

uc.axAcroPDF1.src = @".\folderName\filename.pdf";

but that doesn't work. The only thing that does work is a full path to the VS projects folder but hen when I publish the literal reference will break. So I need a relative reference to the folder within the project.

Thanks for your help

Matthew





Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>