# Is it possible to create an animation (in a pdf) from a sequence of images?

I have a sequence of images A, B and C (hopefully, all of the same size, but this is not necessarily the case). Note that I could have more than three images. The images should be in the .png format (but not necessarily). Is it possible to create an animation (an animated image in a pdf) from this sequence of images? More precisely, I would like the animation first to show image A, then, after a few predetermined number of seconds, image B and then image C.

I am not using beamer. I am using the article document class.

• Maybe this helps you: tex.stackexchange.com/a/401900/134144 – leandriis Jun 7 '19 at 19:46
• @KJO I am not using beamer. – nbro Jun 7 '19 at 19:53
• @KJO I realised that the result is dependent on the viewer. I don't want only part of the readers to be able to see the animations and the others don't see it. So, unfortunately, I cannot use this solution. – nbro Jun 7 '19 at 20:34
• @KJO it is javascript not java. Very big difference. But the conclusion is the same – daleif Jun 7 '19 at 21:00

## 1 Answer

The problem with PDF media is they were traditionally built to be animated within the pages as either SWF or JavaScript driven pages just like the 3D viewer or many other animated frame methods.

With recent concerns over injected exploits targeting basic AutoAction, FlashSWF and JavaScript the only universal method left is to simply manually skip page to page and let the user advance and return to a desired start position, This is the basic means by which a comic book user can flip-pages.

One way to do this is simply add each graphic so as to fill page by page.

Here is a basic model using the contents of mwe imported as pdf pages but that can just as easily be PNG images from a folder Using hyperref we can set the page to open with no toolbar etc however since that involves JavaScript that most secure PDF viewers would ignore I would simply write a dedicated first page to instruct users to set their viewer to single page and hit the space bar or other page forward key.

So

Dear reader in Adobe Acrobat / SumatraPDF set page to single frame and use Down Arrow to progress through pages

\documentclass{article}
\usepackage{pdfpages,graphicx,mwe}
\usepackage[a4paper,landscape, margin=0pt]{geometry}
\parindent=0pt
\lineskip=0pt

\begin{document}%
\includepdf[width=\textwidth,pages=-]{example-image-letter-numbered}
\end{document}

• Tons of JavaScript are executed while you are looking at this page ;) – AlexG Jun 7 '19 at 21:26