# generating flow of content in pdf (aka using the **zoombox** feature)

i am sure this feature is called something else entirely, but i have seen some recent pdfs in arxiv that seem to have information about the layout of the pdf such that when we click on a twocolumn paper it zooms to the appropriate content as shown in the figure below. What is this feature called anyway? If it helps, i have seen something similar in marvel's digital comics, where they zoom on panels sequentially. It would help even if someone can tell me how to implement this manually in acrobat or something similar.

• Are you looking for article threads (see section 7.13 in the pdfTeX manual)? – Martin Schröder Jun 1 '12 at 8:54
• @MartinSchröder Could you please give an example of using \pdftread? I'm interested in it but can't understand from reading the manual. – AlexG Jun 1 '12 at 10:42
• @AlexG: It's an arcane subject (maybe it's better in ConTeXt); try samplepdf.tex. See also this answer. – Martin Schröder Jun 1 '12 at 15:15

Here is a pdfLaTeX solution. It defines two commands.

\zoomnext[<dotted line width>]{<ID>}{<next ID>}{<box content>}


takes two arbitrary IDs as arguments. The first one labels the current box, the second one specifies the next box to zoom to. Moreover it takes the box content of the current box as the last argument. A faint dotted line may be printed around the box in the pdf viewer. The first optional argument (integer number) specifies the dotted line width.

The second command

\firstzoom{<ID>}


sets the first box to zoom to when the page opens.

Boxes are zoomed to the maximum size that still fits into the viewer window.

The code example produces five circularly linked boxes. The document or page opens with the pdf viewer zoomed to box b1 :

\documentclass{article}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newsavebox\zbox
\newcommand{\zoomnext}[4][0]{% [#1] dotted line width (optional)
% #2 this ID,
% #3 next ID,
% #4 box content
\leavevmode%
\sbox\zbox{#4}%
\pdfdest name {zb_#2} fitr
width  \the\wd\zbox\space
height \the\ht\zbox\space
depth  \the\dp\zbox\space
\pdfannot
width  \the\wd\zbox\space
height \the\ht\zbox\space
depth  \the\dp\zbox\space
{%
/Border [0 0 #1 [1 2]]
/A <</S/GoTo/D (zb_#3)>>
}%
\usebox{\zbox}%
}
\newcommand{\firstzoom}[1]{%
\pdfannot width 0pt height 0pt depth  0pt
{%
/Subtype/Widget
/AA <</PO <</S/GoTo/D (zb_#1)>>>>
}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\section{Zoombox test}\firstzoom{b1}

\begin{center}
\zoomnext[1]{b1}{b2}{\framebox[0.4\linewidth][c]{Box 1}}
\end{center}
\vspace{20ex}
\begin{minipage}{0.5\linewidth}
\centering
\zoomnext[1]{b2}{b3}{\framebox[0.9\linewidth][c]{Box 2}}\\[20ex]
\zoomnext[1]{b3}{b4}{\framebox[0.9\linewidth][c]{Box 3}}
\end{minipage}%
\begin{minipage}{0.5\linewidth}
\centering
\zoomnext[1]{b4}{b5}{\framebox[0.9\linewidth][c]{Box 4}}\\[20ex]
\zoomnext[1]{b5}{b1}{\framebox[0.9\linewidth][c]{Box 5}}
\end{minipage}%

\end{document}


• That was a perfect answer @AlexG, complete with syntax and a working example. thank you. incidentally could you tell me if this feature could be added to some other pdf as well, using a pdf editor that is open source and linux compatible? i kind of have the urge to do a similar thing with some comics i have!! – Debanjan Basu May 31 '12 at 15:20
• @DebanjanBasu: I'd import an existing pdf with pdfpages LaTeX package, then use commands from either textpos or tikz packages to place the \zoomnext macro onto the page. \phantom{\rule{<box width>}{<box height>}} could be used to give the zoom boxes the correct size. However, some manual work will be involved. – AlexG Jun 1 '12 at 8:19