for a project I need to edit pdf files. For this usecase im using PDF Lib and got some good results. Currently I only have problems when loading an existing PDF, as you can see in the error message.
TypeError:
stringorUint8ArrayorArrayBuffer, but was actually of typeundefined
and here is the code which causes this error:
const pdfData = await fs.readFile('./test.pdf', 'utf8', (err, data) => {
if (err) {
console.error(err);
return;
}
});
const pdfDoc = await PDFDocument.load(pdfData);
anyone who also ran into this error ?