~sthagen/liitos#78: 
Add PDF signature block insertion capability (experimental is ok)

Please add the capability for PDF signature blick insertion.

Adding to setup.tex.in:

--- old-setup.tex  2024-11-15 13:42:45.452266300 +0100
+++ new-setup.tex   2024-11-22 12:15:40.953605900 +0100
@@ -53,6 +53,9 @@
 ]{ITCFranklinGothicStd-Book}%%_PATCH_%_MAIN_%_FONT_%%
 \usepackage{sourcecodepro}%%_PATCH_%_FIXED_%_FONT_%_PACKAGE_%%

+\usepackage{luatex85}% provides emulation of pdfTeX primitives for LuaTeX v0.85+
+\usepackage{digsig}% TODO requires logic and alternate implementation in case digsig.sty is not wanted or available
+
 % use upquote if available, for straight quotes in verbatim environments
 \IfFileExists{upquote.sty}{\usepackage{upquote}}{}
 \makeatletter

and then create logic to achieve something like this in bookmatter.tex in the table cells for signatures:

\begin{Form}\digsigfield{40ex}{4ex}{Author Signature}\end{Form}

Best derive the "name of the field" (parameter #3) from the unique entry in the related name field as the values have to be unique.

From digsig.sty documentation:

% Macro \digsigfield for creating a PDF signature field, similar in effect to
% hyperref's \TextField etc. macros. Its arguments are:
%   # 1: field width
%   # 2: field height
%   # 3: name of the field; may not contain periods ("."). This is not visible
%       in the printed representation but is usually displayed in a PDF viewer
%       capable of creating or verifying signatures. It depends on internals of
%       the "hyperref" package what happens if you use characters outside the
%       set of printable characters from ISO 646 (vulgo ASCII) or combining
%       control sequences like '\"'. My advice is to first ignore this
%       question, choose a sensible name encoded in your input encoding, and
%       then check the name displayed by your PDF reader. Change and repeat
%       until the result is more or less satisfactory :-).
% From the point of view of TeX, the macro creates an empty box of the
% specified extension with its reference point in the lower left corner.
% Note that the macro does not change TeX's mode; if you want to enforce
% horizontal mode for the environment the box is placed in, you will have to
% take suitable steps yourself before calling the macro.
%
% Until it has been filled in, the field will only become visible in a PDF
% viewer aware of signature fields. Signature-generating software will usually
% create something to appear in the printed representation when you sign the
% field. You can generate a signature field where the signature will not become
% visible on the page by specifying a box of zero width and height. (This is
% not as trivial as it sounds.) However, keep in mind that this field is only
% invisible to the viewer; in terms of TeX, it's a box and may influence
% formatting, in particular in the vertical modes.
%

Note, that digsig.sty is not poart of TeXLive (as of 2024) and because it is "kind of LGPL-v2.1-only licensed" it cannot be included inside liitos (which is MIT licensed) but some way for offering the users to install digsig.sty should be given e.g. by documentation.

Note (license section from the style file):

% License
% =======
% It cannot be applied exactly, but you should consider this file to be usable
% in the spirit of the GNU Lesser General Public License, version 2.1
% (LGPLv2.1; see http://www.gnu.org/licenses/lgpl-2.1.html). Basically, I do
% not claim to have any rights in the documents you create with this software,
% you don't have to distribute my macros with your documents, but if you copy
% or modify the macros and offer this derived version for distribution you have
% to do this under the same license and it must be apparent what you have
% copied or modified.
%
Status
RESOLVED IMPLEMENTED
Submitter
~sthagen
Assigned to
Submitted
4 months ago
Updated
3 months ago
Labels
Feature

~sthagen REPORTED IMPLEMENTED 3 months ago

Implemented in v2024.11.24 as new default. Hints on use and opting out of use are in the help documentation:

 python -m liitos render -h

 Usage: liitos render [OPTIONS] [DOC_ROOT_POS]

 Render the markdown tree for facet of target within render/pdf below document root.
 For ejected / customized templates set matching environment variables to the paths:

 - LIITOS_BOOKMATTER_TEMPLATE (for title page incl. approvals table)
 - LIITOS_PUBLISHER_TEMPLATE (for publisher page incl. changes and proprietary info)
 - LIITOS_METADATA_TEMPLATE (values to required known keys used on LaTeX level)
 - LIITOS_SETUP_TEMPLATE (general layout template)
 - DRIVER_TEMPLATE (template for general structure)

 To not insert PDF digital signature fields set the environment variable
 LIITOS_NO_DIG_SIG_FIELDS to something truthy.
 In case the LaTeX package digital-signature-fields is not found some placeholder
 will be inserted when allowing the insert of such fields in the approvals table.

╭─ Arguments ─────────────────────────────────────────────────────────────────────────────────────────╮
│   doc_root_pos      [DOC_ROOT_POS]                                                                  │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────╮
│ --document-root       -d      TEXT  Root of the document tree to visit. Optional (default:          │
│                                     positional tree root value)                                     │
│ --structure           -s      TEXT  structure mapping file (default: {gat.DEFAULT_STRUCTURE_NAME})  │
│                                     [default: structure.yml]                                        │
│ --target              -t      TEXT  target document key                                             │
│ --facet               -f      TEXT  facet key of target document                                    │
│ --label               -l      TEXT  optional label call to execute                                  │
│ --verbose             -v            Verbose output (default is False)                               │
│ --strict                            Ouput noisy warnings on console (default is False)              │
│ --patch-tables        -p            Patch tables EXPERIMENTAL (default is False)                    │
│ --from-format-spec            TEXT  from format specification handed over to pandoc                 │
│                                     [default: markdown]                                             │
│ --filters             -F      TEXT  comma separated list of filters handed over to pandoc (in       │
│                                     order) or empty to apply no filter                              │
│                                     [default: DEFAULT_FILTER]                                       │
│ --approvals-strategy  -a      TEXT  optional approvals layout strategy in (south, east)             │
│ --help                -h            Show this message and exit.                                     │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯
Register here or Log in to comment, or comment via email.