Hopding / pdf-lib

Create and modify PDF documents in any JavaScript environment
https://pdf-lib.js.org
MIT License
6.84k stars 652 forks source link

ReferenceError: Encoding is not defined #1582

Open almogyehuda opened 9 months ago

almogyehuda commented 9 months ago

What were you trying to do?

Enumerate on indirect objects

How did you attempt to do it?

const pdfDoc = await PDFDocument.load(buffer); pdfDoc.context.enumerateIndirectObjects()

What actually happened?

ReferenceError: Encoding is not defined

What did you expect to happen?

Not to throw exception.

How can we reproduce the issue?

I have a small express.js server, reading a PDF file and trying to load it with pdf-lib. the server is running in docker container. When running outside the docker container - seems to work fine.

Version

1.17.1

What environment are you running pdf-lib in?

Node

Checklist

Additional Notes

No response

maradondt commented 8 months ago

Also faced with this issue, solved by adding @pdf-lib/standard-fonts to the dependencies and import '@pdf-lib/standard-fonts'; to the file where I use pdf-lib

sleeptil3 commented 8 months ago

Also faced with this issue, solved by adding @pdf-lib/standard-fonts to the dependencies and import '@pdf-lib/standard-fonts'; to the file where I use pdf-lib

YOU, sir, have saved my life and my sanity. Days lost, hours on google, and here lies this simple, elegant solution. Blessings be upon your house.