mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 16:51:38 +10:00
fix: convert readFile to buffer
This commit is contained in:
@ -9,10 +9,13 @@ export const addDigitalSignature = async (documentAsBase64: string): Promise<str
|
|||||||
const PDFArrayCustom = require("./PDFArrayCustom");
|
const PDFArrayCustom = require("./PDFArrayCustom");
|
||||||
const pdfBuffer = Buffer.from(documentAsBase64, "base64");
|
const pdfBuffer = Buffer.from(documentAsBase64, "base64");
|
||||||
const p12Buffer = Buffer.from(
|
const p12Buffer = Buffer.from(
|
||||||
fs.readFileSync(process.env.CERT_FILE_PATH || "ressources/certificate.p12").toString(),
|
fs
|
||||||
(process.env.CERT_FILE_ENCODING as BufferEncoding) || undefined
|
.readFileSync(process.env.CERT_FILE_PATH || "ressources/certificate.p12")
|
||||||
|
.toString(process.env.CERT_FILE_ENCODING ? undefined : "binary"),
|
||||||
|
(process.env.CERT_FILE_ENCODING as BufferEncoding) || "binary"
|
||||||
);
|
);
|
||||||
const SIGNATURE_LENGTH = 12000;
|
|
||||||
|
const SIGNATURE_LENGTH = p12Buffer.length * 2;
|
||||||
|
|
||||||
const pdfDoc = await PDFDocument.load(pdfBuffer);
|
const pdfDoc = await PDFDocument.load(pdfBuffer);
|
||||||
const pages = pdfDoc.getPages();
|
const pages = pdfDoc.getPages();
|
||||||
|
|||||||
Reference in New Issue
Block a user