summaryrefslogtreecommitdiff
path: root/texmf-dist/doc/latex/icon-appr/examples/icon-appr-exmpl.tex
blob: 364b61f6d2f6af55e6304a218e63f278d3e40dde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
% compile with pdflatex, lualatex, or xelatex
\documentclass{article}
%\usepackage[designv]{web}
\usepackage[%
    web={designi},
    useacrobat
]{aeb_pro}
\usepackage{icon-appr}[2020/06/05]
\usepackage{hologo}

% uncomment next line to see the positions of other form fields within your PDF viewer (such as SumatraPDF)
%\previewOn\pmpvOn 

\title{Creating icon appearances for form buttons using\texorpdfstring{\\}{}
  \textsf{pdflatex}, \textsf{lualatex}, and \textsf{xelatex}}
\author{D. P. Story}
\university{Acro\TeX.Net}
\email{dpstory@acrotex.net}
\subject{Techniques for creating button appearances}
\keywords{icon appearances of form buttons}
\version{1.0}
\norevisionLabel

\optionalPageMatter{%
    \begin{center}\fcolorbox{red}{webyellow}{%
    \begin{minipage}{.67\linewidth}
      Icon appearance images for the buttons of this document were produced by \ifluatex
      \hologo{LuaLaTeX}\else\ifpdf\hologo{pdfLaTeX}\else\ifxetex\hologo{XeLaTeX}\else
      an unsupported driver (\textsf{aeb\_pro} needed)\fi\fi\fi.
    \end{minipage}}
    \end{center}
}

\begin{embedding}
\embedIcon[name=mani]{graphics/man1.pdf}
\embedIcon[name=girl]{graphics/girl.pdf}
\embedIcon[name=scot]{graphics/scot.pdf}
\end{embedding}

\begin{document}

\maketitle

\section{Push Buttons}

We produce two push buttons, the second one is a re-scaling of the first.\medskip

\noindent\pushButton[%
%  \A{\JS{app.alert("AcroTeX rocks!")}}
  \TP{1}\BG{}\S{S}
  \I{\csOf{mani}}
  \RI{\girl}
  \IX{\scot}
]{myButton}{100bp}{100bp}
\qquad
\pushButton[%
  \TP{1}\BG{}\S{S}
  \I{\mani}
  \RI{\girl}
  \IX{\scot}
]{myButton1}{50bp}{50bp*\ratio{100bp}{100bp}}\vcgBdry[12pt]

\noindent The push buttons are properly produced for all drivers
(\textsf{pdflatex}, \textsf{lualatex}, and \textsf{xelatex}) and can be
viewed, with full functionality, in \textsf{Acrobat}, \textsf{Adobe Reader},
\textsf{PDF-XChange Viewer}, and \textsf{PDF-XChange Editor}. All buttons, including
the ones on the next page can be viewed in \textsf{SumatraPDF}, without any functionality.

\newpage

\section{Check box and Radio Button Fields}

Similar techniques are made for check box and radio button fields;
however, \emph{there is one caveat}, the icon faces do not appear when the
file is first viewed in \textsf{PDF-XChange Editor}.\footnote{If you are
using that viewer.} You must first open the file in \textsf{Adobe Reader DC}
or \textsf{Acrobat}, and save it. The file then views properly in
\textsf{PDF-XChange Editor}, \emph{but not in} \textsf{PDF-XChange Viewer},
however.\vcgBdry[6pt]

Checkbox:
\checkBox[\BC{}\BG{}
    \V{Off}\DV{Off}\AS{Off}\H{N}\autoCenter{y}
    \AP{\N{\On{Man}{\mani}\Off{\girl}}}
    ]{myCkBx}{22bp}{22bp}{Man}\quad(Girl is `off', Man is `on')\vcgBdry[6pt]

Radio Button Fields: \radioButton[\BC{}\BG{}
    \V{Off}\DV{Off}\AS{Off}\H{N}\autoCenter{y}
    \AP{\N{\On{Man1}{\mani}\Off{\girl}}}
    ]{myRadBtn}{22bp}{22bp}{Man1}\quad \radioButton[\BC{}\BG{}
    \V{Off}\DV{Off}\AS{Off}\H{N}\autoCenter{y}
    \AP{\N{\On{Man2}{\mani}\Off{\girl}}}
    ]{myRadBtn}{22bp}{22bp}{Man2}\quad\radioButton[\BC{}\BG{}
    \V{Off}\DV{Off}\AS{Off}\H{N}\autoCenter{y}
    \AP{\N{\On{Man3}{\mani}\Off{\girl}}}
    ]{myRadBtn}{22bp}{22bp}{Man3}\quad(Girl is `off', Man is `on')\vcgBdry[6pt]

\pushButton[\CA{Reset}\A{\JS{this.resetForm();}}]{reset}{}{11bp}\vcgBdry[6pt]

\newpage

\section{Icons in this document}

Use the button below to cycle through all icons in this document.

\begin{defineJS}{\cycleJS}
if (typeof indexIcon == "undefined") var indexIcon=0;
var oIconName=this.icons[indexIcon].name;
var f=this.getField("iconContainer");
var oIcon=this.getIcon(oIconName);
f.buttonPosition=position.iconTextV;
f.buttonSetIcon(oIcon);
f.buttonSetCaption(oIconName);
indexIcon = (indexIcon+1) \% (this.icons.length);
\end{defineJS}
% define a clear button feature, it clears the button iconContainer
% so it no longer displays an icon; pressing the Cycle button resumes
% the display as before.
\begin{defineJS}{\clearJS}
f=this.getField("iconContainer")
// save
var sv=f.buttonPosition;
var cptn=f.buttonGetCaption();
// clear
f.buttonPosition=position.textOnly;
f.buttonSetCaption("");
\end{defineJS}

\begin{center}
\pushButton[\BG{}\TP{2}\S{S}]{iconContainer}{100bp}{100bp}\vcgBdry[6bp]
\pushButton[\CA{Cycle}\AAmouseup{\cycleJS}]{cycleBtn}{}{11bp}\cgBdry[3bp]
\pushButton[\CA{Clear}\AAmouseup{\clearJS}]{clearBtn}{}{11bp}
\end{center}

\end{document}