| 1 |
|
| 2 |
<!DOCTYPE html> |
| 3 |
|
| 4 |
<html> |
| 5 |
<head> |
| 6 |
<meta charset="utf-8" /> |
| 7 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 8 |
<title>sdapspdf package — sdaps-class 0.1 documentation</title> |
| 9 |
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> |
| 10 |
<link rel="stylesheet" href="_static/classic.css" type="text/css" /> |
| 11 |
<link rel="stylesheet" type="text/css" href="_static/css/sdapstex.css" /> |
| 12 |
|
| 13 |
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script> |
| 14 |
<script src="_static/jquery.js"></script> |
| 15 |
<script src="_static/underscore.js"></script> |
| 16 |
<script src="_static/doctools.js"></script> |
| 17 |
|
| 18 |
<link rel="index" title="Index" href="genindex.html" /> |
| 19 |
<link rel="search" title="Search" href="search.html" /> |
| 20 |
<link rel="next" title="sdapsarray package" href="sdapsarray.html" /> |
| 21 |
<link rel="prev" title="sdapslayout package" href="sdapslayout.html" /> |
| 22 |
</head><body> |
| 23 |
<div class="related" role="navigation" aria-label="related navigation"> |
| 24 |
<h3>Navigation</h3> |
| 25 |
<ul> |
| 26 |
<li class="right" style="margin-right: 10px"> |
| 27 |
<a href="genindex.html" title="General Index" |
| 28 |
accesskey="I">index</a></li> |
| 29 |
<li class="right" > |
| 30 |
<a href="sdapsarray.html" title="sdapsarray package" |
| 31 |
accesskey="N">next</a> |</li> |
| 32 |
<li class="right" > |
| 33 |
<a href="sdapslayout.html" title="sdapslayout package" |
| 34 |
accesskey="P">previous</a> |</li> |
| 35 |
<li class="nav-item nav-item-0"><a href="index.html">sdaps-class 0.1 documentation</a> »</li> |
| 36 |
<li class="nav-item nav-item-this"><a href="">sdapspdf package</a></li> |
| 37 |
</ul> |
| 38 |
</div> |
| 39 |
|
| 40 |
<div class="document"> |
| 41 |
<div class="documentwrapper"> |
| 42 |
<div class="bodywrapper"> |
| 43 |
<div class="body" role="main"> |
| 44 |
|
| 45 |
<div class="section" id="sdapspdf-package"> |
| 46 |
<h1>sdapspdf package<a class="headerlink" href="#sdapspdf-package" title="Permalink to this headline">ΒΆ</a></h1> |
| 47 |
<p>You can use this package to make PDF forms using the SDAPS packages. SDAPS |
| 48 |
itself does not give you a way to submit these though.</p> |
| 49 |
<p>To use this feature simply use the sdapspdf package. You need to wrap everything |
| 50 |
containing PDF form elements inside a <code class="xref tex tex-environ docutils literal notranslate"><span class="pre">Form</span></code> environment. After this |
| 51 |
enable form generation by simply setting the <code class="docutils literal notranslate"><span class="pre">pdf_form</span></code> option for checkboxes |
| 52 |
and freeform textboxes.</p> |
| 53 |
<div class="admonition note"> |
| 54 |
<p class="admonition-title">Note</p> |
| 55 |
<p>The sdapspdf package imports hyperref internally. So some care might need to |
| 56 |
be taken to import it after hyperref itself.</p> |
| 57 |
</div> |
| 58 |
<p>The following extra options are added to boxes and checkboxes:</p> |
| 59 |
<table class="docutils align-default"> |
| 60 |
<colgroup> |
| 61 |
<col style="width: 19%" /> |
| 62 |
<col style="width: 81%" /> |
| 63 |
</colgroup> |
| 64 |
<thead> |
| 65 |
<tr class="row-odd"><th class="head"><p>Option</p></th> |
| 66 |
<th class="head"><p>Purpose</p></th> |
| 67 |
</tr> |
| 68 |
</thead> |
| 69 |
<tbody> |
| 70 |
<tr class="row-even"><td><p>pdf_form</p></td> |
| 71 |
<td><p>Turn on PDF form generation (default: <cite>false</cite>)</p></td> |
| 72 |
</tr> |
| 73 |
<tr class="row-odd"><td><p>default</p></td> |
| 74 |
<td><p>Allows enabling a checkbox by default (default: <cite>false</cite>, set to <cite>true</cite> to use)</p></td> |
| 75 |
</tr> |
| 76 |
<tr class="row-even"><td><p>checkboxsymbol</p></td> |
| 77 |
<td><p>The symbol to use for the checkmark (integer, see PDF specification, default: 8)</p></td> |
| 78 |
</tr> |
| 79 |
</tbody> |
| 80 |
</table> |
| 81 |
<div class="admonition warning"> |
| 82 |
<p class="admonition-title">Warning</p> |
| 83 |
<p>The default for pdf_form might still change to be <cite>true</cite>.</p> |
| 84 |
</div> |
| 85 |
<div class="admonition note"> |
| 86 |
<p class="admonition-title">Note</p> |
| 87 |
<p>The SDAPS base package will likely add further macros to make setting these options more convenient.</p> |
| 88 |
</div> |
| 89 |
<div class="figure"> |
| 90 |
<div class="tabs"> |
| 91 |
<input type="radio" id="tab-code-33" class="tab-code" name="tab-group-33" ><label for="tab-code-33" class="label-code">Example LaTeX code</label><input type="radio" id="tab-rendering-33" class="tab-rendering" name="tab-group-33" checked><label for="tab-rendering-33" class="label-rendering">Result</label><div class="content-code"> |
| 92 |
<div class="highlight"><pre><span></span><span class="k">\begin</span><span class="nb">{</span>Form<span class="nb">}</span> |
| 93 |
<span class="c">% The \my* commands are aliases that are defined in the praemble</span> |
| 94 |
|
| 95 |
<span class="c">% Set the pdf_form option for all boxes (*)</span> |
| 96 |
<span class="k">\mycontextappend</span><span class="nb">{</span>*<span class="nb">}{</span>pdf<span class="nb">_</span>form=true<span class="nb">}</span> |
| 97 |
|
| 98 |
<span class="c">% Or for checkboxes and textboxes separately</span> |
| 99 |
<span class="c">%\mycontextappend{singlechoice}{pdf_form=true}</span> |
| 100 |
<span class="c">%\mycontextappend{multichoice}{pdf_form=true}</span> |
| 101 |
<span class="c">%\mycontextappend{textbox}{pdf_form=true}</span> |
| 102 |
|
| 103 |
<span class="k">\noindent</span> A checkbox: <span class="k">\mycheckbox</span><span class="nb">{}{}</span> <span class="k">\newline</span> |
| 104 |
<span class="k">\mycontextappend</span><span class="nb">{</span>multichoice<span class="nb">}{</span>default=true<span class="nb">}</span> |
| 105 |
A checked checkbox: <span class="k">\mycheckbox</span><span class="nb">{}{}</span> <span class="k">\newline</span> |
| 106 |
<span class="k">\mycontextappend</span><span class="nb">{</span>multichoice<span class="nb">}{</span>default=true,checkboxsymbol=5<span class="nb">}</span> |
| 107 |
A checked checkbox with different symbol: <span class="k">\mycheckbox</span><span class="nb">{}{}</span> |
| 108 |
|
| 109 |
Please note that the above rendering is slightly broken as the poppler |
| 110 |
PDF renderer maps the checkboxsymbol incorrectly. Acrobat will show the |
| 111 |
other symbol. |
| 112 |
|
| 113 |
<span class="k">\noindent</span> A non stretching textbox: |
| 114 |
<span class="k">\mytextboxvhstretch</span><span class="nb">{</span>text<span class="nb">}{</span>4cm<span class="nb">}{</span>0<span class="nb">}</span> |
| 115 |
<span class="k">\end</span><span class="nb">{</span>Form<span class="nb">}</span> |
| 116 |
</pre></div> |
| 117 |
Required code in preamble:<div class="highlight"><pre><span></span><span class="k">\usepackage</span><span class="nb">{</span>sdapspdf<span class="nb">}</span> |
| 118 |
<span class="c">% Define aliases for the commands we need to use, context_append</span> |
| 119 |
<span class="c">% expands settings, context_set sets them (for the current scope),</span> |
| 120 |
<span class="c">% possibly removing old settings.</span> |
| 121 |
<span class="k">\ExplSyntaxOn</span> |
| 122 |
<span class="k">\let\mycontextappend\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>append:nn |
| 123 |
<span class="k">\let\mycontextset\sdaps</span><span class="nb">_</span>context<span class="nb">_</span>set:nn |
| 124 |
<span class="k">\let\mycheckbox\sdaps</span><span class="nb">_</span>checkbox:nn |
| 125 |
<span class="k">\let\mytextboxvhstretch\sdaps</span><span class="nb">_</span>textbox<span class="nb">_</span>vhstretch:nnn |
| 126 |
<span class="k">\ExplSyntaxOff</span> |
| 127 |
</pre></div> |
| 128 |
</div><div class="content-rendering"> |
| 129 |
<p><img src="_images/sdaps-df7a1db8108564a499998148db3ba5f658896065.svg" alt="\begin{Form} |
| 130 |
% The \my* commands are aliases that are defined in the praemble |
| 131 |
|
| 132 |
% Set the pdf_form option for all boxes (*) |
| 133 |
\mycontextappend{*}{pdf_form=true} |
| 134 |
|
| 135 |
% Or for checkboxes and textboxes separately |
| 136 |
%\mycontextappend{singlechoice}{pdf_form=true} |
| 137 |
%\mycontextappend{multichoice}{pdf_form=true} |
| 138 |
%\mycontextappend{textbox}{pdf_form=true} |
| 139 |
|
| 140 |
\noindent A checkbox: \mycheckbox{}{} \newline |
| 141 |
\mycontextappend{multichoice}{default=true} |
| 142 |
A checked checkbox: \mycheckbox{}{} \newline |
| 143 |
\mycontextappend{multichoice}{default=true,checkboxsymbol=5} |
| 144 |
A checked checkbox with different symbol: \mycheckbox{}{} |
| 145 |
|
| 146 |
Please note that the above rendering is slightly broken as the poppler |
| 147 |
PDF renderer maps the checkboxsymbol incorrectly. Acrobat will show the |
| 148 |
other symbol. |
| 149 |
|
| 150 |
\noindent A non stretching textbox: |
| 151 |
\mytextboxvhstretch{text}{4cm}{0} |
| 152 |
\end{Form}" /></p> |
| 153 |
</div></div><p class="caption">Using PDF forms</p></div></div> |
| 154 |
|
| 155 |
|
| 156 |
<div class="clearer"></div> |
| 157 |
</div> |
| 158 |
</div> |
| 159 |
</div> |
| 160 |
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> |
| 161 |
<div class="sphinxsidebarwrapper"> |
| 162 |
<h4>Previous topic</h4> |
| 163 |
<p class="topless"><a href="sdapslayout.html" |
| 164 |
title="previous chapter">sdapslayout package</a></p> |
| 165 |
<h4>Next topic</h4> |
| 166 |
<p class="topless"><a href="sdapsarray.html" |
| 167 |
title="next chapter">sdapsarray package</a></p> |
| 168 |
<div role="note" aria-label="source link"> |
| 169 |
<h3>This Page</h3> |
| 170 |
<ul class="this-page-menu"> |
| 171 |
<li><a href="_sources/sdapspdf.rst.txt" |
| 172 |
rel="nofollow">Show Source</a></li> |
| 173 |
</ul> |
| 174 |
</div> |
| 175 |
<div id="searchbox" style="display: none" role="search"> |
| 176 |
<h3 id="searchlabel">Quick search</h3> |
| 177 |
<div class="searchformwrapper"> |
| 178 |
<form class="search" action="search.html" method="get"> |
| 179 |
<input type="text" name="q" aria-labelledby="searchlabel" /> |
| 180 |
<input type="submit" value="Go" /> |
| 181 |
</form> |
| 182 |
</div> |
| 183 |
</div> |
| 184 |
<script>$('#searchbox').show(0);</script> |
| 185 |
</div> |
| 186 |
</div> |
| 187 |
<div class="clearer"></div> |
| 188 |
</div> |
| 189 |
<div class="related" role="navigation" aria-label="related navigation"> |
| 190 |
<h3>Navigation</h3> |
| 191 |
<ul> |
| 192 |
<li class="right" style="margin-right: 10px"> |
| 193 |
<a href="genindex.html" title="General Index" |
| 194 |
>index</a></li> |
| 195 |
<li class="right" > |
| 196 |
<a href="sdapsarray.html" title="sdapsarray package" |
| 197 |
>next</a> |</li> |
| 198 |
<li class="right" > |
| 199 |
<a href="sdapslayout.html" title="sdapslayout package" |
| 200 |
>previous</a> |</li> |
| 201 |
<li class="nav-item nav-item-0"><a href="index.html">sdaps-class 0.1 documentation</a> »</li> |
| 202 |
<li class="nav-item nav-item-this"><a href="">sdapspdf package</a></li> |
| 203 |
</ul> |
| 204 |
</div> |
| 205 |
<div class="footer" role="contentinfo"> |
| 206 |
© Copyright 2016, Benjamin Berg. |
| 207 |
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.3. |
| 208 |
</div> |
| 209 |
</body> |
| 210 |
</html> |