summaryrefslogtreecommitdiff
path: root/texmf-dist/doc/latex/aeb-pro/examples/aebpro_ex8.tex
blob: 0f8941b51a27f757353a100a95ee5a5332978466 (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
\documentclass{article}
\usepackage[
    nopro, % this file does not use any features of aeb_pro except for the AeB Control Center
    web={designv,forcolorpaper,pro,tight,usesf},
    eforms
]{aeb_pro}
\usepackage{forms16be}

\DeclareDocInfo
{
    university={Acro\negthinspace\TeX.Net},
    title={A Note on Entering Unicode into a Form Field},
    author={D. P. Story},
    email={dpstory@acrotex.net},
    subject={White Paper that discusses how to use AeB Pro to create form fields with unicode strings},
    talksite={\url{www.acrotex.net}},
    version={1.0},
    keywords={AeB, AcroForm, unicode, AcroTeX, AcroTeX.Net},
    copyrightStatus=True,
    copyrightNotice={Copyright (C) \the\year, D. P. Story},
    copyrightInfoURL={http://www.acrotex.net}
}
\nocopyright


\newcommand{\cs}[1]{\texttt{\char`\\#1}}
\newcommand{\cS}[2]{\textField[\Ff\FfReadOnly\textSize{10}\textFont{Arial}\DV{\unicodeStr(#2)}\V{\unicodeStr(#2)}\BC{}]{#1}{20bp}{11bp}}

\parskip6pt
\parindent0pt

\defUniStr{coolDPS}{Donald \u20AC. Story}
\defUniStr{myCoolIV}{\u0022\u20AC|e^\u007B\u005Cln(17)\u007D|$\u0022}
\defUniStr{Reset myCoolIV}{Reset the \u0022\u20AC|e^\u007B\u005Cln(17)\u007D|$\u0022 field}

%\pdfSpacesOff

\begin{document}

\makeinlinetitle
%\maketitle

\section{The Basics}

This document demonstrates how to use some of the new commands that
come with AeB Pro, and some of the new keys in the eforms package
that are designed to enter unicode hex encoding. In all cases, you must have
the font that contains the glyph represented by the unicode hex.

You need AeB Pro with the \texttt{linktoattachments} and the eforms package, see
preamble above.

The first step is to use the \cs{labelName} command to define your unicode string
and associate a label with it. In the preamble, the following definition can be found.
\begin{verbatim}
\defUniStr{coolDPS}{Donald \u20AC. Story}
\end{verbatim}
The string can be a combination of characters from Basic Latin. As
described in the AeB Pro manual, the string can be entered using
keyboard keystrokes, or unicode notation \cs{uXXXX}, as above.
Spaces are eaten up, so you must enter the unicode for a space
\cs{u0020}. The command \cs{labelName} creates a macro that contains
the pure encoding of the string. You can use \cs{aref} to access
this encoding.
The Unicode for the string \verb!Donald \u20AC. Story! is
\begin{quote}
\unicodeStr(coolDPS)
\end{quote}
The hex code is computed from a table of unicodes defined in AeB Pro, with allowances for enter
a ``raw unicode'' using a \cs{u} escape sequence.

Next, create an AcroForm field, a text field, in this example, and
use the command \cs{unicodeStr} to reference the label enclosed
in matching parentheses, like so
\begin{verbatim}
\textField[\Ff\FfReadOnly\textSize{10}\textFont{Arial}\W0
    \uDV{\unicodeStr(coolDPS)}\uV{\unicodeStr(coolDPS)}\BC{}
]{dps}{1in}{11bp}
\end{verbatim}
The result of the above code is

\textField[\Ff\FfReadOnly\textSize{10}\textFont{Arial}
    \DV{\unicodeStr(coolDPS)}\V{\unicodeStr(coolDPS)}\BC{}
]{dps}{1in}{11bp}

The technique uses some of the code brought in by the the
\texttt{linktoattachments} option of AeB Pro, and a new command,
named \cs{unicodeStr}, designed to make it simple to enter unicode
encoded strings into a form field.

The above field is set to read only, the one below is not:

\textField[\textSize{10}\textFont{Arial}
    \DV{\unicodeStr(myCoolIV)}\V{\unicodeStr(myCoolIV)}
]{myCoolIV}{1.5in}{12bp}\pushButton[\textSize{10}\textFont{Arial}\CA{\unicodeStr(20AC)}
    \AC{\unicodeStr(20AA)}\uRC{\unicodeStr(00A5)}\TU{\unicodeStr(Reset myCoolIV)}
    \A{\JS{this.resetForm(["myCoolIV"])}}]{reset}{.5in}{12bp}

Edit the box above, then click on the reset button. (Notice the
tooltip for the reset button.)

The eforms uses an optional first argument to change the appearance
of a form field, add in action (usually JavaScript action) or to
initialize the field value.


\section{More Advanced}

For combo boxes and list boxes, things are slightly more
complicated. In the example below, we define a combo box. First,
define the appearance values of the combo box (the string that is
seen listed in the combo box).
\begin{verbatim}
\defUniStr{myEuro}{\u20AC (Euro)}
\defUniStr{myYen}{\u00A5 (Yen)}
\defUniStr{mySheqel}{\u20AA (Sheqel)}
\defUniStr{myPound}{\u00A3 (Pound)}
\defUniStr{myFranc}{\u20A3 (Franc)}
\end{verbatim}

\defUniStr{myEuro}{\u20AC (Euro)}
\defUniStr{myYen}{\u00A5 (Yen)}
\defUniStr{mySheqel}{\u20AA (Sheqel)}
\defUniStr{myPound}{\u00A3 (Pound)}
\defUniStr{myFranc}{\u20A3 (Franc)}

Then we can define our combo box.  According to the PDF file format,
unicode strings should be enclosed in angle brackets
\verb!<XXXXXXXXXXXX>!. In initializing the combo box below, the
\cs{unicodeStr} command is used, but this time it is enclosed in
angle brackets.
\begin{verbatim}
\comboBox[\Ff\FfEdit\DV{Euro}\V{Euro}\textFont{Arial}
\BG{0.98 0.92 0.73}\BC{0 .6 0}]{myCombo}{1in}{11bp}
{*{[(Euro)<\unicodeStr(myEuro)>]%
    [(Yen)<\unicodeStr(myYen)>]%
    [(Sheqel)<\unicodeStr(mySheqel)>]%
    [(Pound)<\unicodeStr(myPound)>]%
    [(Franc)<\unicodeStr(myFranc)>]}
}
\end{verbatim}
where the \texttt{*} in the position shown above is a token that signals the
passing of a raw form of the value options of a combo or list box; it is
defined in \textsf{eforms}.

The result is
\comboBox[\Ff\FfEdit\DV{Euro}\V{Euro}\textFont{Arial}
\BG{0.98 0.92 0.73}\BC{0 .6 0}]{myCombo}{1in}{11bp}
{*{[(Euro)<\unicodeStr(myEuro)>]%
    [(Yen)<\unicodeStr(myYen)>]%
    [(Sheqel)<\unicodeStr(mySheqel)>]%
    [(Pound)<\unicodeStr(myPound)>]%
    [(Franc)<\unicodeStr(myFranc)>]}
}

Very swave!

\section{More Advanced Still}

You can also enter raw hex yourself (without using \cs{labelName}) if you have the patience to do
it, and  in some cases, it is the easiest.

For the purpose of the table below, the following definition was given in the preamble:

\begin{verbatim}
\newcommand{\cS}[2]{%
    \textField[
        \Ff\FfReadOnly\BC{}\textSize{10}\textFont{Arial}
        \DV{\unicodeStr(#2)}\V{\unicodeStr(#2)}
    ]{#1}{20bp}{11bp}}
\end{verbatim}

\begin{center}
\begin{tabular}{lll||lll}
Description     & Unicode   & Symbol &  Description     & Unicode  & Symbol \\\hline
Dollar Sign     & \cs{u0024}& \cS{Dollar}{0024} & Lira Sign    & \cs{u20A4} &\cS{Lira}{20A4}\\
Pound Sign      & \cs{u00A3}& \cS{Pound}{00A3} & Peseta Sign     & \cs{u20A7} &\cS{Pesta}{20A7}\\
Currency Sign   & \cs{u00A4}& \cS{Currency}{00A4} &  New Sheqel Sign & \cs{u20AA} &\cS{Sheqel}{20AA}\\
Yen Sign        & \cs{u00A5}& \cS{Yen}{00A5} & Dong Sign       & \cs{u20AB} & \cS{Dong}{20AB}\\
French Franc    & \cs{u20A3}& \cS{Franc}{20A3} & Euro Sign       & \cs{u20AC} &\cS{Euro}{20AC}\\
\end{tabular}
\end{center}

FYI: See \url{http://jrgraphix.net/research/unicode_blocks.php?block=0} for a display of unicode characters.


\end{document}