Hide signature widget border for FirmaEC and bump to 1.2.23
This commit is contained in:
+5
-1
@@ -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.
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
|
||||
@@ -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}\""
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 }));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"private": true,
|
||||
"version": "1.2.22",
|
||||
"version": "1.2.23",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
Reference in New Issue
Block a user