Skip to main content
Inspiring
Nov 16, 2017 5:15 PM UTC
Question

Using a WebBrowser control to view PDF and execute embedded javascript

Hello,

How can I execute the embedded javascript inside a pdf?

I'm using the default WPF WebBrowser control to view a pdf. 

Here's the XAML:

<WebBrowser Name="_web"/>

In the .cs I do this to view the .pdf:

_web.Navigate("test.pdf");

Everything works great.  The test.pdf has a javascript method called "IsComplete".

How do I call the IsComplete method? 

I have Adobe Acrobat DC Pro installed.

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Thom Parker
Community Expert
Community Expert
Nov 17, 2017 2:43 AM UTC

I'm assuming you want to run the script from JavaScript on the web page?

You can do this through Acrobat's host container interface.  I don't know how well supported it is anymore, but here is a link to a site I build many years ago to test it out.

BTW: the site doesn't work. It's supposed to trade data between two PDFs, I don't know whether its because of changes in security or supported functionality.

But you're welcome to it

Browser JavaScript

Here's the entry in the Acrobat JavaScript Reference

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Legend
Nov 16, 2017 5:17 PM UTC

Have you seen anything to suggest you should be able to?

Translate