The Bigger Picture
AcroJS can be stored in the following places:
Application Level Scripts
Allows updating of your scripts without having to update your PDF's.
Easy to disable (simply rename the files' extension to something other than .JS).
Almost impossible to secure -- anyone will be able to read how bad your code is (err, I mean how good it is).
Often requires more support for not-so-competent end users.
Only loaded on startup, so if you make changes to an external .JS you'll need to restart Acrobat.
Document Level Scripts
In the early days this way the primary place of existence for AcroJS, nowadays we are spoiled for choice. Document Level Scripts are stored INSIDE the PDF document, which depending on how you work could be a good thing or a bad thing.
AcroJS at the document level can mean more than one thing:
Document Action Scripts: Document Will Open, Document Will Close, Document Will Print, Document Did Print are all events that happen (or can happen) that Acrobat allows you to 'hook into' and do stuff when these events occur.
Document Scripts: Not triggered by an event such as document opening or closing but rather can be called by other scripts in other places (i.e., form field or application level scripts).
Your script goes with your PDF, so there's never a chance you'll forget to package it.
Good for storing common tasks or scripts that are repeatedly called; I like to think of these scripts as the main place for central repositories.
Can respond to events at the Document level (opening, closing and printing).
If your PDF is large and too cumbersome to send over email it'll make updating the Document Level Scripts quite a chore.
Page Level Scripts
There's actually only two places that you can put your page level scripts, right behind door number one which is Page Open Scripts or door number two: Page Close Script.
Basically whenever either of these two events happen -- that is whenever a page in a PDF document is opened (including when you open the PDF document and it opens up a page) and of course the opposite, when a page in the PDF document is closed.
Great for when you need something to happen when a page is opened of closed.
Useful when you have a movie or sound annotation that you want to start or finish based on the page events.
You can't respond to other events, only Page related events.
Availability of some resources can be limited depending on timing of your page loading etc.
Form Field Level Scripts
and more ...
You can check the stuff entered into form field by your users
Adding up numbers and ensuring the numbers entered are correct is dead simple.
Using other scripts contained in other places is easy.
The validation for any particular field can be contained in the field, which means it goes with the field wherever it goes.
You can't access these scripts from other places in your PDF document (at least not easily).
If you've got LOTS of fields it can be a real pain to update your broken or out-of-date scripts (unless of course you never make mistakes).
To prevent this paragraph from turning into a story on FDF and its many virtues I'll let you have a gander through our resources sections.
Solves some of those batch update issues mentioned above
Can be injected into PDF files over the web
In most cases it isn't secure (it's plaintext after all)
Can be difficult to maintain when you have different PDF's with lots of Form Fields.
Phew, So Now what?
If you didn't go and eat your lunch during the last part then you should know a little bit more about some of the places that you can put AcroJS in Acrobat/PDF.
This is probably the most likely choice for using AcroJS, you want to be able to automate the tasks that you hate doing, or would rather not be doing because they take so loooong. A good example of this is when you need to set the Document Information for lots of PDF files or rotate the pages in certain documents: automation just makes sense.
Manipulation -- what on earth do I mean here? Rotating, Deleting and Cropping Pages, Insert Pages from other documents, exporting form field data, connecting to web resources and much, much more.
Form Field Control
My favorite use of AcroJS is manipulating Form Fields. You can validate the data inside form fields, create new form fields, spawn brand new pages based on user input, move form fields around on the page.
Still only available in the full versions of Acrobat (Std/Pro), Acrobat Database Connectivity (ADBC) allows you to talk SQL (Structured Query Language) to any database you like (and even the ones you don't like).
Optional Content Groups
Layers are fully scriptable. The full potential of Layers hasn't really been explored, but there are lots of resources available to explain some of the more basic concepts available to you when it comes to Layers and AcroJS.
I would recommend reading the articles by D.P. Story on Batch Sequences; he does an excellent job explaining how to setup Batch Sequences and gives some great ideas on where they can be used.
Where to from Here?
To get started, read through the rest of the articles in this learning centre, also it would be a good idea to have a wander and perhaps even read more of the articles referenced at the bottom of this article.
When you need more specific advice or help, participate in the Forums (of course right after you do a search to see if your question hasn't already been answered before ;).
Debenu, released version 10 of their pioneering PDF SDK, Debenu Quick PDF Library. Available in single and multi licenses for Windows, Mac and Server development. In an important step forward for the SDK a range of great new innovative features and enhancements have been included.
OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.