The library pdf-lib is taking the pdf measurements wrong, my pdf has measurements 595pt of width and 842pt of Height, when i make a console.log of width and height it shows that the width is 595 which is OK, but the height shows it in negative, it shows -842pts, So this makes it not find the position Y in the pdf correctly and it does not place the image correctly where I indicate it
What were you trying to do?
I was trying to add an image to the pdf which has version 2.0 acrobat
How did you attempt to do it?
this is my function how i do it, this function works with pdfs which has 1.7 version
export const processSticker = async ({ numeroFactura, base64 }: { numeroFactura: string, base64: string }) => { try { const docPdf = await PDFDocument.load(base64)
}
What actually happened?
The library pdf-lib is taking the pdf measurements wrong, my pdf has measurements 595pt of width and 842pt of Height, when i make a console.log of width and height it shows that the width is 595 which is OK, but the height shows it in negative, it shows -842pts, So this makes it not find the position Y in the pdf correctly and it does not place the image correctly where I indicate it
What did you expect to happen?
Give me back the pdf with the image added
How can we reproduce the issue?
download the proyect in my github https://github.com/fiorebissi/pdf-lib-prueba.git install dependencies of the proyect using npm or yarn pull up the proyect using yarn dev
Version
1.17.1
What environment are you running pdf-lib in?
Node
Checklist
Additional Notes
with pdf files that have 1.7 version it works OK, with higher versions it does not work, it takes bad measurments of the PDF