total is undefined in LoadingTask.onProgress
See original GitHub issueAttach (recommended) or Link to PDF file here: https://jsfiddle.net/p3ybwp7d/1/
Configuration:
- Web browser and its version: Google Chrome - Version 62.0.3202.75
- Operating system and its version: Mac OS 10.13
- PDF.js version: 1.10.97
- Is a browser extension: No
Steps to reproduce the problem:
Create loading task and add onProgress callback:
let loadingTask: any = PDFJS.getDocument(this.src);
loadingTask.onProgress = (progressData) => {
// progressData won't contain "total", only "loaded"
};
What is the expected behaviour? (add screenshot)
In previous versions, onProgress
did return both total
and loaded
.
What went wrong? (add screenshot)
total
field is undefined in loadingTask.onProgress
callback.
Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): https://jsfiddle.net/p3ybwp7d/1/
Issue Analytics
- State:
- Created 6 years ago
- Comments:17 (12 by maintainers)
Top Results From Across the Web
Why is event.total in XMLHttpRequest always 0, unless ...
Everything seemed to to be just right, but the event.total -value was always 0 (or undefined in the angular-version.
Read more >JSDoc: Source: api.js
@property {number} total - Total number of bytes in the PDF file. */; /**; * The loading task controls the operations required to...
Read more >JSDoc: Source: display/api.js
"undefined") {; // The full path is required in the 'url' field. ... _worker = null;; /**; * Unique document loading task id...
Read more >JSDoc: Source: display/api.js
'undefined') { // The full path is required in the 'url' field. ... _worker = null; /** * Unique document loading task id...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s related to
fetch
, since you can observe the same issue in Firefox too (with thedom.streams.enabled
andjavascript.options.streams
prefs set inabout:config
).We just updated to 1.10.97 which broke our loading task. As a (hopefully temporary) workaround, we do a header-only fetch for the content-length header beforehand: