Guardar visibilidad de la imagen

Guardar visibilidad de la imagen

Escribo un documento con un campo de texto de varias líneas y tres imágenes. Las imágenes cambian de visibilidad si se hace clic. Pero si se cambia la visibilidad de las imágenes al visualizar el PDF y luego se guarda el documento, los cambios de las imágenes no se guardan en el archivo. Los cambios en el campo de texto se guardan.

¿Cómo guardar el estado de visibilidad de las imágenes?

\documentclass{scrartcl}
\usepackage{ocgx}
\usepackage{tikz}
\usepackage{hyperref}

\begin{document}
\begin{frame}

\begin{Form}
\TextField[multiline=true,width=\linewidth,height=50pt,value=Exampletext]{}
\end{Form}

\begin{tikzpicture}
\node at (0,0) {\begin{ocg}{Image 1}{ocg1}{1}\actionsocg{ocg1}{}{}{\includegraphics[width=1.0cm]{example-image-a}}\end{ocg}};
\node at (0,1) {\begin{ocg}{Image 2}{ocg2}{1}\actionsocg{ocg2}{}{}{\includegraphics[width=1.0cm]{example-image-b}}\end{ocg}};
\node at (0,2) {\begin{ocg}{Image 3}{ocg3}{1}\actionsocg{ocg3}{}{}{\includegraphics[width=1.0cm]{example-image-c}}\end{ocg}};
\end{tikzpicture}

\end{frame}
\end{document}

Respuesta1

El truco es

  • dibuja la casilla de verificación encima de la imagen
  • establecer color de fondo transparente
  • establecer color blanco
  • eliminar borde
  • establecer símbolo en rectángulo
  • ampliar la fuente para que el símbolo llene todo el cuadro
  • establecer el tamaño igual que la imagen
  • eliminar etiqueta de la casilla de verificación

Requiere un paquete hyperref reciente.

\documentclass{scrartcl}
\usepackage{tikz}
\usepackage{hyperref}

\begin{document}

\begin{Form}
\TextField[multiline=true,width=\linewidth,height=50pt,value=Exampletext]{}

\begin{tikzpicture}
% get rid of label space
\def\LayoutCheckField#1#2{\makebox#2}

\node at (0,0) {\includegraphics[width=1cm,height=0.7cm]{example-image-a}};
\node at (0,0) {
  \CheckBox[
    borderwidth=1,
    backgroundcolor=,
    color=1 1 1,
    bordercolor=,
    checkboxsymbol=\ding{110},
    charsize=100pt,
    checked=false,
    width=1cm,
    height=0.7cm
  ]{}
};  

\node at (0,1) {\includegraphics[width=1cm,height=0.7cm]{example-image-b}};
\node at (0,1) {
  \CheckBox[
    borderwidth=1,
    backgroundcolor=,
    color=1 1 1,
    bordercolor=,
    checkboxsymbol=\ding{110},
    charsize=100pt,
    checked=false,
    width=1cm,
    height=0.7cm
  ]{}
};  

\node at (0,2) {\includegraphics[width=1cm,height=0.7cm]{example-image-c}};
\node at (0,2) {
  \CheckBox[
    borderwidth=1,
    backgroundcolor=,
    color=1 1 1,
    bordercolor=,
    checkboxsymbol=\ding{110},
    charsize=100pt,
    checked=false,
    width=1cm,
    height=0.7cm
  ]{}
};  

\end{tikzpicture}

\end{Form}

\end{document}

información relacionada