Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Explorer ,
Dec 11, 2016 Dec 11, 2016

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.

TOPICS
Acrobat SDK and JavaScript , Windows
507
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 12, 2016 Dec 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 12, 2016 Dec 12, 2016
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines