\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!!. 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}