I tried to add png image in nest.js using pdf-lib
import { PDFDocument } from 'pdf-lib';
import * as fs from 'fs';
const existingPdf = await fs.readFileSync(
'./agreements/1431993ded73f6a0be5653a3e3fc680f.pdf',
);
const pdfDoc = await PDFDocument.load(existingPdf);
const pdfPage = await pdfDoc.getPage(1);
const pdfImage = await pdfDoc.embedPng(getAddressDto.signBase64);
pdfPage.drawImage(pdfImage, {
x: 10,
y: 10,
width: 15,
height: 40,
});
return await pdfDoc.save();
my png image in base64 format. there if nothing in console and there is no image in file
also i tried to add new page, but it didn't work too