# Show ocg layers in handout

Im am using the ocg package to create clickable layers in a pdf presentation. These items are invisible at the start of the presentation. Is there a command or method to show them when I create a handout out of my slides with the handout option? I tried the options printocg=always and exportocg=always but they don't work.

MWE:

\documentclass[ngerman, handout]{beamer}
\usepackage{pgfpages}
\usepackage{ocgx}
\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
\begin{document}
\begin{frame}{A}
\begin{block}{A}
\begin{itemize}
\item \begin{ocg}[printocg=always]{ABul01}{Aocg01}{0}\actionsocg{Aocg01}{}{}{A}\end{ocg}
\item \begin{ocg}[exportocg=always]{ABul02}{Aocg02}{0}\actionsocg{Aocg02}{}{}{B}\end{ocg}
\item \begin{ocg}{ABul03}{Aocg03}{1}\actionsocg{Aocg03}{}{}{C}\end{ocg}
\end{itemize}
\end{block}
\end{frame}
\end{document}


Here all items should be visible, not only the third one.

• The OCG setting for printing printocg=... is only supported by Acrobat Reader, Foxit and the built-in PDF viewers of the Chromium/Chrome browsers. Thus, you get the expected output if you print from within these PDF viewers. – AlexG Jun 22 '17 at 10:05

An easy solution that requires a modification of the ocg declarations is to set the visibility variable conditional on whether you are in handout mode (see also Define command depending on whether beamer is in handout mode or not). In the example below the visibility is set to 1 if in handout mode, and set to the provided value in normal mode.

MWE:

\documentclass[handout]{beamer}
\mode<beamer>{\newcommand\vis[1]{#1}}
\mode<handout>{\newcommand\vis[1]{1}}
\usepackage{ocgx}
\begin{document}
\begin{frame}{A}
\begin{block}{A}
Check for handout mode: \vis{0}   % this line may be deleted
\begin{itemize}
\item \begin{ocg}{ABul01}{Aocg01}{\vis{0}}\actionsocg{Aocg01}{}{}{A}\end{ocg}
\item \begin{ocg}{ABul02}{Aocg02}{\vis{0}}\actionsocg{Aocg02}{}{}{B}\end{ocg}
\item \begin{ocg}{ABul03}{Aocg03}{\vis{1}}\actionsocg{Aocg03}{}{}{C}\end{ocg}
\end{itemize}
\end{block}
\end{frame}
\end{document}


Result of two runs, one with handout, one without, appearance after opening the file (i.e., without clicking on the items):

Note that you may need multiple LaTeX runs and a restart of the pdf reader in order to see the changes with or without handout mode. With some trouble you may be able to patch the ocg environment to automatically apply the \vis command to the third argument.