You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// DecompressionStream failed (for example because there are some extra
// bytes after the end of the compressed data), so we fallback to our
// decoder.
// We already get the bytes from the underlying stream, so we just reuse
// them to avoid get them again.
this.str=newStream(
bytes,
2/* = header size (see ctor) */,
bytes.length,
this.str.dict
);
this.reset();
returnnull;
}
}
This error occurs because promises returned by writer.write(bytes); and writer.close(); are not being awaited. There’s a reason for this though which is explained in whatwg/compression#55 (comment).
A potential solution could be to discard the errors
Attach (recommended) or Link to PDF file
PDF_FILE-1.pdf
Web browser and its version
Chrome 129.0.6668.10 / Firefox 131.0
Operating system and its version
macOS Sonoma 14.6.1 / Ubuntu 22.04.5
PDF.js version
4.4.168
Is the bug present in the latest PDF.js version?
Yes
Is a browser extension
No
Steps to reproduce the problem
What is the expected behavior?
No errors should appear in the console.
What went wrong?
Chrome
The
Uncaught (in promise) TypeError: Junk found after end of compressed data.
error appears in the console.Firefox
The
TypeError: Unexpected input after the end of stream
error appears in the console.Link to a viewer
No response
Additional context
Related code:
pdf.js/src/core/flate_stream.js
Lines 157 to 197 in 233ac17
This error occurs because promises returned by
writer.write(bytes);
andwriter.close();
are not being awaited. There’s a reason for this though which is explained in whatwg/compression#55 (comment).A potential solution could be to discard the errors
They will still be caught by the
catch
block when awaited herepdf.js/src/core/flate_stream.js
Line 170 in 233ac17
The text was updated successfully, but these errors were encountered: