
Escrevo um documento com um campo de texto multilinhas e três imagens. As imagens mudam de visibilidade se clicadas. Mas se a visibilidade das imagens for alterada durante a visualização do PDF e o documento for salvo, as alterações da imagem não serão salvas no arquivo. As alterações no campo de texto são salvas.
Como salvar o status de visibilidade das fotos?
\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}
Responder1
O truque é
- desenhe o CheckBox no topo da imagem
- definir a cor de fundo transparente
- definir cor branca
- remover borda
- definir símbolo para retângulo
- aumente a fonte, para que o símbolo preencha toda a caixa
- definir o tamanho igual à imagem
- remover rótulo da caixa de seleção
Requer pacote hyperref recente.
\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}