This is a JavaScript free version of a click-to-zoom box. (For pdfLaTeX, LuaLaTeX, XeLaTeX, LaTeX+Dvips.)
\zoombox[dotted box line width in px, default: 1]{<contents>}
It makes use of the "mouse-button-down" and "mouse-button-up" events in order to zoom in and out. In a lecture situation, this works quite reliably and should be sufficient for giving short explanations about a detail on the slide.
This was successfully tested with Acrobat Reader and PDF-XChange. Foxit Reader does not zoom-in correctly, which should be reported to the developers, in Evince it does not work at all.
The first code example targets beamer class documents and should be used in Full Screen/Presentation mode. The zoom target is centred on screen upon mouse button press. On button release, it zooms out to whole-page view. (This is more robust than returning to the previous view, used in the second code example.) For best performance, the document's aspect ratio (beamer option aspectratio) should match the target video projector or monitor.
For beamer class document:
\documentclass[
aspectratio=169,% must match the target video projector/monitor, default: 43
hyperref={pdfpagemode=FullScreen}
]{beamer}
\usepackage{graphicx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% usage: \zoombox[<dotted border width in pix, default: 1>]{<content>}
%
% * optimized version for BEAMER class:
% - zoom target centred on screen upon zoom-in (mouse btn press)
% - whole-page-view upon zoom-out (mouse btn release)
%
% * !! to be used in FULL-SCREEN mode !!
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{pdfbase,calc}
\ExplSyntaxOn
\let\pbsPdfDest\pbs_pdfdest:nnnn
\let\pbsPdfAnnot\pbs_pdfannot:nnnn
\ExplSyntaxOff
\newsavebox\zbox
\newcounter{zoom}
\newdimen\zAr\newdimen\pAr %aspect ratios of zoom target and document page
\newdimen\zwd\newdimen\zht\newdimen\zdp %intermediate and final zoom target dims
\newcommand{\zoombox}[2][1]{% [#1] (optional) sets border line width, default: 1 pixel
% {#2} box context
\sbox\zbox{#2}%
\setlength\zAr{1pt*\ratio{\wd\zbox}{\ht\zbox+\dp\zbox}}%
\setlength\pAr{1pt*\ratio{\paperwidth}{\paperheight}}%
\ifdim\zAr>\pAr\relax%
\setlength\zwd{\wd\zbox}\setlength\zht{\zwd*\ratio{\paperheight}{\paperwidth}}%
\setlength\zdp{(\zht-\ht\zbox-\dp\zbox)*\real{0.5}+\dp\zbox}%
\setlength\zht{\zht-\zdp}%
\else%
\setlength\zht{\ht\zbox+\dp\zbox}%
\setlength\zwd{\zht*\ratio{\paperwidth}{\paperheight}}%
\setlength\zht{\ht\zbox}\setlength\zdp{\dp\zbox}%
\fi%
\pbsPdfDest{zb\thezoom.out}{fit}{1}{}% full-slide view for zoom-out
\makebox[0pt][l]{\makebox[\wd\zbox][c]{% zoom-in target
\pbsPdfDest{zb\thezoom.in}{fitr}{1}{\phantom{\vrule
width \zwd\space height\space \zht\space depth \zdp
}}}}%
\makebox[0pt][l]{{\fboxsep=0.5\fboxsep\hskip-\fboxsep%
\pbsPdfAnnot{\dimexpr\wd\zbox+2\fboxsep\relax}{%
\dimexpr\ht\zbox+\fboxsep\relax}{%
\dimexpr\dp\zbox+\fboxsep\relax}{%
/Subtype/Link/Border [0 0 #1[#1]]%
}%
\pbsPdfAnnot{\dimexpr\wd\zbox+2\fboxsep\relax}{%
\dimexpr\ht\zbox+\fboxsep\relax}{%
\dimexpr\dp\zbox+\fboxsep\relax}{%
/Subtype/Widget/FT/Btn/Ff 65536/H/N
/T (zb\thezoom)
/AA <<
/D <</S/GoTo /D (zb\thezoom.in)>>
/U <</S/GoTo /D (zb\thezoom.out)>>
/X <</S/GoTo /D (zb\thezoom.out)>>
>>
}%
}}%
\usebox{\zbox}%
\stepcounter{zoom}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{frame}
1-px-border (default): \zoombox{\includegraphics[width=1cm]{example-image-a}}\quad
\zoombox{Hello World!}\\[2ex]
2-px-border: \zoombox[2]{\includegraphics[width=1cm]{example-image-b}}\\[2ex]
zero-width-border: \zoombox[0]{\includegraphics[width=1cm]{example-image-golden-upright}}\quad
\zoombox[0]{\includegraphics[width=1cm]{example-image-golden}}
\end{frame}
\end{document}
The second code example executes the GoBack action (return to the previous view) upon mouse button release.
Note, that the GoBack action used for zooming-out was broken and non-functional in A-Readers X and XI, but came back in AR-DC.
Usable with any document class, but less robust. (The stack of saved views in the PDF viewer may become messed up sometimes.)
\documentclass{article}
\usepackage{graphicx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% usage: \zoombox[<dotted border width in pix, default: 1>]{<content>}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{pdfbase,calc}
\ExplSyntaxOn
\let\pbsPdfDest\pbs_pdfdest:nnnn
\let\pbsPdfAnnot\pbs_pdfannot:nnnn
\ExplSyntaxOff
\newsavebox\zbox
\newcounter{zoom}
\newcommand{\zoombox}[2][1]{% [#1] (optional) sets border line width, default: 1 pixel
\leavevmode% {#2} box context
\sbox\zbox{#2}%
\makebox[0pt][l]{{\fboxsep=0.5\fboxsep\hskip-\fboxsep%
\pbsPdfAnnot{\dimexpr\wd\zbox+2\fboxsep\relax}{%
\dimexpr\ht\zbox+\fboxsep\relax}{%
\dimexpr\dp\zbox+\fboxsep\relax}{%
/Subtype/Link/A <</S/GoTo /D (zb\thezoom)>>/Border [0 0 #1[#1]]%
}%
\pbsPdfAnnot{\dimexpr\wd\zbox+2\fboxsep\relax}{%
\dimexpr\ht\zbox+\fboxsep\relax}{%
\dimexpr\dp\zbox+\fboxsep\relax}{%
/Subtype/Widget/FT/Btn/Ff 65536/H/N
/T (zb\thezoom)/TU (Press mouse button to zoom in.)
/AA <<
/D <</S/GoTo /D (zb\thezoom)>>
/U <</S/Named /N/GoBack>>
/X <</S/Named /N/GoBack>>
>>
}%
}}%
\pbsPdfDest{zb\thezoom}{fitr}{1}{\usebox{\zbox}}%
\stepcounter{zoom}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}\parindent=0pt
1-px-border (default): \zoombox{\includegraphics[width=1cm]{example-image-a}}\quad
2-px-border: \zoombox[2]{\includegraphics[width=1cm]{example-image-b}}\\[2ex]
zero-width-border: \zoombox[0]{\includegraphics[width=1cm]{example-image-golden-upright}}
\zoombox[0]{\strut Hello World!}
\end{document}
/Bl=blur as the official description is "An action that shall be performed when the annotation loses the input focus". – Symbol 1 Apr 04 '17 at 13:33/Blis the trigger event ("blur") and<<...>>is the action dictionary associated with it. The name "blur" for the event of losing focus is used in other page description languages, such as HTML (https://www.w3schools.com/jsref/event_onblur.asp), too. – AlexG Apr 04 '17 at 13:41PDF32000_2008.pdf(dated 2008); but I found it inpdf_reference_1-7.pdf(dated 2006). – Symbol 1 Apr 04 '17 at 14:56/GoToaction used here. – AlexG Apr 06 '17 at 15:08