Skip to main content
Known Participant
December 12, 2016
Question

How can i precompile folder-level JavaScript programs and use precompiled bytecodes in Acrobat?

  • December 12, 2016
  • 2 replies
  • 555 views

According to the Adobe Acrobat SDK: JavaScript™ for Acrobat® API Reference, a precompiled bytecode version of several JavaScript files in the App JavaScript folder was used to improve the performance of Acrobat Pro.

I have several folder-level JavaScript programs.

1. Can I use a precompiled bytecode version of my folder-level JavaScript programs with Acrobat Pro? If so how can I use it?

2. Would it improve Acrobat's performance?

3. How can I generate a precompiled bytecode version of my JavaScript programs?

I have several document-level JavaScript programs.

1. Can I use a precompiled bytecode version of my document-level JavaScript programs with Acrobat Pro? If so how can I use it?

2. Would it improve the performance of Acrobat Pro?

Thanks.

This topic has been closed for replies.

2 replies

Karl Heinz  Kremer
Community Expert
Community Expert
December 12, 2016

As was already mentioned, there is no documented method to compile JavaScript to byte code. By adding folder level scripts, you are already taking advantage of these scripts only having to be loaded once. When Acrobat starts, it will load (and compile to byte code internally) all folder level scripts, so when you call a function from one of these scripts, it does not have to be interpreted again.

As far as I know, Acrobat is using SpiderMonkey as it's JS engine. It might be possible to use a standalone SpiderMonkey implementation to compile byte code that Acrobat will accept. I would not expect this to work, and even if a first test would look like success, I would not trust this unsupported and undocumented way to pre-compiling folder level scripts.

try67
Community Expert
Community Expert
December 12, 2016

I don't think you can do that yourself. JS is an interpreted (ie, non-compiled) programming language by definition.

I think Adobe converted some JS code to machine code and deployed it with Acrobat, but that's not something you as an end user can do.