Issue with Signature Widget Displaying Empty #1602
tusharp1206
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@Hopding
Hello ,
I'm encountering an issue with the display of the signature widget when using the node-signpdf library in conjunction with pdf-lib. Here's a brief overview of the problem I'm facing:
Problem:
When attempting to add a signature widget to a PDF document using the SignPDF class provided by node-signpdf, the signature widget is displayed as empty, without any visible content. Despite setting the correct rectangle coordinates, the widget does not show the expected content.
Steps to Reproduce:
Load a PDF document using pdf-lib.
Use the SignPDF class from node-signpdf to add a signature widget to the PDF document.
Specify the rectangle coordinates for the signature widget.
Save the modified PDF document.
Expected Behavior:
The signature widget should display the specified content within the defined rectangle coordinates.
Actual Behavior:
The signature widget appears empty, with no visible content displayed within the specified rectangle coordinates.
Additional Information:
I have verified that the rectangle coordinates are correctly set.
The PDF document format is compatible with the signature widget requirements.
Code Sample:
import {
PDFDocument,
PDFName,
PDFNumber,
PDFHexString,
PDFString,
} from "pdf-lib";
import SignPdf from "node-signpdf";
import fs from "fs";
import PDFArrayCustom from "./pdfArrayCustom.js";
export default class SignPDF {
constructor(pdfFile, certFile) {
this.pdfDoc = fs.readFileSync(pdfFile);
this.certificate = fs.readFileSync(certFile);
this.password = "my-pass";
}
/**
*/
async signPDF() {
const signer = SignPdf.default;
let newPDF = await this._addPlaceholder();
// newPDF = signer.sign(newPDF, this.certificate,this.password);
newPDF = signer.sign(newPDF, this.certificate, {
passphrase: this.password,
});
return newPDF;
}
/**
/
async _addPlaceholder() {
const loadedPdf = await PDFDocument.load(this.pdfDoc);
const ByteRange = PDFArrayCustom.withContext(loadedPdf.context);
const DEFAULT_BYTE_RANGE_PLACEHOLDER = '*********';
const SIGNATURE_LENGTH = 3322;
const pages = loadedPdf.getPages();
}
/**
*/
static unit8ToBuffer(unit8) {
let buf = Buffer.alloc(unit8.byteLength);
const view = new Uint8Array(unit8);
}
}
I would appreciate any insights or suggestions on how to resolve this issue. Thank you in advance for your assistance!
Thank You,
Beta Was this translation helpful? Give feedback.
All reactions