views:

95

answers:

2

This is a probably a dumb question but here is what I've got.

A web developer has a secure login page that after a user logs into it, a database reference is made and it grants rights to a particular PDF file on our network. There is desire to have a custom locally designed application used to present that PDF file to the user, which is fine as I have used cpp code from Adobe to generate a stripped down viewer, however the problem I'm faced with is integrating his web application into my windows application.

It would be easier for me to just create my own login/database query, but then I'd basically be removing his entire piece of the project. That in itself presents a problem, as really this entire thing is his project and he asked me for help. So that's why I'm stuck with this situation where I"m attempting to insert a web applet in the application to present his login page. From that login page, after it authenticates, he can return a path to that particular file. He was previously just launching the associated PDF viewer (Acrobat), but what we need is a fully integrated solution. Make sense?

A: 

InvokeScript.

http://msdn.microsoft.com/en-us/library/cc491132.aspx

Have the webmaster write something like this:

<script type="text/javascript">
function getPdfPath() {
  return "/path/to/my.pdf";
}
</script>

You should then be able to:

var path = (string) oWebBrowser.InvokeScript("getPdfPath");

Alternately, you could have him write you a web service.

steamer25
Exactly what I was looking for, thanks!
unrealtrip
A: 

Have a look at the ObjectForScripting property of the WebBrowser. It allows you to define an object whose methods can be called by Javascript code

Thomas Levesque