How much javascript can a PDF document handle ?
Copy link to clipboard
Copied
This may be a ¨how long is a piece of string question¨, but I am hoping someone out there has experienced the following issue so I can
determine the limits of what Acrobat DC can do for my project.
I am creating Primary Maths Resources so that teachers have more material to work with in the class.
This may be a ¨how long is a piece of string question¨, but I am hoping someone out there has experienced the following issue so I can determine the limits of what Acrobat DC can do for my project.
I am creating Primary Maths Resources so that teachers have more material to work with in the class beyond the textbook without having to search the Internet.
Why Adobe Acrobat ?
I want to use the same graphics as the textbooks (which are already available in pdf format).
I want the resources to be available off-line for when the internet fails (it happens !!).
Why the need for javascript ?
With javascript I can create pages of exercise that can be randomized at the touch of a button.
I can take one page from the textbook and create 5 more that will have questions at different levels (differentiation) for slow to fast learners - all on the same pdf document if needed.
As a result a Maths textbooks of 100 pages becomes, via acrobat dc, a resource of 500 or more additional pages.
Note: I am not a programmer but have manage to find on the internet javascript routines which I have been able to adapt.
So what is the problem ?
As I gather the pages I have created together into one document I start to see a significant slowdown on some of the pages when loading up.
It may be that I am not using the most efficient coding or I am using acrobat dc beyond what it was intended for.
I am interested in the experience of anyone else who has taken Acrobat DC into other areas than just creating forms and has come across this problem.
Also anyone who has tried using Acrobat for creating resources for Mathematics.
Copy link to clipboard
Copied
There are a couple of pieces to this.
Acrobat comes with a a built-in JavaScript editor that is very limited and uses only the memory space available to Acrobat. This results in the amount of JavaScript that can be edited. The solution to this limitation is to use the Preference option for JavaScript to allow for the use of an external text editor. Enabling this option allows one to select the text editor of their choice. Many of the text editors provide a larger and more powerful editor. Memory space for editing can be dynamically allocated as needed, a more structured format of the entered code is available, find and find replace tools become available, as well as macros to automate editing tasks become available.
Since JavaScript is stored as text, a lot of code can included within a form. It is not unheard of to have one function of up to 1,000 lines to be included within one PDF along with other scripts.
It is not uncommon for any dynamic file to be less responsive as more and more interactivity is added. Also JavaScript is an interpretive scripting language which means that each line of code is converted into executable instructions each time it is read. This can be reduced by creating document level and folder level functions of JavaScript which tokenizes the text and reduces the amount of processing needed to run the code.
There is also no need to have only one file providing these resources. One can use the Portfolio feature of Acrobat to provide several PDF files in a central repository that can be individually opened. Also PDF files can be placed in folders and linked.
Have you looked to the work of D.P. Story and AcroTex product?
Copy link to clipboard
Copied
Thanks for the quick reply and some very helpful hints.
External Editor: On the PC I had no problem using one, but since moving to a Mac they all seem to crash, so I now use Googledocs to build and correct my scripts and then copy and paste them back in. This also helps me keep an external copy of the javascript which I reuse on other pages. However some scripts will not open in Acrobat if they are too long so I then revert to a text editor temporarily. If you know of one that works well on a Mac. I would be interested in knowing.
I don´t think I have reached 1000 lines yet. I am not sure I have enough understanding of javascript to know what to put at a document/folder level as opposed to an individual page. Any hints or examples would be useful. I will look at the Portfolio feature & folder/link system to see how these function.
AcroTex looks very interesting (and not expensive) but could not find anything on the work of D. P. Story.

