Expand my Community achievements bar.

Execute Javascript in the background (asynchronous task)

Avatar

Level 8

There is a form that requires images with more than 50 images.

We have developed an integrated Image Quality Process that will do the following:

  1. Upon inserting an image onto an image field, the process will generate 3 version of the image quality: Low, High, Original, and save them on the server
  2. Before submit, bring the low quality version for all image fields
  3. On form load, bring the original quality for all image fields.

Now the above is working fine, but as you might have guessed, there is a performance hit, which is bad.

Now, we are introducing a new change which is as follows:

  1. No change when inserting new image.
  2. Before submit, set all image fields to null (or to a very small version of the image), this will be make it much faster to submit (hopefully).
  3. On form load, bring all image fields using asynchronous process, in other words, in a background job. This will allow the user to start working on the PDF Form which the images are being loaded.

Question:

How we can run a process or a function in Javascript under XFA in the background? Do you think this is a practical solution?

Tarek

1 Reply

Avatar

Level 10

Hi Tarek,

That is quite a challenge.

I think I would try and trigger the image loading in a layout event, so once an image is rendered the code in the layout event will make a server call to render the next image, which will fire another layout ready event.

There will be a bit of work to keep track of where you are up to and when you have got to the last image.

Have a look at this sample. Adobe LiveCycle Designer Cookbooks by BR001: Season Planner (or Year Planner) PDF Template , doesn't do any server calls but does use the layout ready event to continue the next layout.