| 1 |
sdapspdf package |
| 2 |
================ |
| 3 |
|
| 4 |
You can use this package to make PDF forms using the SDAPS packages. SDAPS |
| 5 |
itself does not give you a way to submit these though. |
| 6 |
|
| 7 |
To use this feature simply use the sdapspdf package. You need to wrap everything |
| 8 |
containing PDF form elements inside a :environ:`Form` environment. After this |
| 9 |
enable form generation by simply setting the ``pdf_form`` option for checkboxes |
| 10 |
and freeform textboxes. |
| 11 |
|
| 12 |
.. note:: |
| 13 |
The sdapspdf package imports hyperref internally. So some care might need to |
| 14 |
be taken to import it after hyperref itself. |
| 15 |
|
| 16 |
The following extra options are added to boxes and checkboxes: |
| 17 |
|
| 18 |
=================== ===================== |
| 19 |
Option Purpose |
| 20 |
=================== ===================== |
| 21 |
pdf_form Turn on PDF form generation (default: `false`) |
| 22 |
default Allows enabling a checkbox by default (default: `false`, set to `true` to use) |
| 23 |
checkboxsymbol The symbol to use for the checkmark (integer, see PDF specification, default: 8) |
| 24 |
=================== ===================== |
| 25 |
|
| 26 |
.. warning:: |
| 27 |
The default for pdf_form might still change to be `true`. |
| 28 |
|
| 29 |
.. note:: |
| 30 |
The SDAPS base package will likely add further macros to make setting these options more convenient. |
| 31 |
|
| 32 |
|
| 33 |
.. sdaps:: Using PDF forms |
| 34 |
:preamble: |
| 35 |
\usepackage{sdapspdf} |
| 36 |
% Define aliases for the commands we need to use, context_append |
| 37 |
% expands settings, context_set sets them (for the current scope), |
| 38 |
% possibly removing old settings. |
| 39 |
\ExplSyntaxOn |
| 40 |
\let\mycontextappend\sdaps_context_append:nn |
| 41 |
\let\mycontextset\sdaps_context_set:nn |
| 42 |
\let\mycheckbox\sdaps_checkbox:nn |
| 43 |
\let\mytextboxvhstretch\sdaps_textbox_vhstretch:nnn |
| 44 |
\ExplSyntaxOff |
| 45 |
|
| 46 |
\begin{Form} |
| 47 |
% The \my* commands are aliases that are defined in the praemble |
| 48 |
|
| 49 |
% Set the pdf_form option for all boxes (*) |
| 50 |
\mycontextappend{*}{pdf_form=true} |
| 51 |
|
| 52 |
% Or for checkboxes and textboxes separately |
| 53 |
%\mycontextappend{singlechoice}{pdf_form=true} |
| 54 |
%\mycontextappend{multichoice}{pdf_form=true} |
| 55 |
%\mycontextappend{textbox}{pdf_form=true} |
| 56 |
|
| 57 |
\noindent A checkbox: \mycheckbox{}{} \newline |
| 58 |
\mycontextappend{multichoice}{default=true} |
| 59 |
A checked checkbox: \mycheckbox{}{} \newline |
| 60 |
\mycontextappend{multichoice}{default=true,checkboxsymbol=5} |
| 61 |
A checked checkbox with different symbol: \mycheckbox{}{} |
| 62 |
|
| 63 |
Please note that the above rendering is slightly broken as the poppler |
| 64 |
PDF renderer maps the checkboxsymbol incorrectly. Acrobat will show the |
| 65 |
other symbol. |
| 66 |
|
| 67 |
\noindent A non stretching textbox: |
| 68 |
\mytextboxvhstretch{text}{4cm}{0} |
| 69 |
\end{Form} |
| 70 |
|
| 71 |
|