Show app version in sidebar and split 4-word FirmaEC names in 1.2.26
This commit is contained in:
@@ -59,6 +59,23 @@ function wrapToLines(text, font, size, maxWidth, maxLines) {
|
||||
return lines;
|
||||
}
|
||||
|
||||
function getFirmaEcNameLines(signerName, font, size, maxWidth) {
|
||||
const words = String(signerName || '')
|
||||
.trim()
|
||||
.toUpperCase()
|
||||
.split(/\s+/)
|
||||
.filter(Boolean);
|
||||
|
||||
if (words.length === 4) {
|
||||
return [
|
||||
words.slice(0, 2).join(' '),
|
||||
words.slice(2).join(' '),
|
||||
].map((line) => truncate(line, font, size, maxWidth));
|
||||
}
|
||||
|
||||
return wrapToLines(words.join(' '), font, size, maxWidth, 2);
|
||||
}
|
||||
|
||||
function buildLocalizedSignatureTimestamp({ locale, timeZone } = {}) {
|
||||
const now = new Date();
|
||||
const normalizedLocale = locale || 'es-EC';
|
||||
@@ -343,9 +360,8 @@ async function drawStyleFirmaEC(pdfDoc, page, sx, sy, sw, sh, { signerName, veri
|
||||
page.drawText('Firmado electronicamente por:', { x: textX, y: sy + sh - 21, size: 6, font: fReg, color: rgb(0.12, 0.12, 0.14) });
|
||||
|
||||
// Name — bold, uppercase, word-wrapped up to 2 lines
|
||||
const nameUpper = signerName.toUpperCase();
|
||||
const nameSize = 8.5;
|
||||
const nameLines = wrapToLines(nameUpper, fBold, nameSize, textW, 2);
|
||||
const nameLines = getFirmaEcNameLines(signerName, fBold, nameSize, textW);
|
||||
nameLines.forEach((line, i) => {
|
||||
page.drawText(line, { x: textX, y: sy + sh - 34 - (i * 13), size: nameSize, font: fBold, color: rgb(0.05, 0.05, 0.07) });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user