http://www.pdfscripting.
com
JavaScript Clock/Timer Demo
by Thom Parker
Stop Timer
WindJack Solutions, Inc.
We can make clocks and timers in a PDF by combining the date object with a timer. Timers are created in Acrobat JavaScript with the app.setInterval() function. As arguments this function takes the length of the timing interval in milliseconds and some JavaScript code to execute. In this file, the timer code is in a Document Script named ClockCode. The Timer control buttons below set state variables used in the timer function to control the internal time calculations and the display. The timer must be cleared before the document is closed. This is done with the app.clearInterval() function in the WillClose Action. Continuous Clock:
4:57:56 pm
Sunday Aug 17, 2008
24 hour
Local UTC
Portland New York
Hyderabad Tokyo
Stopwatch:
Stopped
00:00:00:00
Start
Stop
Pause
Clear
Count Down Timer:
00:00:00:00
+1 -1
Start
Stop
Clear
Set Hours:
+10
-10
Set Minutes:
+10
-10
+1
-1
Set Seconds:
+10
-10
+1
-1
Copyright 2006 by Windjack Solutions, Inc.
www.windjack.com