These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Controlling PDF from javascript within webpage. IAC API ?

Evan55
Registered: Nov 19 2009
Posts: 2

Im working on programmatically highlighting text within existing PDFs (returned from search results) while viewed in a browser window.

I can easily invoke the methods from the AxAcroPDFLib object in the IAC API, but the AcroExch object I do not see how to get a handle on. Is it possible to use this object from IAC (external) Javascript?

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
My understanding is that the AcroExch object API is only availible when the PDF is viewed in the stand alone Acrobat. It's the ActiveX interface for the full Acrobat app. The browser object exposes the smaller AxAcroPDFLib API.

But this doesn't mean you are SOL. There is a way to pass messages between HTML JS and PDF JS, if the PDF is displayed in a frame using the "Object" tag. The passed messages are just plain text. But a message handler in the PDF can use them to invoke other functions in Acrobat. For example, the "addAnnot()" function could be used to add a highlight to a page.

Take a look at the sample on this page:
http://www.windjack.com/resources/howto.php

Scroll down to the Browser/Acrobat Communication Example.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script