I tried to use tdclock package to embed a stopwatch in a beamer PDF file.

However, Adobe Reader is the only PDF viewer that can properly display the stopwatch/clock without those empty red boxes. Nevertheless, Adobe Reader is sluggish and crashes frequently when opening my presentation file.

In addition to embedding a stopwatch/clock, my presentation file has a movie (embedded by media9 package) which can be properly loaded/played in Adobe Reader and Foxit Reader. Unfortunately, Foxit Reader can't load tdclock stopwatch/clock and replaces it with empty red boxes despite enabling javascript and marking the file as safe.

My questions are:

  1. are there any alternatives to tdclock package?
  2. is it possible to fix the empty red boxes issue in Foxit Reader?
  3. what is the PDF viewer that can properly load tdclock clock/stopwatch and play embedded movies flawlessly?

Not a stopwatch, but another digital clock implementation showing the wall-time, working out of the box in AR and Foxit.

No empty red boxes in non-conforming PDF viewers, no save-the-changes dialog upon closing the document in AR and Foxit:


% Digital Clock
% Usage:
%   % set-up (defaults)
%   \def\clockfont{Helvetica} % or Times
%   \def\clockfontscale{0.93}
%   \def\clockformat{yyyy/mm/dd HH:MM:ss}
%   \def\clockrefresh{1000} % milli-seconds
%   % insert clock
%   \digiclock

  function showtime#3(){%
    this.getField("digiclock.#3").value=util.printd("#1",new Date());%
  try{var digiclock#3=app.setInterval("showtime#3()",#2);}catch(e){}%
  \extractcolorspec{.}\clock@tempb% current color (\setcolor{...})
        /Subtype/Widget/FT/Tx/T (digiclock.\theclock@num) /Ff 1
        /DA (/\clockfont\space 0 Tf \clock@tempa\space rg)
        /MK<</BC []/BG []>>
        /Q 2
        /BS <</W 1/S/S>>
      %this is for Foxit compatibility: Widget annots don't seem to acknowledge /P* events;
      %therefore, we move /AA into a separate Screen annot
        /Subtype/Screen/F 2%
        /AA <<%
          /PO <</S/JavaScript/JS(\clock@start{\clockformat}{\clockrefresh}{\theclock@num})>>%
          /PC <</S/JavaScript/JS(\clock@stop{\theclock@num})>>%
    \vrule width 0pt height 0.5\ex@height depth 0.5\ex@height%
\def\clock@rgbcomp#1,#2,#3\@nil{#1 #2 #3}
%default settings
\def\clockformat{yyyy/mm/dd HH:MM:ss}


%page foot


  \Large Current date \& time: \digiclock


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.