summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pdf-forms-tutorial-en/forms-src/fde0012.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/pdf-forms-tutorial-en/forms-src/fde0012.tex')
-rw-r--r--Master/texmf-dist/doc/latex/pdf-forms-tutorial-en/forms-src/fde0012.tex59
1 files changed, 59 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/pdf-forms-tutorial-en/forms-src/fde0012.tex b/Master/texmf-dist/doc/latex/pdf-forms-tutorial-en/forms-src/fde0012.tex
new file mode 100644
index 00000000000..8cd70d6ebd1
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/pdf-forms-tutorial-en/forms-src/fde0012.tex
@@ -0,0 +1,59 @@
+To process document events we have to add an /AA entry to the
+\textsc{pdf} catalogue. The entry value must be a dictionary
+defining event handlers. Entries in this dictionary
+are key/value pairs, the value is again a dictionary
+specifying the action to take.\\
+The following keys can occur:\\[0.5em]
+\begin{tabular}{|r|l|}
+\hline
+&\\*[-0.9em]\multicolumn{1}{|c|}{\textbf{Key}}&\multicolumn{1}{c|}{\textbf{Event}}\\
+\hline
+&\\*[-0.9em]/WP&The document will be printed.\\
+\hline
+&\\*[-0.9em]/DP&The document was printed.\\
+\hline
+&\\*[-0.9em]/WS&The document will be saved.\\
+\hline
+&\\*[-0.9em]/DS&The document was saved.\\
+\hline
+&\\*[-0.9em]/DC&The document will be closed.\\
+\hline
+\end{tabular}\\[0.5em]
+In the example we run \textit{willPrint();\/} for the WillPrint event
+and \textit{didPrint();\/} for the DidPrint event.
+\begin{lstlisting}
+\immediate\pdfobj{
+<<
+ /WP << /S /JavaScript /JS (willPrint();) >>
+ /DP << /S /JavaScript /JS (didPrint();) >>
+>>
+}
+\pdfcatalog{/AA \the\pdflastobj\space 0 R}
+\end{lstlisting}
+Before and after printing ex0008.pdf a message box is shown.
+\lstinputlisting{../examples/ex0008.tex}
+In ex0009.pdf we change stroke and fill colors and text fonts before
+and after printing.
+We have to change the
+\textit{fillColor\/}, \textit{strokeColor\/}
+and \textit{textFont\/} attributes.\\
+The changes are enclosed in
+\begin{lstlisting}
+ this.delay = true
+ // ...
+ this.delay = false
+\end{lstlisting}
+to avoid multiple screen refreshes after each change.
+
+In \textit{myFirstJavaScriptFunction()\/} we set defaults for the
+choice lists
+\textit{abt\/} and \textit{zeit\/} using:
+\begin{lstlisting}
+this.getField("abt").currentValueIndices = 0;
+this.getField("zeit").currentValueIndices = 0;
+\end{lstlisting}
+We set the focus to the \textit{vorname\/} field by:
+\begin{lstlisting}
+this.getField("vorname").setFocus();
+\end{lstlisting}
+\lstinputlisting{../examples/ex0009.tex}