(This is an end-of-year crazy question)

Is it possible to embed a (scrollable) frame or a PDF inside a PDF? If so, how to do it in (pdf)LaTeX?

This is something pretty common in HTML (see for example http://www.echoecho.com/htmlframes01.htm). Here it is a webpage with PDF frames https://www.cs.tut.fi/~jkorpela/html/iframe-pdf.html

Here it is a fake screenshot so you get the idea.

Portable and non-portable (e.g. only-Acrobat) answers are welcomed. fakeframe

Example of a down arrow below a frame. The up arrow can be on top of the frame and the triangles point up.


  • Related but not the same thing: tex.stackexchange.com/q/96260/1871 – alfC Dec 17 '15 at 12:23
  • 3
    As far as I can see, the only "off the shelf" scrollable element would be a multiline text field. However, to make it scrollable, you can not make it read-only. Another possbility would be placing a button field, and make the scrollable PDF the icon. You then add scrolling buttons and appropriate JavaScript code to change the position of the icon in the field (see button field properties in Acrobat). – Max Wyss Dec 17 '15 at 12:25
  • 2
    The closest to your requirements that you can get is probably this: tex.stackexchange.com/a/211010 – AlexG Dec 17 '15 at 12:29

Vertical scrolling based on the animate package; definition of command \smoothScroll taken from an earlier post with slight modifications.

As an example document, we take lppl.pdf from TEXMF/doc/latex/base/lppl.pdf, the pages somewhat trimmed.

Update with suggestions incorporated:

Start auto-scroll by clicking on the "widget", pause auto-scroll on mouse-down in the "widget" (and moving the mouse out, while keeping it pressed).

The buttons above and below the "widget" step through the document on mouse click.

[Shift]+click on the buttons rewinds to the top or jumps to the bottom of the document.

Adobe Reader required. Open on ↗ShareLaTeX.

enter image description here


\usepackage{MnSymbol} % \triangle, \triangledown
\usepackage{media9}   % \mediabutton
\usepackage{xsavebox} % \xsbox{<xsbox id>}{<content>} , \the<xsbox id>

%%%%%%% docToBox  %%%%%%%%
  % #1 <file name (PDF)>
  % #2 <left> <bot> <right> <top> % trim pages by given amounts (PS points)
  % #3 <boxnum>
  \pdfximage{#1}%  just for counting pages
      \hbox to \textwidth{\includegraphics[page=\i,trim=#2,clip,width=\textwidth]{#1}}%
%%%%%%% /docToBox %%%%%%%%

%%%%%%% smoothScroll %%%%%
  % [#1] autoplay, controls, ... (see: texdoc animate)
  % #2 <boxnum>
  % #3 <viewport height>
  % #4 <steps>
  % #5 <steps per sec> while playing; >25 doesn't make sense
  \xsbox{XFormOfDoc}{\usebox{#2}}% distill box into re-usable PDF XObject
%%%%%%% /smoothScroll %%%%%


%load the document with trims into save-box
\docToBox{lppl.pdf}{131 110 115 121}{\lipsumbox}

\noindent Before you consider using \LaTeX, read the fine-print:\\
    else try{anim.lppl.frameNum--}catch(e){}
%the scrolling widget
\vskip -0.8\baselineskip
    else try{anim.lppl.frameNum++}catch(e){}

  • This is very cool, can the animate controls be used a scroll control? – alfC Dec 17 '15 at 20:08
  • 1
    They can already be used as such, e.g. "<" and ">" for stepping. A slider doesn't seem possible to implement, though. – AlexG Dec 18 '15 at 8:24
  • Yes, I mean if the buttons can be arranged vertical and on the side. Or perhaps have a short elongated button below the frame [ vvv ] and one on the top [ ^^^ ]. See my edit at end of the post for an example image. – alfC Dec 18 '15 at 9:21
  • 1
    @alfC In order to pause it, press the mouse button over the frame and keep it pressed while moving the mouse pointer out (as written in the answer). – AlexG Jul 25 '16 at 7:20
  • 1
    @alfC Although a bit un-orthodox, this way of pausing/resuming an animation by mouse-down/mouse-up was designed on purpose. Because one has better control over the playing state, while giving explanations during a lecture, for instance. You can be sure that the animation freezes when your finger presses the button. With a conventional click (press-release) to both stop and resume an animation, you can never be sure whether you end up with a paused animation or with one that runs away, especially when clicking in rapid succession. (The same behaviour was also programmed into VPlayer.swf, btw.) – AlexG Jul 29 '16 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.