[pdftex] Hover effects in pdftex.
Tigran Aivazian
tigran at bibles.org.uk
Fri Nov 4 22:34:38 CET 2005
On Tue, 1 Nov 2005, John R. Culleton wrote:
> Once again I am late to the party. Is it the same mechanism as
> pdfannot? Can you suggest a document or example to read?
You can gather bits of knowledge from movie15.sty and some other bits of
knowledge from attachfile.sty. You can also try the enclosed example I
wrote when I was experimenting with this feature. This example is not
complete, i.e. I wasn't able to get the appearances working correctly and
so an icon is displayed if you click on the active area.
Also, it is very unstable, i.e. you have to position the mouse very
carefully to get it right. I am not sure if this is a bug in my sample
code or a generic unstable behaviour of Adobe Acrobat reader.
Ok, I know that my sample is far from perfect, but since it is the only
thing that exists (to my knowledge) that even attempts to do this --- it
is a good place to start. And don't forget to email me the working version
when you have fixed it :)
Kind regards
Tigran
\documentclass[10pt,a5paper,twoside]{book}
\usepackage[bookmarks=false]{hyperref}
\newcommand{\PushPindata}{%
q 1 1 1\space rg 0 G 1 w 1 6 m 11 6 l 11 13 l 12
13 l 14 11 l 21 11 l 22 12 l 23 12 l 23 2 l 22 2 l 21 3 l 14 3
l 12 1 l 11 1 l 11 6 l B 0.5 G 0 7 m 10 7 l 10 8 l 1 8 l S 1 G
12 12 m 14 10 l 22 10 l 22 11 l S Q
}
%\DeclareRobustCommand{\PushPin}{%
% \raisebox{-1.25bp}{\parbox[b][14bp]{24bp}{%
% \rule{0pt}{0pt}\pdfliteral{\PushPindata}}%
% }%
%}
\DeclareRobustCommand{\PushPin}{%
\null%
}
\newcounter{appobj}
\newsavebox{\appbox}
\savebox{\appbox}{\PushPin}
\immediate\pdfxform attr {
/Subtype /Form
} \appbox
\setcounter{appobj}{\pdflastxform}
\newlength{\wordwidth}
\newlength{\wordheight}
\newlength{\worddepth}
\newcommand{\annotate}[2]{%
#1%
\settowidth{\wordwidth}{\mbox{#1}}%
\settoheight{\wordheight}{\mbox{#1}}%
\settodepth{\worddepth}{\mbox{#1}}%
\pdfannot
width -\wordwidth
height \wordheight
depth \worddepth
% width 0pt
% height 0pt
% depth 0pt
{
/Subtype /Text
/T (word: #1)
/Contents (Explanation: #2)
/AP << /N \theappobj\space 0 R >>
}%
}
\begin{document}
\pagestyle{empty}
\annotate{Hello}{English greeting.}
\annotate{world}{Whole planet Earth.}
\annotate{and}{English conjunction.}
\annotate{the}{English definite article.}
\annotate{rest}{The rest, you know.}
\annotate{of}{Short English word.}
\annotate{the}{English definite article.}
\annotate{Universe!}{A differentiable manifold.}
\annotate{Hello}{English greeting.}
\annotate{world}{Whole planet Earth.}
\annotate{and}{English conjunction.}
\annotate{the}{English definite article.}
\annotate{rest}{The rest, you know.}
\annotate{of}{Short English word.}
\annotate{the}{English definite article.}
\annotate{Universe!}{A differentiable manifold.}
\annotate{Hello}{English greeting.}
\annotate{world}{Whole planet Earth.}
\annotate{and}{English conjunction.}
\annotate{the}{English definite article.}
\annotate{rest}{The rest, you know.}
\annotate{of}{Short English word.}
\annotate{the}{English definite article.}
\annotate{Universe!}{A differentiable manifold.}
\annotate{Hello}{English greeting.}
\annotate{world}{Whole planet Earth.}
\annotate{and}{English conjunction.}
\annotate{the}{English definite article.}
\annotate{rest}{The rest, you know.}
\annotate{of}{Short English word.}
\annotate{the}{English definite article.}
\annotate{Universe!}{A differentiable manifold.}
\annotate{Hello}{English greeting.}
\annotate{world}{Whole planet Earth.}
\annotate{and}{English conjunction.}
\annotate{the}{English definite article.}
\annotate{rest}{The rest, you know.}
\annotate{of}{Short English word.}
\annotate{the}{English definite article.}
\annotate{Universe!}{A differentiable manifold.}
\annotate{Hello}{English greeting.}
\annotate{world}{Whole planet Earth.}
\annotate{and}{English conjunction.}
\annotate{the}{English definite article.}
\annotate{rest}{The rest, you know.}
\annotate{of}{Short English word.}
\annotate{the}{English definite article.}
\annotate{Universe!}{A differentiable manifold.}
\end{document}
More information about the pdftex
mailing list