Open tim-we opened 10 months ago
Hi, thanks for taking the time for bringing this up. I agree, the claim does not hold true anymore. It is from a time where everyone was using webpack and webpack was still polyfilling most Node dependencies by default. That being said, I'd be open to either remove the claim, or add any helpful instructions to make it work. I'd happily accept a PR (but might be slow to respond due to pdfjs not being very high on my prio right now).
First of all thanks for this library.
Your README states:
However the library does not work out of the box in a browser environment.
Document
extendsReadable
which usesStream
which is not defined in a browser env. To make it work you have to add polyfills. Using vite I can make it work using this configuration:I think there should be at least some documentation on how to use the library in a client-side environment if that is explicitly targeted. (Related: #207)
I'm happy to provide a PR with a new markdown file stating the above. Is there a chance that would be accepted?
I also think it would be a good idea to add a check for the existence of
Stream
before using it and throw a error with custom message explaining the problem and perhaps linking to the documentation (hopefully existing by then). That check should be placed in theDocument
constructor before https://github.com/rkusa/pdfjs/blob/b6cdd70c64611d0e1369ad928028b2cf51009379/lib/document.js#L25-L27Also happy to provide a PR for that.