我尝试使用tdclock 包在 beamer PDF 文件中嵌入秒表。
但是,Adobe Reader 是唯一一款可以正确显示秒表/时钟而不显示那些空红框的 PDF 查看器。不过,Adobe Reader 运行缓慢,在打开我的演示文稿文件时经常崩溃。
除了嵌入秒表/时钟外,我的演示文件还包含一个电影(由media9
包嵌入),可以在 Adobe Reader 和 Foxit Reader 中正确加载/播放。不幸的是,尽管启用了 javascript 并将文件标记为安全,Foxit Reader 仍无法加载tdclock
秒表/时钟并将其替换为空的红色方框。
我的问题是:
- 还有其他包装替代品吗
tdclock
? - 是否可以修复 Foxit Reader 中的空红框问题?
tdclock
什么是可以正确加载时钟/秒表并完美播放嵌入电影的PDF 查看器?
答案1
这不是秒表,而是另一个显示挂钟时间的数字时钟实现,可在 AR 和 Foxit 中开箱即用。
不符合要求的 PDF 查看器中没有空的红框,在 AR 和 Foxit 中关闭文档时没有保存更改对话框:
\documentclass{beamer}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% 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
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{pdfbase,xcolor}
\ExplSyntaxOn
\let\clockPdfAnnot\pbs_pdfannot:nnnn\let\clockPdfLastAnn\pbs_pdflastann:
\let\clockAppendToFields\pbs_appendtofields:n
\ExplSyntaxOff
\makeatletter
\def\clock@start#1#2#3{%
function showtime#3(){%
this.getField("digiclock.#3").value=util.printd("#1",new Date());%
this.dirty=false;%
}%
try{showtime#3();}catch(e){}%
try{app.clearInterval(digiclock#3);}catch(e){}%
try{var digiclock#3=app.setInterval("showtime#3()",#2);}catch(e){}%
}%
\def\clock@stop#1{try{app.clearInterval(digiclock#1);}catch(e){}}%
\newcounter{clock@num}%
\newlength\ex@height%
\newlength\clock@width%
\newlength\clock@height%
\def\digiclock{%
\settowidth\clock@width{\clockformat}%
\settoheight\clock@height{\clockformat}%
\settoheight\ex@height{X}%
\extractcolorspec{.}\clock@tempb% current color (\setcolor{...})
\expandafter\convertcolorspec\clock@tempb{rgb}\clock@tempb%
\edef\clock@tempa{\expandafter\clock@rgbcomp\clock@tempb\@nil}%
\raisebox{\depth}{%
\makebox[\clockfontscale\clock@width][l]{%
\clockPdfAnnot{\clockfontscale\clock@width}%
{\clockfontscale\clock@height}{\clockfontscale\clock@height}{%
/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>>
}%
\clockAppendToFields{\clockPdfLastAnn}%
%this is for Foxit compatibility: Widget annots don't seem to acknowledge /P* events;
%therefore, we move /AA into a separate Screen annot
\clockPdfAnnot{1ex}{0.5ex}{0.5ex}{%
/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%
}%
\stepcounter{clock@num}%
}
\def\clock@rgbcomp#1,#2,#3\@nil{#1 #2 #3}
\makeatother
%default settings
\def\clockfont{Helvetica}
\def\clockfontscale{0.93}
\def\clockformat{yyyy/mm/dd HH:MM:ss}
\def\clockrefresh{1000}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usetheme{Madrid}
%page foot
\date[\def\clockfontscale{1.1}\def\clockformat{HH:MM:ss}\digiclock]{\today}
\begin{document}
\begin{frame}
\Large Current date \& time: \digiclock
\end{frame}
\end{document}