[pdftex] Hover effects in pdftex.

Tigran Aivazian tigran at bibles.org.uk
Wed Nov 9 01:42:37 CET 2005


Thank you, Heiko, your version works!
that's exactly what I needed. And also thanks for the explanatory comments 
--- I learnt something.

Kind regards
Tigran

On Sat, 5 Nov 2005, Heiko Oberdiek wrote:

> On Fri, Nov 04, 2005 at 09:34:38PM +0000, Tigran Aivazian wrote:
>
>> 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?
>
> Try this (tested with AR7/Linux and AR5/Linux):
>
> \documentclass[10pt,a5paper,twoside]{book}
>
> \usepackage[bookmarks=false]{hyperref}
> % only used for \pdfstringdef
>
> \makeatletter
> \newcounter{tooltip at counter}
> \setcounter{tooltip at counter}{0}
>
> \newcommand{\annotate}[2]{%
>  \stepcounter{tooltip at counter}%
>  \pdfstringdef\tooltip at pdfstring{#2}%
>  % For each annotation the /T field must be different.
>  % This is not supported by \pdfstartlink, if the link
>  % is broken across lines.
>  \mbox{%
>    \pdfstartlink user{%
>      /Subtype/Widget%
>      /T(tooltip\number\value{tooltip at counter})% unique name
>      /FT/Btn%
>      /TU(\tooltip at pdfstring)% tooltip text
>    }%
>    #1%
>    \pdfendlink
>  }%
> }
> \makeatother
>
> \begin{document}
> \pagestyle{empty}
>
> \annotate{Hellog}{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}
>
>> 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.
>
> The /Text annotation doesn't use the rectangle, it puts a
> sticky note at the upper left corner, more or less visible.
> The size of the rectangle is invariant regarding the current
> zoom level.
>
>> 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 :)
>
> Some hints:
>
>> \immediate\pdfxform attr {
>> 	/Subtype /Form
>> } \appbox
>
> pdfTeX already adds this, thus this "attr{...}" part can be dropped.
>
>> \newcommand{\annotate}[2]{%
>> #1%
>
> You can have line/page breaks, strechable/shrinkable glue inside #1.
>
>> \settowidth{\wordwidth}{\mbox{#1}}%
>> \settoheight{\wordheight}{\mbox{#1}}%
>> \settodepth{\worddepth}{\mbox{#1}}%
>
> The \setto... macros already put the argument in a box, thus
> the additional \mbox level is not necessary.
>
>>   {
>>     /Subtype /Text
>>     /T (word: #1)
>>     /Contents (Explanation: #2)
>>     /AP << /N \theappobj\space 0 R >>
>>   }%
>> }
>
> You can get smaller PDF file sizes if the unnecessary spaces
> are removed, eg. before "/", "<", "(", "[" or after ")", "]" and ">".
>
> Yours sincerely
>  Heiko <oberdiek at uni-freiburg.de>
> -- 
>
> _______________________________________________
> pdftex mailing list
> pdftex at tug.org
> http://tug.org/mailman/listinfo/pdftex
>



More information about the pdftex mailing list