Draw estimate signatures as vector TikZ instead of PNG
The estimate foot now renders the provider and client signatures as
TikZ \draw/\fill paths straight from the captured stroke data, in two
side-by-side minipages with a \useasboundingbox so the boxes align
regardless of stroke coverage. A side that hasn't signed shows a
signature rule.
- TeXHelpers.SignatureToTikz walks the PostIt wire format
([k, x0,y0, ...] per stroke, coords in [0, CoordinateMax], y-down)
and emits one \draw per stroke (round caps/joins, 1.5pt), flipping y
so the signature is upright on paper; a single-point tap becomes a
filled dot, mirroring the Avalonia round-capped Polyline.
- FrontOfficeApiController.LoadEstimateForRenderAsync includes
Estimate.Signatures so SignaturePro/SignatureClient resolve.
- Estimate_tex.cshtml drops the \includegraphics of a PNG (which
failed the build when the file was absent) and adds \usepackage{tikz}.
- README: document texlive-pictures (tikz) and texlive-fonts-extra
(bera) as runtime deps; bera.sty missing is the likely cause of the
remaining host Emergency stop.
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
bbc37d3095
commit
9c1f552bca
4 changed files with 116 additions and 16 deletions
|
|
@ -11,7 +11,6 @@
|
|||
var proaddr = Model.Query.PerformerProfile.OrganizationAddress.Address.SplitAddressToTeX();
|
||||
var proaddrm = new HtmlString(Model.Query.PerformerProfile.OrganizationAddress.Address);
|
||||
var isestimate = !ViewBag.AsBill;
|
||||
var prosign = new FileInfo($"{ViewBag.BillsDir}/estimate-prosign-{Model.Id}.png");
|
||||
|
||||
}
|
||||
\documentclass[french,11pt]{article}
|
||||
|
|
@ -25,6 +24,7 @@
|
|||
\usepackage{graphicx}
|
||||
\usepackage{fancyhdr}
|
||||
\usepackage{fp}
|
||||
\usepackage{tikz}
|
||||
|
||||
\def\TVA{20} % Taux de la TVA
|
||||
|
||||
|
|
@ -188,19 +188,46 @@
|
|||
}
|
||||
|
||||
|
||||
@if (!(Model.ProviderValidationDate==null)) {
|
||||
<text>
|
||||
\begin{flushright}
|
||||
@(new HtmlString(isestimate?"Devis validé":"Facture validée")) le @TeXHelpers.ToTeX(Model.ProviderValidationDate.ToString("dddd dd MMMM yyyy"))
|
||||
\end{flushright}
|
||||
@if (prosign.Exists) {
|
||||
<text>
|
||||
\begin{center}
|
||||
\hspace{263pt}
|
||||
\includegraphics[height=60pt]{@(ViewBag.BillsDir)/estimate-prosign-@(Model.Id).png}
|
||||
\end{center}
|
||||
</text>
|
||||
@{
|
||||
// Captured signatures, if any. The Estimate.Signatures collection
|
||||
// is loaded by the controller; SignaturePro/SignatureClient project
|
||||
// the row by type. We draw them as vector TikZ at the foot of the
|
||||
// devis (see TeXHelpers.SignatureToTikz), so there is no PNG to
|
||||
// produce or \includegraphics to fail on.
|
||||
var fr = CultureInfo.CreateSpecificCulture("fr-FR");
|
||||
var proSig = Model.SignaturePro;
|
||||
var cliSig = Model.SignatureClient;
|
||||
}
|
||||
</text>
|
||||
|
||||
\vspace{2em}
|
||||
\noindent
|
||||
\begin{minipage}[t]{0.45\textwidth}
|
||||
\textbf{Signature du fournisseur}\\
|
||||
@if (Model.ProviderValidationDate != default(DateTime)) {
|
||||
<text>\small Validé le @TeXHelpers.ToTeX(Model.ProviderValidationDate.ToString("dddd dd MMMM yyyy", fr))\\</text>
|
||||
}
|
||||
@if (proSig != null && proSig.Strokes != null && proSig.Strokes.Length > 0) {
|
||||
<text>\begin{tikzpicture}
|
||||
\useasboundingbox (0,0) rectangle (5,2.5);
|
||||
@proSig.SignatureToTikz(5, 2.5)
|
||||
\end{tikzpicture}</text>
|
||||
} else {
|
||||
<text>\rule[-2.2cm]{5cm}{0.4pt}</text>
|
||||
}
|
||||
\end{minipage}\hfill
|
||||
\begin{minipage}[t]{0.45\textwidth}
|
||||
\textbf{Signature du client}\\
|
||||
@if (Model.ClientValidationDate != default(DateTime)) {
|
||||
<text>\small Validé le @TeXHelpers.ToTeX(Model.ClientValidationDate.ToString("dddd dd MMMM yyyy", fr))\\</text>
|
||||
}
|
||||
@if (cliSig != null && cliSig.Strokes != null && cliSig.Strokes.Length > 0) {
|
||||
<text>\begin{tikzpicture}
|
||||
\useasboundingbox (0,0) rectangle (5,2.5);
|
||||
@cliSig.SignatureToTikz(5, 2.5)
|
||||
\end{tikzpicture}</text>
|
||||
} else {
|
||||
<text>\rule[-2.2cm]{5cm}{0.4pt}</text>
|
||||
}
|
||||
\end{minipage}
|
||||
|
||||
\end{document}
|
||||
|
|
|
|||
Loading…
Reference in a new issue