|Language:||English, Indonesian, Japanese|
|Genre:||Health & Fitness|
|ePub File Size:||20.84 MB|
|PDF File Size:||9.65 MB|
|Distribution:||Free* [*Registration Required]|
This class provides methods for communicating with a PDF viewer. In particular, this class contains alert method with a number of overloads. The alert method can be used to present a modal window with a message.
Fillable forms often contain date fields. These fields might look like this: Sure, a creator of a document can just add date field to the document and stop there.
However, it would be nice to assist someone who will fill document later by putting current date to the date field. In most cases this will be just what is expected.
This should be taken into account if you are going to support anything other than Adobe Reader. Another approach is to implement custom code that does the same as util. Please also notice that code populates a field only if it's empty. Without this additional check a following scenario might occur: a person fills the document, saves it but next time the document is opened all date fields are reset with current date.
In this case, the host container is the web browser. Because of that limitation, this example may not work for you or for a segment of your customers. The code in 5 creates a message handler for the host container. It also defines a function to handle messages 3 and errors 4. The method postMessage in 2 of listing 2 passes a message to the onMessage method of the messageHandler.
This message handler is created in the createMessageHandler 1 in listing 1 that was triggered when the HTML page was loaded; see the onLoad attribute of the body tag. The results of this operation are shown in Figure 7 below. Note that yet again, the result is something different. The result shown in Figure 7 tells us the type of object created. This result is only useful in letting us know the function worked. If app. Both of these situations would have been displayed in the Console Window.
The path property is exactly what you might think it should be. It's the folder path of the current document. Since the current document was just created with app.
This line of code instructs Acrobat to open a file xx. Acrobat responds by generating an error, which is displayed by the Console Window, shown in Figure 8. This message is critical to understanding why the code failed, especially if the function call is buried in several lines of code inside another script.
Always check the Console Window first when something goes wrong. Note that the second message on the line indicates a security error.
We can also create our own messages for display in the Console Window. This object provides a few functions for manipulating and accessing the Console Window, but for our purposes here the console. This function displays a single line of text on the next available line in the Console Window. The following line of code displays the words "Hello Acrobat.
It is a good practice to use this code or something like it whenever you start a new document scripting project to get a feel for how the different scripts will interact. Watch the Console Window to monitor the sequence of scripts that are executed as you open and close the document, navigate between pages, move the mouse around the document or perform other actions. If you are developing scripts that will be used in Adobe Reader, then it is a good idea to be able to test and debug them in Reader.
Adobe added Console Window support to Reader in version 7.
However, setting up Reader to actually display the Console Window was very difficult. It required installing special scripts and manually changing Acrobat settings in either the Windows Registry or the Macintosh settings files.
It has become much easier in Reader XI. There is only one thing you need to be able to do to use the Console Window, and that is to display it. Displaying the Console Window in Reader is a bit more difficult than one might think it should.
It is up to the developer to decide what information to display.
The alert method can be used to present a modal window with a message. The result shown in Figure 7 tells us the type of object created. Now we have a clean work area and are set up and ready to start using the Console Window. Notice that in the loop there is a function called console.
It is the code of the structure of a webpage.
Enter the following line in the Console Window and run it:.