Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Javascript error when launching XFA pdf from browser


Level 2

Hi all,

I am trying to use my XFA PDF from a browser. On my local system I have  set up a web server and am launching my PDF from there. However, I am getting a ReferenceError with regards to one of my Javascript functions.

My PDF has dependency on a javascript file that resides in the Acrobat path as follows:

C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Javascripts\

When I use my PDF directly from an Acrobat instance, everything works fine. The issue comes up only when launching from server. How do I link the javascript file to my PDF?

Edit: The user is going to be launching the PDF from the server via a web browser. In such a case where do I place the javascripts?

Help appreciated,


4 Replies


Level 6

If the code needs to be in a folder-level JavaScript file because it includes code that needs to be executed from a privileged context, then each user would have to have the code installed in a folder-level script file as well.

For your problem, it would help to know what the code is, when it getting called, and exactly where you're calling it from.


Level 2

@George: thanks for the quick response!

My JS code contains a readFileIntoStream which I learnt is also to be run under privileged context. (still learning the ropes here.. ).  I have been trying to incorporate the JS code directly into the PDF to get around this privileged context..  but I am unable to find a non-privileged equivalent for readFileIntoStream..

Basically my users would be accessing the PDF from the server direct via the browser. For my testing purposes I am able to run the PDF directly from my desktop via an Acrobat instance without any hitch as the scripts are folder level like you mentioned. Is it possible for the users to be able to access the javascripts from anywhere on the server rather than directly from the PDF?  Please note, users will not be saving copies of the PDF on to their local machines (in which case we could have pushed the JS file along to their machines) . I need to ultimately run the PDF from browser.

I hope I am clear..



Level 6

You might want to provide more background about why you're using readFileIntoStream. What file are you reading?


Level 2

From my PDF,  I'm reading an external XML file that I pick up from a server share location. Based on the XML data, I am also reading another PDF, populating it with data from the XML and displaying the same to the user.. Hope this helps.