Skip to main content
Inspiring
November 16, 2017
Question

Using a WebBrowser control to view PDF and execute embedded javascript

  • November 16, 2017
  • 2 replies
  • 2236 views

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 has been closed for replies.

2 replies

Thom Parker
Community Expert
Community Expert
November 17, 2017

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

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Legend
November 16, 2017

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