From 5ed70766b9b576714cea16371cdcaebd5b3fddef Mon Sep 17 00:00:00 2001 From: Milton Gonzalez Date: Fri, 22 May 2026 14:02:56 -0500 Subject: [PATCH] Hide signature widget border for FirmaEC and bump to 1.2.23 --- CHANGELOG.md | 6 +++- DEPLOY_ANDROID.md | 2 +- DEPLOY_WEB.md | 2 +- PRODUCCION.md | 2 +- VERSION | 2 +- android/app/build.gradle | 4 +-- backend/package.json | 2 +- .../src/modules/signing/signing.service.js | 34 +++++++++++++++++-- frontend/package.json | 2 +- 9 files changed, 45 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f5ad7b..8f7b344 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,14 @@ ## Versión actual -- Versión base: `1.2.22` +- Versión base: `1.2.23` ## Historial +### 1.2.23 - 2026-05-22 + +- El PDF firmado oculta el borde visible del widget criptográfico de firma, para que `FirmaEC` respete de verdad la opción `Sin borde`. + ### 1.2.22 - 2026-05-22 - `FirmaEC` deja de mostrar líneas de borde y separadores cuando la preferencia está en `Sin borde`, tanto al colocar la firma como en el PDF final. diff --git a/DEPLOY_ANDROID.md b/DEPLOY_ANDROID.md index 8facafa..a3549f2 100644 --- a/DEPLOY_ANDROID.md +++ b/DEPLOY_ANDROID.md @@ -2,7 +2,7 @@ ## Versión actual -- Base actual: `1.2.22` +- Base actual: `1.2.23` - Fuente de verdad: [VERSION](/home/mgonzalez/desarrollo/react/linkedsign/VERSION) - Historial de cambios: [CHANGELOG.md](/home/mgonzalez/desarrollo/react/linkedsign/CHANGELOG.md) diff --git a/DEPLOY_WEB.md b/DEPLOY_WEB.md index 6b6ac9c..d016d4b 100644 --- a/DEPLOY_WEB.md +++ b/DEPLOY_WEB.md @@ -2,7 +2,7 @@ ## Versión actual -- Base actual: `1.2.22` +- Base actual: `1.2.23` - Fuente de verdad: [VERSION](/home/mgonzalez/desarrollo/react/linkedsign/VERSION) - Historial de cambios: [CHANGELOG.md](/home/mgonzalez/desarrollo/react/linkedsign/CHANGELOG.md) diff --git a/PRODUCCION.md b/PRODUCCION.md index 063ef1a..4a3ff4a 100644 --- a/PRODUCCION.md +++ b/PRODUCCION.md @@ -2,7 +2,7 @@ ## Versión actual -- Base actual: `1.2.22` +- Base actual: `1.2.23` - Fuente de verdad: [VERSION](/home/mgonzalez/desarrollo/react/linkedsign/VERSION) - Historial de cambios: [CHANGELOG.md](/home/mgonzalez/desarrollo/react/linkedsign/CHANGELOG.md) diff --git a/VERSION b/VERSION index 9a83513..a93a6f7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.22 +1.2.23 diff --git a/android/app/build.gradle b/android/app/build.gradle index 68b7905..1339eb5 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -18,8 +18,8 @@ android { applicationId "net.linkedcorp.linkedsign" minSdk 26 targetSdk 35 - versionCode 10222 - versionName "1.2.22" + versionCode 10223 + versionName "1.2.23" buildConfigField "String", "API_BASE_URL", "\"${apiBaseUrl}\"" } diff --git a/backend/package.json b/backend/package.json index 6fb5307..93f6ac4 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "linkedsign-backend", - "version": "1.2.22", + "version": "1.2.23", "private": true, "description": "Initial backend for LinkedSign", "main": "src/server.js", diff --git a/backend/src/modules/signing/signing.service.js b/backend/src/modules/signing/signing.service.js index 2b29af1..a985e7a 100644 --- a/backend/src/modules/signing/signing.service.js +++ b/backend/src/modules/signing/signing.service.js @@ -1,7 +1,7 @@ const fs = require('fs/promises'); const path = require('path'); const QRCode = require('qrcode'); -const { PDFDocument, rgb, StandardFonts } = require('pdf-lib'); +const { PDFDocument, PDFArray, PDFName, PDFNumber, rgb, StandardFonts } = require('pdf-lib'); const { pdflibAddPlaceholder } = require('@signpdf/placeholder-pdf-lib'); const { SignPdf } = require('@signpdf/signpdf'); const { P12Signer } = require('@signpdf/signer-p12'); @@ -87,6 +87,34 @@ function buildLocalizedSignatureTimestamp({ locale, timeZone } = {}) { } } +function hideSignatureWidgetBorder(pdfDoc, pageIndex) { + const page = pdfDoc.getPages()[pageIndex]; + if (!page) return; + + const annotations = page.node.lookupMaybe(PDFName.of('Annots'), PDFArray); + if (!annotations || annotations.size() === 0) return; + + const widgetRef = annotations.get(annotations.size() - 1); + const widget = pdfDoc.context.lookup(widgetRef); + if (!widget) return; + + const zeroBorder = PDFArray.withContext(pdfDoc.context); + zeroBorder.push(PDFNumber.of(0)); + zeroBorder.push(PDFNumber.of(0)); + zeroBorder.push(PDFNumber.of(0)); + + widget.set(PDFName.of('Border'), zeroBorder); + widget.set(PDFName.of('BS'), pdfDoc.context.obj({ + Type: 'Border', + W: 0, + S: 'S', + })); + widget.set(PDFName.of('MK'), pdfDoc.context.obj({ + BC: [], + BG: [], + })); +} + // ── Style: CLASSIC (blue bar + DS badge) ────────────────────────────────────── async function drawStyleClassic(pdfDoc, page, sx, sy, sw, sh, { signerName, reason, dateStr, timeStr, location }) { const f1 = await pdfDoc.embedFont(StandardFonts.HelveticaBold); @@ -391,6 +419,7 @@ const signPdf = async ({ // ── Add cryptographic signature placeholder ─────────────────────── const pdfDocForSign = await PDFDocument.load(pdfWithStamp); + const placeholderPageIndex = Math.min(page, pdfDocForSign.getPageCount() - 1); pdflibAddPlaceholder({ pdfDoc: pdfDocForSign, reason: reason || 'Firma digital', @@ -399,8 +428,9 @@ const signPdf = async ({ location: location || '', signatureLength: 32768, rect: [sx, sy, sx + sw, sy + sh], - pageIndex: Math.min(page, pdfDocForSign.getPageCount() - 1), + pageIndex: placeholderPageIndex, }); + hideSignatureWidgetBorder(pdfDocForSign, placeholderPageIndex); const pdfWithPlaceholder = Buffer.from(await pdfDocForSign.save({ useObjectStreams: false })); diff --git a/frontend/package.json b/frontend/package.json index 0da2527..202c911 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "frontend", "private": true, - "version": "1.2.22", + "version": "1.2.23", "type": "module", "scripts": { "dev": "vite",