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

Access app-level functions from browser?

ErinR
Registered: Jul 9 2007
Posts: 8

I want to be able to call functions I've created in an application folder .js from events initiated by IE. Is this possible? I am not using an tag, just setting the url of an iframe to the pdf I want, but could change to use the if that would get us where we want to go.

Thanks in advance!

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Within an open PDF you should be able to do this on your system, but other can not without adding the JS file in your Acrobat JavaScrips file to their system. You just call it like another function.

George Kaiser

ErinR
Registered: Jul 9 2007
Posts: 8
Right, we will be able to add the .js to the users' folders because it is on an intranet and we have control over the environment. However, when I try to reference a function I've created through regular page javascript, I get an "object expected" error.

function testThisOut()
{
app.alert("testing!");
var doc = app.newDoc();
doc.saveAs({cPath:"/C/testPDFErin.pdf"});
doc.closeDoc(true);

}
var myTestThisOutFn = app.trustedFunction(testThisOut);

If I try to reference this function from the javascript in the browser, it doesn't see it. Anything else I have to do to make it visible?
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
And the path exist on all the systems you are trying to call this function from?

George Kaiser

ErinR
Registered: Jul 9 2007
Posts: 8
This isn't the function I want to call in the end, I just wanted to test out on my machine to see if I could get IE to call the app functions. What I want to do is create my own print function that sets certain printParams attributes, and then be able to call it from the browser when the user clicks a "Print" button in our application.
ErinR
Registered: Jul 9 2007
Posts: 8
Or is there another way I can programmatically set the printParams "across the board"? We need to turn page scaling off all the time for our users. I don't have control over the documents themselves, and they are generated on the fly so we can't use a batch command. I was thinking making my own print command that I could pass the printParams I wanted was the only way, but I'm new to this stuff. . .

Do I need to somehow reference adobe when calling my function from the browser? For example do I just do:
myFunction(docPath)
-or-
Do I need to call:
AcroRd.myFunction(docPath)
or something similar. This might be my problem, I can't figure out how to get ahold of the the running instance of Adobe from the browser.